class HorizontalPodAutoscalerV2beta2Example {
  private static final Logger logger = LoggerFactory.getLogger(HorizontalPodAutoscalerV2beta2Example.class);

  public static void main(String[] args) {<FILL_FUNCTION_BODY>}
}

    final ConfigBuilder configBuilder = new ConfigBuilder();
    if (args.length > 0) {
      configBuilder.withMasterUrl(args[0]);
    }
    try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) {
      HorizontalPodAutoscaler horizontalPodAutoscaler = new HorizontalPodAutoscalerBuilder()
          .withNewMetadata().withName("the-hpa").withNamespace("default").endMetadata()
          .withNewSpec()
          .withNewScaleTargetRef()
          .withApiVersion("apps/v1")
          .withKind("Deployment")
          .withName("the-deployment")
          .endScaleTargetRef()
          .withMinReplicas(1)
          .withMaxReplicas(10)
          .addToMetrics(new MetricSpecBuilder()
              .withType("Resource")
              .withNewResource()
              .withName("cpu")
              .withNewTarget()
              .withType("Utilization")
              .withAverageUtilization(50)
              .endTarget()
              .endResource()
              .build())
          .withNewBehavior()
          .withNewScaleDown()
          .addNewPolicy()
          .withType("Pods")
          .withValue(4)
          .withPeriodSeconds(60)
          .endPolicy()
          .addNewPolicy()
          .withType("Percent")
          .withValue(10)
          .withPeriodSeconds(60)
          .endPolicy()
          .endScaleDown()
          .endBehavior()
          .endSpec()
          .build();

      client.autoscaling().v2beta2().horizontalPodAutoscalers().inNamespace("default").resource(horizontalPodAutoscaler)
          .create();
    } catch (KubernetesClientException e) {
      logger.error(e.getMessage(), e);
    }
  
<no_super_class>