-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add 'show connector plugins' syntax (#7284)
- Loading branch information
Showing
21 changed files
with
597 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...in/java/io/confluent/ksql/cli/console/table/builder/ConnectorPluginsListTableBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2021 Confluent Inc. | ||
* | ||
* Licensed under the Confluent Community License (the "License"; you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.confluent.io/confluent-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package io.confluent.ksql.cli.console.table.builder; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import io.confluent.ksql.cli.console.table.Table; | ||
import io.confluent.ksql.rest.entity.ConnectorPluginsList; | ||
import java.util.List; | ||
import org.apache.commons.lang3.ObjectUtils; | ||
import org.apache.kafka.connect.runtime.rest.entities.ConnectorType; | ||
|
||
public class ConnectorPluginsListTableBuilder implements TableBuilder<ConnectorPluginsList> { | ||
private static final List<String> HEADERS = ImmutableList.of( | ||
"Class", "Type", "Version" | ||
); | ||
|
||
@Override | ||
public Table buildTable(final ConnectorPluginsList entity) { | ||
return new Table.Builder() | ||
.withColumnHeaders(HEADERS) | ||
.withRows(entity.getConnectorsPlugins() | ||
.stream() | ||
.map(info -> ImmutableList.of( | ||
info.getClassName(), | ||
ObjectUtils.defaultIfNull(info.getType(), ConnectorType.UNKNOWN).name(), | ||
ObjectUtils.defaultIfNull(info.getVersion(), "")))) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
ksqldb-parser/src/main/java/io/confluent/ksql/parser/tree/ListConnectorPlugins.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2021 Confluent Inc. | ||
* | ||
* Licensed under the Confluent Community License (the "License"; you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.confluent.io/confluent-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package io.confluent.ksql.parser.tree; | ||
|
||
import static com.google.common.base.MoreObjects.toStringHelper; | ||
|
||
import com.google.errorprone.annotations.Immutable; | ||
import io.confluent.ksql.parser.NodeLocation; | ||
import java.util.Optional; | ||
|
||
@Immutable | ||
public class ListConnectorPlugins extends Statement { | ||
public ListConnectorPlugins(final Optional<NodeLocation> location) { | ||
super(location); | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(final AstVisitor<R, C> visitor, final C context) { | ||
return visitor.visitListConnectorPlugins(this, context); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
return (o != null) && (getClass() == o.getClass()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return toStringHelper(this).toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.