Úselo ListBasePathMappings con un AWS SDK o CLI - AWS Ejemplos de código de SDK

Hay más ejemplos de AWS SDK disponibles en el GitHub repositorio de ejemplos de AWS Doc SDK.

Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.

Úselo ListBasePathMappings con un AWS SDK o CLI

En el siguiente ejemplo de código, se muestra cómo usar ListBasePathMappings.

PHP
SDK para PHP
nota

Hay más en marcha GitHub. Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS.

require 'vendor/autoload.php'; use Aws\ApiGateway\ApiGatewayClient; use Aws\Exception\AwsException; /* //////////////////////////////////////////////////////////////////////////// * Purpose: Lists the base path mapping for a custom domain name in * Amazon API Gateway. * * Prerequisites: A custom domain name in API Gateway. For more information, * see "Custom Domain Names" in the Amazon API Gateway Developer Guide. * * Inputs: * - $apiGatewayClient: An initialized AWS SDK for PHP API client for * API Gateway. * - $domainName: The custom domain name for the base path mappings. * * Returns: Information about the base path mappings, if available; * otherwise, the error message. * ///////////////////////////////////////////////////////////////////////// */ function listBasePathMappings($apiGatewayClient, $domainName) { try { $result = $apiGatewayClient->getBasePathMappings([ 'domainName' => $domainName ]); return 'The base path mapping(s) effective URI is: ' . $result['@metadata']['effectiveUri']; } catch (AwsException $e) { return 'Error: ' . $e['message']; } } function listTheBasePathMappings() { $apiGatewayClient = new ApiGatewayClient([ 'profile' => 'default', 'region' => 'us-east-1', 'version' => '2015-07-09' ]); echo listBasePathMappings($apiGatewayClient, 'example.com'); } // Uncomment the following line to run this code in an AWS account. // listTheBasePathMappings();
  • Para obtener más información sobre la API, consulta ListBasePathMappingsla Referencia AWS SDK for PHP de la API.