Ci sono altri AWS SDK esempi disponibili nel repository AWS Doc SDK Examples
Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Utilizzare UpdateBasePathMapping
con un o AWS SDK CLI
I seguenti esempi di codice mostrano come utilizzareUpdateBasePathMapping
.
- CLI
-
- AWS CLI
-
Per modificare il percorso di base per un nome di dominio personalizzato
Comando:
aws apigateway update-base-path-mapping --domain-name
api.domain.tld
--base-pathprod
--patch-operations op='replace',path='/basePath',value='v1'Output:
{ "basePath": "v1", "restApiId": "1234123412", "stage": "api" }
-
Per API i dettagli, vedere UpdateBasePathMapping
in AWS CLI Command Reference.
-
- PHP
-
- SDK per PHP
-
Nota
C'è altro su GitHub. Trova l'esempio completo e scopri di più sulla configurazione e l'esecuzione nel Repository di esempi di codice 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();
-
Per API i dettagli, vedi UpdateBasePathMapping AWS SDK for PHPAPIReference.
-
PutMethodResponse
Scenari