Package com.google.cloud.functions
Interface TypedFunction<RequestT,ResponseT>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a Cloud Function with a strongly typed interface that is activated by an HTTP request.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceDescribes how to deserialize request object and serialize response objects for an HTTP invocation. -
Method Summary
Modifier and TypeMethodDescriptionCalled to service an incoming HTTP request.default TypedFunction.WireFormatCalled to get the the format object that handles request decoding and response encoding.
-
Method Details
-
apply
Called to service an incoming HTTP request. This interface is implemented by user code to provide the action for a given HTTP function. If this method throws any exception (including anyError) then the HTTP response will have a 500 status code.- Parameters:
arg- the payload of the event, deserialized from the original JSON string.- Returns:
- invocation result or null to indicate the body of the response should be empty.
- Throws:
Exception- to produce a 500 status code in the HTTP response.
-
getWireFormat
Called to get the the format object that handles request decoding and response encoding. If null is returned a default JSON format is used.- Returns:
- the
TypedFunction.WireFormatto use for serialization
-