Class ResourceNames

java.lang.Object
io.github.flink.gcp.connector.base.options.ResourceNames

@Internal public final class ResourceNames extends Object
The check a configured value earns by being a component of a resource path this project composes.

Separate from OptionChecks, which is about a Duration and says so. The argument here is its own, which is what that class asks of a new check: a connector builds projects/{project}/topics/{topic} and its siblings by concatenation, so a '/' inside a component does not fail — it silently addresses a different resource, and the service answers for a name the user never typed. Leading or trailing whitespace is rejected in the same breath because it is never meant, and because a name is compared and logged far from where it was set.

The rule is deliberately narrow, and two neighbouring shapes fall outside it. A value that is a full resource path — Pub/Sub's kmsKeyName, spelled projects/…/cryptoKeys/… — carries the separator by definition. And a value the connector only forwards for the service to resolve, such as appProfileId, is checked for presence and blankness alone: what characters that service accepts in a name is its answer, and a copy of its rules kept here would refuse a name it would have taken. ADR-0127 carries the survey and the measurement behind both boundaries.

The three messages are the wording the six private copies this replaces already had, kept verbatim so a rejection reads the same as it did before.

  • Method Details

    • checkComponent

      public static String checkComponent(String value, String name)
      Returns the value, having checked it can be concatenated into a resource path unchanged.
      Parameters:
      value - the configured component to check
      name - the option name, for the failure message
      Returns:
      the value
    • checkNotBlank

      public static String checkNotBlank(String value, String name)
      Returns the value, having checked it is present and not blank.

      For a value the connector forwards rather than composes, where the service owns which characters its names may hold. Blankness is still ours: an empty or whitespace-only value is a configuration mistake in every service, and rejecting it at the setter names the option rather than leaving a remote error to be traced back.

      Parameters:
      value - the configured value to check
      name - the option name, for the failure message
      Returns:
      the value