Class HttpFunction

  • All Implemented Interfaces:
    com.google.cloud.functions.HttpFunction, io.micronaut.context.ApplicationContextProvider, java.io.Closeable, java.lang.AutoCloseable

    public class HttpFunction
    extends io.micronaut.function.executor.FunctionInitializer
    implements com.google.cloud.functions.HttpFunction
    Entry point into the Micronaut + GCP integration.
    Since:
    1.2.0
    Author:
    graemerocher
    • Nested Class Summary

      • Nested classes/interfaces inherited from class io.micronaut.function.executor.FunctionInitializer

        io.micronaut.function.executor.FunctionInitializer.ParseContext
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected io.micronaut.context.ApplicationContext applicationContext  
      protected static org.slf4j.Logger LOG  
      • Fields inherited from class io.micronaut.function.executor.FunctionInitializer

        closeContext
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpFunction()
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected io.micronaut.context.ApplicationContext buildApplicationContext​(C arg0)  
      io.micronaut.context.ApplicationContext getApplicationContext()  
      GoogleHttpResponse invoke​(com.google.cloud.functions.HttpRequest request)
      Invoke the function directly with the given request object.
      GoogleHttpResponse invoke​(io.micronaut.http.HttpMethod method, java.lang.String uri)
      Invoke the function directly with the given request object.
      GoogleHttpResponse invoke​(io.micronaut.http.HttpMethod method, java.lang.String uri, java.lang.Object body)
      Invoke the function directly with the given request object.
      GoogleHttpResponse invoke​(io.micronaut.http.HttpRequest<?> request)
      Invoke the function directly with the given request object.
      protected io.micronaut.context.ApplicationContextBuilder newApplicationContextBuilder()  
      protected io.micronaut.inject.ExecutableMethod<java.lang.Object,​java.lang.Object> resolveFunction​(io.micronaut.function.LocalFunctionRegistry arg0, java.lang.String arg1)  
      protected java.lang.String resolveFunctionName​(io.micronaut.context.env.Environment arg0)  
      void service​(com.google.cloud.functions.HttpRequest request, com.google.cloud.functions.HttpResponse response)  
      protected io.micronaut.context.env.Environment startEnvironment​(io.micronaut.context.ApplicationContext arg0)  
      protected void startThis​(io.micronaut.context.ApplicationContext applicationContext)  
      • Methods inherited from class io.micronaut.function.executor.FunctionInitializer

        close, injectThis, run
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        protected static final org.slf4j.Logger LOG
      • applicationContext

        protected io.micronaut.context.ApplicationContext applicationContext
    • Constructor Detail

      • HttpFunction

        public HttpFunction()
        Default constructor.
    • Method Detail

      • startThis

        protected void startThis​(io.micronaut.context.ApplicationContext applicationContext)
        Overrides:
        startThis in class io.micronaut.function.executor.FunctionInitializer
      • newApplicationContextBuilder

        @Nonnull
        protected io.micronaut.context.ApplicationContextBuilder newApplicationContextBuilder()
      • service

        public void service​(com.google.cloud.functions.HttpRequest request,
                            com.google.cloud.functions.HttpResponse response)
                     throws java.lang.Exception
        Specified by:
        service in interface com.google.cloud.functions.HttpFunction
        Throws:
        java.lang.Exception
      • invoke

        public GoogleHttpResponse invoke​(com.google.cloud.functions.HttpRequest request)
        Invoke the function directly with the given request object.
        Parameters:
        request - The request object
        Returns:
        The response object
      • invoke

        public GoogleHttpResponse invoke​(io.micronaut.http.HttpMethod method,
                                         java.lang.String uri)
        Invoke the function directly with the given request object.
        Parameters:
        method - The method
        uri - The URI
        Returns:
        The response object
      • invoke

        public GoogleHttpResponse invoke​(io.micronaut.http.HttpMethod method,
                                         java.lang.String uri,
                                         java.lang.Object body)
        Invoke the function directly with the given request object.
        Parameters:
        method - The method
        uri - The URI
        body - The body
        Returns:
        The response object
      • invoke

        public GoogleHttpResponse invoke​(io.micronaut.http.HttpRequest<?> request)
        Invoke the function directly with the given request object.
        Parameters:
        request - The request object
        Returns:
        The response object
      • resolveFunction

        protected io.micronaut.inject.ExecutableMethod<java.lang.Object,​java.lang.Object> resolveFunction​(io.micronaut.function.LocalFunctionRegistry arg0,
                                                                                                                java.lang.String arg1)
      • resolveFunctionName

        protected java.lang.String resolveFunctionName​(io.micronaut.context.env.Environment arg0)
      • buildApplicationContext

        protected io.micronaut.context.ApplicationContext buildApplicationContext​(@Nullable
                                                                                  C arg0)
      • startEnvironment

        protected io.micronaut.context.env.Environment startEnvironment​(io.micronaut.context.ApplicationContext arg0)
      • getApplicationContext

        public io.micronaut.context.ApplicationContext getApplicationContext()
        Specified by:
        getApplicationContext in interface io.micronaut.context.ApplicationContextProvider