Share via


HttpTrigger インターフェイス

public interface HttpTrigger

HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) final HttpRequestMessage<Optional<String>> request) { String name = request.getBody().orElseGet(() -> request.getQueryParameters().get("name")); return name == null ? "クエリ文字列または要求本文に名前を渡してください" : "Hello " + name; }

メソッドの概要

修飾子と型 メソッドと説明
AuthorizationLevel authLevel()

関数を呼び出すために、要求にどのキーが存在する必要があるかを決定します。 承認レベルは、次のいずれかの値になります。

    <li>
    
      <p>
    
        <b>anonymous</b>: No API key is required. </p>
    
    </li>
    
    <li>
    
      <p>
    
        <b>function</b>: A function-specific API key is required. This is the default value if none is provided. </p>
    
    </li>
    
    <li>
    
      <p>
    
        <b>admin</b>: The master key is required. </p>
    
    </li>
    

詳細については、 承認キーに関するドキュメントを参照してください

String dataType()

Functions ランタイムがパラメーター値をどのように扱うかを定義します。 次のいずれかの値になります。

    <li>
    
      <p>"": get the value as a string, and try to deserialize to actual parameter type like POJO </p>
    
    </li>
    
    <li>
    
      <p>string: always get the value as a string </p>
    
    </li>
    
    <li>
    
      <p>binary: get the value as a binary data, and try to deserialize to actual parameter type byte[] </p>
    
    </li>
    

HttpMethod [] methods()

関数が応答する HTTP メソッドの配列。 指定しない場合、関数はすべての HTTP メソッドに応答します。

String name()

要求または要求本文の関数コードで使用される変数名。

String route()

BindingName("id") int id, final ExecutionContext context ) { ....context.getLogger().info("We have " + category + " with id " + id);.... }

ルート構文の詳細については、 オンライン ドキュメントを参照してください。

メソッドの詳細

authLevel

public AuthorizationLevel authLevel() default AuthorizationLevel.FUNCTION

関数を呼び出すために、要求にどのキーが存在する必要があるかを決定します。 承認レベルは、次のいずれかの値になります。

    <li>
    
      <p>
    
        <b>anonymous</b>: No API key is required. </p>
    
    </li>
    
    <li>
    
      <p>
    
        <b>function</b>: A function-specific API key is required. This is the default value if none is provided. </p>
    
    </li>
    
    <li>
    
      <p>
    
        <b>admin</b>: The master key is required. </p>
    
    </li>
    

詳細については、 承認キーに関するドキュメントを参照してください

Returns:

AuthorizationLevel関数にアクセスするために必要なレベルを表す 値。

dataType

public String dataType() default ""

Functions ランタイムがパラメーター値をどのように扱うかを定義します。 次のいずれかの値になります。

    <li>
    
      <p>"": get the value as a string, and try to deserialize to actual parameter type like POJO </p>
    
    </li>
    
    <li>
    
      <p>string: always get the value as a string </p>
    
    </li>
    
    <li>
    
      <p>binary: get the value as a binary data, and try to deserialize to actual parameter type byte[] </p>
    
    </li>
    

Returns:

Functions ランタイムによって使用される dataType。

methods

public HttpMethod [] methods() default

関数が応答する HTTP メソッドの配列。 指定しない場合、関数はすべての HTTP メソッドに応答します。

Returns:

すべての有効な HTTP メソッドを含む配列。

name

public String name()

要求または要求本文の関数コードで使用される変数名。

Returns:

要求または要求本文の関数コードで使用される変数名。

route

public String route() default ""

BindingName("id") int id, final ExecutionContext context ) { ....context.getLogger().info("We have " + category + " with id " + id);.... }

ルート構文の詳細については、 オンライン ドキュメントを参照してください。

Returns:

注釈付き関数に使用するルート テンプレート。

適用対象