cmd

package
v0.0.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2021 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2021 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2021 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2021 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var Blue = "\033[34m"
View Source
var Cyan = "\033[36m"
View Source
var Gray = "\033[38m"
View Source
var Green = "\033[32m"
View Source
var Purple = "\033[35m"
View Source
var Red = "\033[31m"
View Source
var Reset = "\033[0m"
View Source
var White = "\033[97m"
View Source
var Yellow = "\033[33m"

Functions

func AwaitConnectorInput added in v0.0.2

func AwaitConnectorInput() (bool, bool, []int)

AwaitConnectorInput prompts the user for input A connector can be selected by entering a connector id e.g > 4 Which will result in a return value of 4

func AwaitConnectorTaskInput added in v0.0.2

func AwaitConnectorTaskInput() (int, int)

AwaitConnectorTaskInput prompts the user for input A connector can be selected by entering a connector id e.g > 4 Which will result in a return value of 4, -1 Or a connector and task can be selected by entering e.g > 5.2 Which will result in a return value of 5, 2

func AwaitUserConfirm added in v0.0.2

func AwaitUserConfirm() bool

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func ExecuteConnectorOp added in v0.0.19

func ExecuteConnectorOp(op Operation, host string, port string, connectorName string)

func ExecuteOp added in v0.0.4

func ExecuteOp(op Operation, host string, port string, connector Connector)

func FormatPollInterval added in v0.0.2

func FormatPollInterval(pollIntervalMs int) string

func FormatState added in v0.0.16

func FormatState(state string) string

func FormatStatus added in v0.0.26

func FormatStatus(status string, statusCode int) string

func GetConnectorConfig added in v0.0.2

func GetConnectorConfig(host string, port string, connectorName string) map[string]string

GetConnectorConfig gets the connector config

func GetConnectorTasks added in v0.0.2

func GetConnectorTasks(host string, port string, connector string) map[int]TaskStatus

func GetConnectorsDetails added in v0.0.2

func GetConnectorsDetails(host string, port string, connectors map[int]Connector) map[int]Connector

func GetConnectorsList added in v0.0.31

func GetConnectorsList(host string, port string) []string

func GetConnectorsMap added in v0.0.2

func GetConnectorsMap(host string, port string) map[int]Connector

GetConnectorsMap returns a map of connectorId -> connectorName The connectorId is based on the alphabetically sorted connectorNames

func GetPersistentFlags

func GetPersistentFlags(cmd *cobra.Command) (string, string)

func HasCaseInsensitivePrefix added in v0.0.22

func HasCaseInsensitivePrefix(s string, prefix string) bool

func List added in v0.0.2

func List(cmd *cobra.Command, args []string) map[int]Connector

func LoadConfig added in v0.0.4

func LoadConfig(client *retryablehttp.Client, host string, port string, configFile ConfigFile) *http.Response

Types

type ConfigFile added in v0.0.4

type ConfigFile struct {
	FileName       string
	ConnectorName  string
	ConnectorClass string
	PluginClass    string
	Config         map[string]string
	ConfigBytes    []byte
	ValidationResp ValidationResponse
	LoadResp       *http.Response
	Error          error
}

func (*ConfigFile) FormattedStatus added in v0.0.26

func (cf *ConfigFile) FormattedStatus() string

func (*ConfigFile) Read added in v0.0.4

func (cf *ConfigFile) Read()

type Connector added in v0.0.2

type Connector struct {
	Id      int
	Name    string
	Details ConnectorDetails
}

func (Connector) PollInterval added in v0.0.2

func (c Connector) PollInterval() string

type ConnectorDetails added in v0.0.2

type ConnectorDetails struct {
	Name      string
	Config    map[string]string
	Connector ConnectorState
	Tasks     []TaskState
}

func GetConnectorDetails added in v0.0.2

func GetConnectorDetails(host string, port string, connectorId int, connectorName string) ConnectorDetails

GetConnectorDetails gets all connector and task statuses and config for a given connectorName

func GetConnectorStatus

func GetConnectorStatus(host string, port string, connectorName string) ConnectorDetails

GetConnectorStatus gets the connector status

type ConnectorState

type ConnectorState struct {
	State    string
	WorkerId string `json:"worker_id"`
}

func (ConnectorState) FormattedState added in v0.0.16

func (c ConnectorState) FormattedState() string

type ConnectorStatus

type ConnectorStatus struct {
	ConnectorId int
	Name        string
	Connector   ConnectorState
	Tasks       []TaskState
}

type DiffResult added in v0.0.28

type DiffResult struct {
	ConnectorName string
	NewKeys       map[string]string
	MatchKeys     map[string]string
	MismatchKeys  map[string]MismatchVals
	RemovedKeys   map[string]string
}

type DiffResults added in v0.0.28

type DiffResults struct {
	DiffedConnectors    []string
	NewConnectors       []string
	ChangedConnectors   []DiffResult
	UnchangedConnectors []string
	OmittedConnectors   []string
	ShowOmitted         bool
}

type MismatchVals added in v0.0.28

type MismatchVals struct {
	Deployed string
	File     string
}

type Operation added in v0.0.4

type Operation struct {
	Mode       string
	HttpMethod string
	Endpoint   string
}
var (
	Pause   Operation = Operation{"pause", http.MethodPut, "pause"}
	Resume  Operation = Operation{"resume", http.MethodPut, "resume"}
	Delete  Operation = Operation{"delete", http.MethodDelete, ""}
	Restart Operation = Operation{"restart", http.MethodPost, "restart"}
)

type TaskState

type TaskState struct {
	Id       int
	State    string
	WorkerId string `json:"worker_id"`
	Trace    string
	Config   map[string]string
}

func (TaskState) FormattedState added in v0.0.16

func (t TaskState) FormattedState() string

func (TaskState) Summary added in v0.0.2

func (t TaskState) Summary() string

type TaskStatus added in v0.0.2

type TaskStatus struct {
	Id     TaskStatusId
	Config map[string]string
}

type TaskStatusConfig added in v0.0.2

type TaskStatusConfig struct {
	Tables      string
	Query       string
	PubsubTopic string `json:"cps.topic"`
	TopicsRegex string `json:"topics.regex"`
}

type TaskStatusId added in v0.0.2

type TaskStatusId struct {
	Connector string
	TaskId    int `json:"task"`
}

type ValidationResponse added in v0.0.4

type ValidationResponse struct {
	ConnectorName string
	Name          string
	ErrorCount    int `json:"error_count"`
	Configs       []ValidationResponseField
}

func ValidateConfig added in v0.0.4

func ValidateConfig(client *retryablehttp.Client, host string, port string, configFile ConfigFile) ValidationResponse

type ValidationResponseField added in v0.0.4

type ValidationResponseField struct {
	Value ValidationResponseFieldValue
}

type ValidationResponseFieldValue added in v0.0.4

type ValidationResponseFieldValue struct {
	Name   string
	Errors []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL