または UpdateBasePathMappingで を使用する AWS SDK CLI - AWS SDK CLI コードの例

AWS Doc SDK Examples GitHub リポジトリには他にも AWS SDK例があります。

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

または UpdateBasePathMappingで を使用する AWS SDK CLI

以下のコード例は、UpdateBasePathMapping の使用方法を示しています。

CLI
AWS CLI

カスタムドメイン名のベースパスマッピングを変更するには

コマンド:

aws apigateway update-base-path-mapping --domain-name api.domain.tld --base-path prod --patch-operations op='replace',path='/basePath',value='v1'

出力:

{ "basePath": "v1", "restApiId": "1234123412", "stage": "api" }
  • API 詳細については、「 コマンドリファレンスUpdateBasePathMapping」の「」を参照してください。 AWS CLI

PHP
PHP に関する SDK
注記

については、「」を参照してください GitHub。AWS コード例リポジトリ で全く同じ例を見つけて、設定と実行の方法を確認してください。

require 'vendor/autoload.php'; use Aws\ApiGateway\ApiGatewayClient; use Aws\Exception\AwsException; /* //////////////////////////////////////////////////////////////////////////// * * Purpose: Updates the base path mapping for a custom domain name * in Amazon API Gateway. * * Inputs: * - $apiGatewayClient: An initialized AWS SDK for PHP API client for * API Gateway. * - $basePath: The base path name that callers must provide as part of the * URL after the domain name. * - $domainName: The custom domain name for the base path mapping. * - $patchOperations: The base path update operations to apply. * * Returns: Information about the updated base path mapping, if available; * otherwise, the error message. * ///////////////////////////////////////////////////////////////////////// */ function updateBasePathMapping( $apiGatewayClient, $basePath, $domainName, $patchOperations ) { try { $result = $apiGatewayClient->updateBasePathMapping([ 'basePath' => $basePath, 'domainName' => $domainName, 'patchOperations' => $patchOperations ]); return 'The updated base path\'s URI is: ' . $result['@metadata']['effectiveUri']; } catch (AwsException $e) { return 'Error: ' . $e['message']; } } function updateTheBasePathMapping() { $patchOperations = array([ 'op' => 'replace', 'path' => '/stage', 'value' => 'stage2' ]); $apiGatewayClient = new ApiGatewayClient([ 'profile' => 'default', 'region' => 'us-east-1', 'version' => '2015-07-09' ]); echo updateBasePathMapping( $apiGatewayClient, '(none)', 'example.com', $patchOperations ); } // Uncomment the following line to run this code in an AWS account. // updateTheBasePathMapping();
  • API 詳細については、「 リファレンスUpdateBasePathMapping」の「」を参照してください。 AWS SDK for PHP API