スキップしてコンテンツを表示

Amazon API Gateway Management APIのクライアントでエンドポイントを後から設定する方法

0

class ApiGatewayManagementApi.Client A low-level client representing AmazonApiGatewayManagementApi

The Amazon API Gateway Management API allows you to directly manage runtime aspects of your deployed APIs. To use it, you must explicitly set the SDK’s endpoint to point to the endpoint of your deployed API. The endpoint will be of the form https://{api-id}.execute-api.{region}.amazonaws.com/{stage}, or will be the endpoint corresponding to your API’s custom domain and base path, if applicable.

import boto3

client = boto3.client('apigatewaymanagementapi')

のようにドキュメントに書いてあるがendpontは後から設定できますか?

1回答
0

はい、Amazon API Gateway Management APIのクライアントでエンドポイントを後から設定することができます。

API Gateway Management APIを使用する際は、デプロイされたAPIのエンドポイントを明示的に設定する必要があります。クライアントの作成時にエンドポイントを指定しなかった場合でも、後からエンドポイントを設定する方法があります。

AWS SDK for Javaを使用している場合、ApiGatewayManagementApiClientBuilderクラスを使用してクライアントを構築する際に、endpointOverrideメソッドを呼び出してエンドポイントを設定できます。例えば:

ApiGatewayManagementApiClient client = ApiGatewayManagementApiClient.builder() .endpointOverride(URI.create("https://{api-id}.execute-api.{region}.amazonaws.com/{stage}")) .build();

また、既存のクライアントインスタンスに対して新しいエンドポイントを設定したい場合は、新しいクライアントインスタンスを作成し、新しいエンドポイントを指定する必要があります。

エンドポイントは通常、以下の形式になります: https://{api-id}.execute-api.{region}.amazonaws.com/{stage}

または、APIにカスタムドメインとベースパスが設定されている場合は、それに対応するエンドポイントを使用します。

エンドポイントを正しく設定することで、デプロイされたAPIのランタイム側面を直接管理することができます。
Sources
software.amazon.awssdk.services.apigatewaymanagementapi (AWS SDK for Java - 2.21.29)
ApiGatewayManagementApiBaseClientBuilder (AWS SDK for Java - 2.20.22)

回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

関連するコンテンツ