UpdateBasePathMappingOR와 함께 사용 AWS SDK CLI - AWS SDK코드 예제

AWS 문서 AWS SDK SDK 예제 GitHub 리포지토리에 더 많은 예제가 있습니다.

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

UpdateBasePathMappingOR와 함께 사용 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" }
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();