code: public ProjectSubscriptionName deleteSubscription(String subscriptionId) throws Exception {
      // [START pubsub_delete_subscription]
      try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
        ProjectSubscriptionName subscriptionName =
            ProjectSubscriptionName.of(projectId, subscriptionId);
        subscriptionAdminClient.deleteSubscription(subscriptionName);
        return subscriptionName;
      }
      // [END pubsub_delete_subscription]
    }
docs: Example of deleting a subscription.