Skip to content

Commit

Permalink
Merge branch 'main' into hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannedolan committed Jul 21, 2023
2 parents 7a392e4 + da4bdb0 commit 5853fc4
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ static ResourceProvider from(Resource resource) {
return x -> Collections.singleton(resource);
}

/** A Resource that shouldn't be provided when reading from the table. */
static class ReadResource extends Resource {

public ReadResource(Resource resource) {
super(resource);
}
}

/** A Resource that shouldn't be provided when wriring to the table. */
static class WriteResource extends Resource {

public WriteResource(Resource resource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected int run(String[] args) throws IOException {

private static InsertInto parseInsertInto(String s) {
String sql = s.trim();
if (!sql.startsWith("insert into ")) {
if (!startsWith(sql, "insert into ")) {
throw new IllegalArgumentException("Expected insert into ... ");
}
String[] parts = sql.substring(12).split("(?i)SELECT"); // case insensitive
Expand Down Expand Up @@ -108,11 +108,11 @@ public String getHelpText() {
@Override
public String matches(String line) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("avro")) {
if (startsWith(sql, "avro")) {
sql = sql.substring("avro".length() + 1);
return sql;
}
Expand All @@ -123,11 +123,11 @@ public String matches(String line) {
@Override
public void execute(String line, DispatchCallback dispatchCallback) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("avro")) {
if (startsWith(sql, "avro")) {
sql = sql.substring("avro".length() + 1);
}

Expand Down Expand Up @@ -175,11 +175,11 @@ public String getHelpText() {
@Override
public String matches(String line) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("yaml insert into ")) {
if (startsWith(sql, "yaml insert into ")) {
sql = sql.substring("yaml insert into ".length());
return sql;
}
Expand All @@ -190,11 +190,11 @@ public String matches(String line) {
@Override
public void execute(String line, DispatchCallback dispatchCallback) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("yaml")) {
if (startsWith(sql, "yaml")) {
sql = sql.substring("yaml".length() + 1);
}

Expand Down Expand Up @@ -249,11 +249,11 @@ public String getHelpText() {
@Override
public String matches(String line) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("pipeline")) {
if (startsWith(sql, "pipeline")) {
sql = sql.substring("pipeline".length() + 1);
return sql;
}
Expand All @@ -264,11 +264,11 @@ public String matches(String line) {
@Override
public void execute(String line, DispatchCallback dispatchCallback) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("pipeline")) {
if (startsWith(sql, "pipeline")) {
sql = sql.substring("pipeline".length() + 1);
}

Expand Down Expand Up @@ -323,11 +323,11 @@ public String getHelpText() {
@Override
public String matches(String line) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("check")) {
if (startsWith(sql, "check")) {
sql = sql.substring("check".length() + 1);
return sql;
}
Expand All @@ -338,11 +338,11 @@ public String matches(String line) {
@Override
public void execute(String line, DispatchCallback dispatchCallback) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("check")) {
if (startsWith(sql, "check")) {
sql = sql.substring("check".length() + 1);
}

Expand Down Expand Up @@ -448,11 +448,11 @@ public String getHelpText() {
@Override
public String matches(String line) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("insert into")) {
if (startsWith(sql, "insert into")) {
sql = sql.substring("insert into".length() + 1);
return sql;
}
Expand All @@ -463,7 +463,7 @@ public String matches(String line) {
@Override
public void execute(String line, DispatchCallback dispatchCallback) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

Expand Down Expand Up @@ -526,7 +526,7 @@ public String getHelpText() {

@Override
public String matches(String line) {
if (line.startsWith("!intro") || line.startsWith("intro")) {
if (startsWith(line, "!intro") || startsWith(line, "intro")) {
return line;
} else {
return null;
Expand Down Expand Up @@ -572,11 +572,11 @@ public String getHelpText() {
@Override
public String matches(String line) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("mermaid insert into ")) {
if (startsWith(sql, "mermaid insert into ")) {
sql = sql.substring("mermaid insert into ".length());
return sql;
}
Expand All @@ -587,11 +587,11 @@ public String matches(String line) {
@Override
public void execute(String line, DispatchCallback dispatchCallback) {
String sql = line;
if (sql.startsWith(SqlLine.COMMAND_PREFIX)) {
if (startsWith(sql, SqlLine.COMMAND_PREFIX)) {
sql = sql.substring(1);
}

if (sql.startsWith("mermaid ")) {
if (startsWith(sql, "mermaid ")) {
sql = sql.substring("mermaid ".length());
}

Expand Down Expand Up @@ -627,4 +627,9 @@ public boolean echoToFile() {
return false;
}
}

// case-insensitive prefix match
static boolean startsWith(String s, String prefix) {
return s.matches("(?i)" + prefix + ".*");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Collections;
import java.util.Map;

public class KafkaTopic extends Resource {
class KafkaTopic extends Resource {
public KafkaTopic(String name, Map<String, String> clientOverrides) {
super("KafkaTopic");
export("name", name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import com.linkedin.hoptimator.catalog.Resource;

public class KafkaTopicAcl extends Resource {
public KafkaTopicAcl(String name, String principal, String method) {
class KafkaTopicAcl extends Resource {
public KafkaTopicAcl(String topicName, String principal, String method) {
super("KafkaTopicAcl");
export("name", name);
export("topicName", topicName);
export("principal", principal);
export("method", method);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Access control rule (colloquially, an Acl)
*/
@ApiModel(description = "Access control rule (colloquially, an Acl)")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1Acl implements io.kubernetes.client.common.KubernetesObject {
public static final String SERIALIZED_NAME_API_VERSION = "apiVersion";
@SerializedName(SERIALIZED_NAME_API_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* AclList is a list of Acl
*/
@ApiModel(description = "AclList is a list of Acl")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1AclList implements io.kubernetes.client.common.KubernetesListObject {
public static final String SERIALIZED_NAME_API_VERSION = "apiVersion";
@SerializedName(SERIALIZED_NAME_API_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* A set of related ACL rules.
*/
@ApiModel(description = "A set of related ACL rules.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1AclSpec {
/**
* The resource access method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* The resource being controlled.
*/
@ApiModel(description = "The resource being controlled.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1AclSpecResource {
public static final String SERIALIZED_NAME_KIND = "kind";
@SerializedName(SERIALIZED_NAME_KIND)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Status, as set by the operator.
*/
@ApiModel(description = "Status, as set by the operator.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1AclStatus {
public static final String SERIALIZED_NAME_MESSAGE = "message";
@SerializedName(SERIALIZED_NAME_MESSAGE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Kafka Topic
*/
@ApiModel(description = "Kafka Topic")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1KafkaTopic implements io.kubernetes.client.common.KubernetesObject {
public static final String SERIALIZED_NAME_API_VERSION = "apiVersion";
@SerializedName(SERIALIZED_NAME_API_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* KafkaTopicList is a list of KafkaTopic
*/
@ApiModel(description = "KafkaTopicList is a list of KafkaTopic")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1KafkaTopicList implements io.kubernetes.client.common.KubernetesListObject {
public static final String SERIALIZED_NAME_API_VERSION = "apiVersion";
@SerializedName(SERIALIZED_NAME_API_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Desired Kafka topic configuration.
*/
@ApiModel(description = "Desired Kafka topic configuration.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1KafkaTopicSpec {
public static final String SERIALIZED_NAME_CLIENT_CONFIGS = "clientConfigs";
@SerializedName(SERIALIZED_NAME_CLIENT_CONFIGS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/**
* V1alpha1KafkaTopicSpecClientConfigs
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1KafkaTopicSpecClientConfigs {
public static final String SERIALIZED_NAME_CONFIG_MAP_REF = "configMapRef";
@SerializedName(SERIALIZED_NAME_CONFIG_MAP_REF)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Reference to a ConfigMap to use for AdminClient configuration.
*/
@ApiModel(description = "Reference to a ConfigMap to use for AdminClient configuration.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1KafkaTopicSpecConfigMapRef {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Current state of the topic.
*/
@ApiModel(description = "Current state of the topic.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1KafkaTopicStatus {
public static final String SERIALIZED_NAME_MESSAGE = "message";
@SerializedName(SERIALIZED_NAME_MESSAGE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Hoptimator Subscription
*/
@ApiModel(description = "Hoptimator Subscription")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1Subscription implements io.kubernetes.client.common.KubernetesObject {
public static final String SERIALIZED_NAME_API_VERSION = "apiVersion";
@SerializedName(SERIALIZED_NAME_API_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* SubscriptionList is a list of Subscription
*/
@ApiModel(description = "SubscriptionList is a list of Subscription")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1SubscriptionList implements io.kubernetes.client.common.KubernetesListObject {
public static final String SERIALIZED_NAME_API_VERSION = "apiVersion";
@SerializedName(SERIALIZED_NAME_API_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Subscription spec
*/
@ApiModel(description = "Subscription spec")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1SubscriptionSpec {
public static final String SERIALIZED_NAME_DATABASE = "database";
@SerializedName(SERIALIZED_NAME_DATABASE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* Filled in by the operator.
*/
@ApiModel(description = "Filled in by the operator.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-19T22:31:00.312Z[Etc/UTC]")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-07-21T22:04:16.918Z[Etc/UTC]")
public class V1alpha1SubscriptionStatus {
public static final String SERIALIZED_NAME_MESSAGE = "message";
@SerializedName(SERIALIZED_NAME_MESSAGE)
Expand Down

0 comments on commit 5853fc4

Please sign in to comment.