code: public void replacePushConfig(String subscriptionId, String endpoint) throws Exception {
      // [START pubsub_update_push_configuration]
      try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
        ProjectSubscriptionName subscriptionName =
            ProjectSubscriptionName.of(projectId, subscriptionId);
        PushConfig pushConfig = PushConfig.newBuilder().setPushEndpoint(endpoint).build();
        subscriptionAdminClient.modifyPushConfig(subscriptionName, pushConfig);
      }
      // [END pubsub_update_push_configuration]
    }
docs: Example of replacing the push configuration of a subscription, setting the push endpoint.