Excluir um AppProfile

Excluir um AppProfile.

Exemplo de código

C++

Para saber como instalar e usar a biblioteca de cliente do Bigtable, consulte Bibliotecas de cliente do Bigtable.

namespace cbt = ::google::cloud::bigtable;
[](cbt::InstanceAdmin instance_admin, std::string const& instance_id,
   std::string const& profile_id, bool ignore_warnings) {
  google::cloud::Status status = instance_admin.DeleteAppProfile(
      instance_id, profile_id, ignore_warnings);
  if (!status.ok()) throw std::runtime_error(status.message());
  std::cout << "Application Profile deleted\n";
}

PHP

Para saber como instalar e usar a biblioteca de cliente do Bigtable, consulte Bibliotecas de cliente do Bigtable.

use Google\Cloud\Bigtable\Admin\V2\BigtableInstanceAdminClient;
use Google\ApiCore\ApiException;

/**
 * Delete an App Profile from a Bigtable instance.
 *
 * @param string $projectId The Google Cloud project ID
 * @param string $instanceId The ID of the Bigtable instance
 * @param string $appProfileId The ID of the App Profile to be deleted
 */
function delete_app_profile(
    string $projectId,
    string $instanceId,
    string $appProfileId
): void {
    $instanceAdminClient = new BigtableInstanceAdminClient();
    $appProfileName = $instanceAdminClient->appProfileName($projectId, $instanceId, $appProfileId);
    $ignoreWarnings = true;

    printf('Deleting the App Profile: %s' . PHP_EOL, $appProfileId);

    try {
        // If $ignoreWarnings is set to false, Bigtable will warn you that all future requests using the AppProfile will fail
        $instanceAdminClient->deleteAppProfile($appProfileName, $ignoreWarnings);
        printf('App Profile %s deleted.' . PHP_EOL, $appProfileId);
    } catch (ApiException $e) {
        if ($e->getStatus() === 'NOT_FOUND') {
            printf('App Profile %s does not exist.' . PHP_EOL, $appProfileId);
            return;
        }
        throw $e;
    }
}

A seguir

Para pesquisar e filtrar exemplos de código de outros produtos do Google Cloud, consulte o navegador de exemplos do Google Cloud.