Weitere AWS-SDK-Beispiele sind im GitHub-Repository Beispiele für AWS Doc SDKs
Verwendung von UpdateBasePathMapping mit einem AWS-SDK oder CLI
Die folgenden Code-Beispiele zeigen, wie UpdateBasePathMapping verwendet wird.
- CLI
-
- AWS CLI
-
So ändern Sie den Basispfad für einen benutzerdefinierten Domainnamen
Befehl:
aws apigateway update-base-path-mapping --domain-nameapi.domain.tld--base-pathprod--patch-operations op='replace',path='/basePath',value='v1'Ausgabe:
{ "basePath": "v1", "restApiId": "1234123412", "stage": "api" }-
Weitere API-Informationen finden Sie unter UpdateBasePathMapping
in der AWS CLI-Befehlsreferenz.
-
- PHP
-
- SDK für PHP
-
Anmerkung
Auf GitHub finden Sie noch mehr. Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS-Code-Beispiel-
einrichten und ausführen. 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();-
Weitere API-Informationen finden Sie unter UpdateBasePathMapping in der AWS SDK für PHP-API-Referenz.
-
PutMethodResponse
Szenarien