commands

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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 2019-present Open Networking Foundation * * 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 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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.

* Portions copyright 2019-present Open Networking Foundation * Original copyright 2019-present Ciena Corporation * * 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

View Source
const (
	INIT_DEFAULT          = 0
	INIT_NO_VERSION_CHECK = 1 // Do not check whether server is allowed version
)

Flags for calling the InitReflectionClient Method

View Source
const (
	DEFAULT_CREATE_FORMAT = "table{{ .Id }}\t{{ .Message }}"
	DEFAULT_DELETE_FORMAT = "table{{ .Id }}\t{{ .Message }}"
	DEFAULT_UPDATE_FORMAT = "table{{ .Id }}\t{{ .Message }}"
	DEFAULT_SYNC_FORMAT   = "table{{ .Id }}\t{{ .Message }}"
)
View Source
const (
	GM_QUIET         = 1
	GM_UNTIL_FOUND   = 2
	GM_UNTIL_ENACTED = 4
	GM_UNTIL_STATUS  = 8
)

Flags for calling the *WithRetry methods

View Source
const (
	FILTER_DEFAULT    = "DEFAULT"
	FILTER_ALL        = "ALL"
	FILTER_DIRTY      = "SYNCHRONIZER_DIRTY_OBJECTS"
	FILTER_DELETED    = "SYNCHRONIZER_DELETED_OBJECTS"
	FILTER_DIRTYPOL   = "SYNCHRONIZER_DIRTY_POLICIES"
	FILTER_DELETEDPOL = "SYNCHRONIZER_DELETED_POLICIES"
)

Valid choices for FilterModels `Kind` argument

View Source
const ClientFormat = `` /* 249-byte string literal not displayed */
View Source
const (
	DEFAULT_BACKUP_FORMAT = "table{{ .Status }}\t{{ .Checksum }}\t{{ .Chunks }}\t{{ .Bytes }}"
)
View Source
const (
	DEFAULT_MODELTYPE_LIST_FORMAT = "{{ . }}"
)
View Source
const (
	DEFAULT_SERVICE_FORMAT = "table{{ .Name }}\t{{.Version}}\t{{.State}}"
)
View Source
const (
	DEFAULT_TRANSFER_FORMAT = "table{{ .Status }}\t{{ .Checksum }}\t{{ .Chunks }}\t{{ .Bytes }}"
)
View Source
const DefaultFormat = ClientFormat + ServerFormat
View Source
const ServerFormat = `` /* 259-byte string literal not displayed */
View Source
const StatusListFormat = "table{{ .Component }}\t{{ .Name }}\t{{ .Version }}\t{{ .Connection }}\t{{ .Status }}"

Variables

View Source
var CharReplacer = strings.NewReplacer("\\t", "\t", "\\n", "\n")
View Source
var OutputStream io.Writer = os.Stdout

Make it easy to override output stream for testing

Functions

func CheckModelName

func CheckModelName(source grpcurl.DescriptorSource, name string) error

Check to see if a model name is valid

func CommaSeparatedQueryToMap

func CommaSeparatedQueryToMap(query_str string, allow_inequality bool) (map[string]string, error)

Take a string of comma-separated queries and turn it into a map of queries

func Confirmf

func Confirmf(format string, args ...interface{}) bool

Print a confirmation prompt and get a response from the user

func CreateDynamicURI

func CreateDynamicURI() (string, string)

Create a file:/// URI to use for storing the file in the core

func CreateModel

func CreateModel(conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, fields map[string]interface{}) error

Create a model in XOS given a map of fields

func DecodeOperator

func DecodeOperator(query string) (string, string, bool, error)

Separate the operator from the query value. For example,

"==foo"  --> "EQUAL", "foo"

func DeleteModel

func DeleteModel(conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, id int32) error

Get a model from XOS given its ID

func FilterModels

func FilterModels(ctx context.Context, conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, kind string, queries map[string]string) ([]*dynamic.Message, error)

Filter models based on field values

queries is a map of <field_name> to <operator><query>
For example,
  map[string]string{"name": "==mysite"}

func FindModel

func FindModel(ctx context.Context, conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, queries map[string]string) (*dynamic.Message, error)

Get a model from XOS given a fieldName/fieldValue

func FindModelWithRetry

func FindModelWithRetry(ctx context.Context, conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, queries map[string]string, flags uint32) (*grpc.ClientConn, *dynamic.Message, error)

Find a model, but retry under a variety of circumstances

func FormatAndGenerateListOutput

func FormatAndGenerateListOutput(options *ListOutputOptions, default_format string, quiet_format string, data interface{})

Applies common output options to format and generate output

func FormatAndGenerateOutput

func FormatAndGenerateOutput(options *OutputOptions, default_format string, quiet_format string, data interface{})

Applies common output options to format and generate output

func GenerateHeaders

func GenerateHeaders() []string

func GenerateOutput

func GenerateOutput(result *CommandResult)

func GetEnumValue

func GetEnumValue(msg *dynamic.Message, name string) string

func GetFilterKind

func GetFilterKind(kindArg string) (string, error)

Convert a user-supplied state filter argument to the appropriate enum name

func GetIDList

func GetIDList(conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, ids []int32, filter string, all bool) ([]int32, error)

Common processing for commands that take a modelname and a list of ids or a filter

func GetModel

func GetModel(ctx context.Context, conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, id int32) (*dynamic.Message, error)

Get a model from XOS given its ID

func GetModelNames

func GetModelNames(source grpcurl.DescriptorSource) (map[string]bool, error)

Return a list of all available model names

func GetModelWithRetry

func GetModelWithRetry(ctx context.Context, conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, id int32, flags uint32) (*grpc.ClientConn, *dynamic.Message, error)

Get a model, but retry under a variety of circumstances

func GetReflectionMethod

func GetReflectionMethod(conn *grpc.ClientConn, name string) (grpcurl.DescriptorSource, string, error)

func GetVersion

func GetVersion(conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource) (*dynamic.Message, error)

Perform the GetVersion API call on the core to get the version

func GrpcTimeoutContext

func GrpcTimeoutContext(ctx context.Context) (context.Context, context.CancelFunc)

Returns a context used for gRPC timeouts

func InitClient

func InitClient(flags uint32) (*grpc.ClientConn, grpcurl.DescriptorSource, error)

func IsEnacted

func IsEnacted(d *dynamic.Message) bool

Returns True if a message has been enacted

func IsFileUri

func IsFileUri(s string) bool

func ItemsToDynamicMessageList

func ItemsToDynamicMessageList(items interface{}) []*dynamic.Message

func ListModels

func ListModels(ctx context.Context, conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string) ([]*dynamic.Message, error)

List all objects of a given model

func ListOrFilterModels

func ListOrFilterModels(ctx context.Context, conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, kind string, queries map[string]string) ([]*dynamic.Message, error)

Call ListModels or FilterModels as appropriate

func MessageToMap

func MessageToMap(d *dynamic.Message) map[string]interface{}

Takes a *dynamic.Message and turns it into a map of fields to interfaces

TODO: Might be more useful to convert the values to strings and ints

func NewConnection

func NewConnection() (*grpc.ClientConn, error)

func QueryStringsToMap

func QueryStringsToMap(query_args []string, allow_inequality bool) (map[string]string, error)

Take a string list of queries and turns it into a map of queries

func RegisterBackupCommands

func RegisterBackupCommands(parser *flags.Parser)

func RegisterCompletionCommands

func RegisterCompletionCommands(parent *flags.Parser)

func RegisterConfigCommands

func RegisterConfigCommands(parent *flags.Parser)

func RegisterModelCommands

func RegisterModelCommands(parser *flags.Parser)

func RegisterModelTypeCommands

func RegisterModelTypeCommands(parser *flags.Parser)

func RegisterServiceCommands

func RegisterServiceCommands(parser *flags.Parser)

func RegisterStatusCommands

func RegisterStatusCommands(parser *flags.Parser)

func RegisterTransferCommands

func RegisterTransferCommands(parser *flags.Parser)

func RegisterVersionCommands

func RegisterVersionCommands(parent *flags.Parser)

func SetEnumValue

func SetEnumValue(msg *dynamic.Message, name string, value string)

func Ternary_uint32

func Ternary_uint32(condition bool, value_true uint32, value_false uint32) uint32

A makeshift substitute for C's Ternary operator

func TypeConvert

func TypeConvert(source grpcurl.DescriptorSource, modelName string, field_name string, v string) (interface{}, error)

Convert a string into the appropriate gRPC type for a given field

func UpdateModel

func UpdateModel(conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, modelName string, fields map[string]interface{}) error

Update a model in XOS given a map of fields

func UpdateModelStatusOutput

func UpdateModelStatusOutput(output *ModelStatusOutput, i int, id interface{}, status string, err error, final bool)

Types

type BackupCreate

type BackupCreate struct {
	OutputOptions
	ChunkSize int `short:"h" long:"chunksize" default:"65536" description:"Chunk size for streaming transfer"`
	Args      struct {
		LocalFileName string
	} `positional-args:"yes" required:"yes"`
}

func (*BackupCreate) Execute

func (options *BackupCreate) Execute(args []string) error

type BackupOpts

type BackupOpts struct {
	Create  BackupCreate  `command:"create"`
	Restore BackupRestore `command:"restore"`
}

type BackupOutput

type BackupOutput struct {
	Status   string `json:"status"`
	Checksum string `json:"checksum"`
	Chunks   int    `json:"chunks"`
	Bytes    int    `json:"bytes"`
}

type BackupRestore

type BackupRestore struct {
	OutputOptions
	ChunkSize int `short:"h" long:"chunksize" default:"65536" description:"Chunk size for streaming transfer"`
	Args      struct {
		LocalFileName string
	} `positional-args:"yes" required:"yes"`
	CreateURIFunc func() (string, string) // allow override of CreateURIFunc for easy unit testing
}

func (*BackupRestore) Execute

func (options *BackupRestore) Execute(args []string) error

type BashOptions

type BashOptions struct{}

func (*BashOptions) Execute

func (options *BashOptions) Execute(args []string) error

type CommandResult

type CommandResult struct {
	Format   format.Format
	OrderBy  string
	OutputAs OutputType
	Data     interface{}
}

type CompletionOptions

type CompletionOptions struct {
	BashOptions `command:"bash"`
}

type ConfigOptions

type ConfigOptions struct {
}

func (*ConfigOptions) Execute

func (options *ConfigOptions) Execute(args []string) error

type CoreVersionDetails

type CoreVersionDetails struct {
	Version       string `json:"version"`
	PythonVersion string `json:"goversion"`
	GitCommit     string `json:"gitcommit"`
	BuildTime     string `json:"buildtime"`
	Os            string `json:"os"`
	Arch          string `json:"arch"`
	DjangoVersion string `json:"djangoversion"`
}

type DescriptorNotFoundError

type DescriptorNotFoundError struct {
	Version string
}

func (*DescriptorNotFoundError) Error

func (e *DescriptorNotFoundError) Error() string

type DownloadHandler

type DownloadHandler struct {
	RpcEventHandler
	// contains filtered or unexported fields
}

func DownloadFile

func DownloadFile(conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, uri string, local_name string) (*DownloadHandler, error)

func (*DownloadHandler) GetChecksum

func (h *DownloadHandler) GetChecksum() string

func (*DownloadHandler) OnReceiveResponse

func (h *DownloadHandler) OnReceiveResponse(m proto.Message)

type ListOutputOptions

type ListOutputOptions struct {
	OutputOptions
	OrderBy string `short:"r" long:"orderby" default:"" description:"Specify the sort order of the results"`
}

type MethodNotFoundError

type MethodNotFoundError struct {
	Name string
}

func (*MethodNotFoundError) Error

func (e *MethodNotFoundError) Error() string

type MethodVersionNotFoundError

type MethodVersionNotFoundError struct {
	Name    string
	Version string
}

func (*MethodVersionNotFoundError) Error

type ModelCreate

type ModelCreate struct {
	OutputOptions
	Unbuffered  bool          `short:"u" long:"unbuffered" description:"Do not buffer console output"`
	SetFields   string        `long:"set-field" description:"Comma-separated list of field=value to set"`
	SetJSON     string        `long:"set-json" description:"JSON dictionary to use for settings fields"`
	Sync        bool          `long:"sync" description:"Synchronize before returning"`
	SyncTimeout time.Duration `long:"synctimeout" default:"600s" description:"Timeout for --sync option"`
	Args        struct {
		ModelName ModelNameString
	} `positional-args:"yes" required:"yes"`
}

func (*ModelCreate) Execute

func (options *ModelCreate) Execute(args []string) error

type ModelDelete

type ModelDelete struct {
	OutputOptions
	Unbuffered bool   `short:"u" long:"unbuffered" description:"Do not buffer console output and suppress default output processor"`
	Filter     string `short:"f" long:"filter" description:"Comma-separated list of filters"`
	All        bool   `short:"a" long:"all" description:"Operate on all models"`
	Args       struct {
		ModelName ModelNameString
	} `positional-args:"yes" required:"yes"`
	IDArgs struct {
		ID []int32
	} `positional-args:"yes" required:"no"`
}

func (*ModelDelete) Execute

func (options *ModelDelete) Execute(args []string) error

type ModelList

type ModelList struct {
	ListOutputOptions
	ShowHidden      bool   `long:"showhidden" description:"Show hidden fields in default output"`
	ShowFeedback    bool   `long:"showfeedback" description:"Show feedback fields in default output"`
	ShowBookkeeping bool   `long:"showbookkeeping" description:"Show bookkeeping fields in default output"`
	Filter          string `short:"f" long:"filter" description:"Comma-separated list of filters"`
	State           string `short:"s" long:"state" description:"Filter model state [DEFAULT | ALL | DIRTY | DELETED | DIRTYPOL | DELETEDPOL]"`
	Args            struct {
		ModelName ModelNameString
	} `positional-args:"yes" required:"yes"`
}

func (*ModelList) Execute

func (options *ModelList) Execute(args []string) error

type ModelNameString

type ModelNameString string

func (*ModelNameString) Complete

func (modelName *ModelNameString) Complete(match string) []flags.Completion

type ModelOpts

type ModelOpts struct {
	List     ModelList     `command:"list"`
	Update   ModelUpdate   `command:"update"`
	Delete   ModelDelete   `command:"delete"`
	Create   ModelCreate   `command:"create"`
	Sync     ModelSync     `command:"sync"`
	SetDirty ModelSetDirty `command:"setdirty"`
}

type ModelSetDirty

type ModelSetDirty struct {
	OutputOptions
	Unbuffered bool   `short:"u" long:"unbuffered" description:"Do not buffer console output and suppress default output processor"`
	Filter     string `short:"f" long:"filter" description:"Comma-separated list of filters"`
	All        bool   `short:"a" long:"all" description:"Operate on all models"`
	Args       struct {
		ModelName ModelNameString
	} `positional-args:"yes" required:"yes"`
	IDArgs struct {
		ID []int32
	} `positional-args:"yes" required:"no"`
}

func (*ModelSetDirty) Execute

func (options *ModelSetDirty) Execute(args []string) error

type ModelStatusOutput

type ModelStatusOutput struct {
	Rows       []ModelStatusOutputRow
	Unbuffered bool
}

func InitModelStatusOutput

func InitModelStatusOutput(unbuffered bool, count int) ModelStatusOutput

Initialize ModelStatusOutput structure, creating a row for each model that will be output

type ModelStatusOutputRow

type ModelStatusOutputRow struct {
	Id      interface{} `json:"id"`
	Message string      `json:"message"`
}

type ModelSync

type ModelSync struct {
	OutputOptions
	Unbuffered  bool          `short:"u" long:"unbuffered" description:"Do not buffer console output and suppress default output processor"`
	Filter      string        `short:"f" long:"filter" description:"Comma-separated list of filters"`
	SyncTimeout time.Duration `long:"synctimeout" default:"600s" description:"Timeout for synchronization"`
	All         bool          `short:"a" long:"all" description:"Operate on all models"`
	Args        struct {
		ModelName ModelNameString
	} `positional-args:"yes" required:"yes"`
	IDArgs struct {
		ID []int32
	} `positional-args:"yes" required:"no"`
}

func (*ModelSync) Execute

func (options *ModelSync) Execute(args []string) error

type ModelTypeList

type ModelTypeList struct {
	OutputOptions
}

func (*ModelTypeList) Execute

func (options *ModelTypeList) Execute(args []string) error

type ModelTypeOpts

type ModelTypeOpts struct {
	List ModelTypeList `command:"list"`
}

type ModelUpdate

type ModelUpdate struct {
	OutputOptions
	Unbuffered  bool          `short:"u" long:"unbuffered" description:"Do not buffer console output and suppress default output processor"`
	Filter      string        `short:"f" long:"filter" description:"Comma-separated list of filters"`
	SetFields   string        `long:"set-field" description:"Comma-separated list of field=value to set"`
	SetJSON     string        `long:"set-json" description:"JSON dictionary to use for settings fields"`
	Sync        bool          `long:"sync" description:"Synchronize before returning"`
	SyncTimeout time.Duration `long:"synctimeout" default:"600s" description:"Timeout for --sync option"`
	Args        struct {
		ModelName ModelNameString
	} `positional-args:"yes" required:"yes"`
	IDArgs struct {
		ID []int32
	} `positional-args:"yes" required:"no"`
}

func (*ModelUpdate) Execute

func (options *ModelUpdate) Execute(args []string) error

type OutputOptions

type OutputOptions struct {
	Format   string `long:"format" value-name:"FORMAT" default:"" description:"Format to use to output structured data"`
	Quiet    bool   `short:"q" long:"quiet" description:"Output only the IDs of the objects"`
	OutputAs string `short:"o" long:"outputas" default:"table" choice:"table" choice:"json" choice:"yaml" description:"Type of output to generate"`
}

type OutputType

type OutputType uint8
const (
	OUTPUT_TABLE OutputType = iota
	OUTPUT_JSON
	OUTPUT_YAML
)

type QueryEventHandler

type QueryEventHandler struct {
	RpcEventHandler
	Elements map[string]string
	Model    *desc.MessageDescriptor
	Kind     string
	EOF      bool
}

func (*QueryEventHandler) GetParams

func (h *QueryEventHandler) GetParams(msg proto.Message) error

Generate the parameters for Query messages.

type RpcEventHandler

type RpcEventHandler struct {
	Response proto.Message
	Status   *status.Status
	Data     []byte
	Fields   map[string]map[string]interface{}
}

func (*RpcEventHandler) GetParams

func (h *RpcEventHandler) GetParams(msg proto.Message) error

func (*RpcEventHandler) OnReceiveHeaders

func (h *RpcEventHandler) OnReceiveHeaders(metadata.MD)

func (*RpcEventHandler) OnReceiveResponse

func (h *RpcEventHandler) OnReceiveResponse(m proto.Message)

func (*RpcEventHandler) OnReceiveTrailers

func (h *RpcEventHandler) OnReceiveTrailers(s *status.Status, m metadata.MD)

func (*RpcEventHandler) OnResolveMethod

func (h *RpcEventHandler) OnResolveMethod(*desc.MethodDescriptor)

func (*RpcEventHandler) OnSendHeaders

func (h *RpcEventHandler) OnSendHeaders(metadata.MD)

type ServiceList

type ServiceList struct {
	ListOutputOptions
}

func (*ServiceList) Execute

func (options *ServiceList) Execute(args []string) error

type ServiceListOutput

type ServiceListOutput struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	State   string `json:"state"`
}

type ServiceOpts

type ServiceOpts struct {
	List ServiceList `command:"list"`
}

type StatusListOpts

type StatusListOpts struct {
	ListOutputOptions
	Filter string `short:"f" long:"filter" description:"Comma-separated list of filters"`
}

func (*StatusListOpts) Execute

func (options *StatusListOpts) Execute(args []string) error

type StatusOpts

type StatusOpts struct {
	List StatusListOpts `command:"list"`
}

type TransferDownload

type TransferDownload struct {
	OutputOptions
	Args struct {
		URI           string
		LocalFileName string
	} `positional-args:"yes" required:"yes"`
}

func (*TransferDownload) Execute

func (options *TransferDownload) Execute(args []string) error

type TransferOpts

type TransferOpts struct {
	Upload   TransferUpload   `command:"upload"`
	Download TransferDownload `command:"download"`
}

type TransferOutput

type TransferOutput struct {
	Status   string `json:"status"`
	Checksum string `json:"checksum"`
	Chunks   int    `json:"chunks"`
	Bytes    int    `json:"bytes"`
}

type TransferUpload

type TransferUpload struct {
	OutputOptions
	ChunkSize int `short:"h" long:"chunksize" default:"65536" description:"Host and port"`
	Args      struct {
		LocalFileName string
		URI           string
	} `positional-args:"yes" required:"yes"`
}

func (*TransferUpload) Execute

func (options *TransferUpload) Execute(args []string) error

type UnableToParseDescriptorErrror

type UnableToParseDescriptorErrror struct {
	Version string
	// contains filtered or unexported fields
}

func (*UnableToParseDescriptorErrror) Error

type UploadHandler

type UploadHandler struct {
	RpcEventHandler
	// contains filtered or unexported fields
}

func UploadFile

func UploadFile(conn *grpc.ClientConn, descriptor grpcurl.DescriptorSource, local_name string, uri string, chunkSize int) (*UploadHandler, *dynamic.Message, error)

func (*UploadHandler) GetChecksum

func (h *UploadHandler) GetChecksum() string

func (*UploadHandler) GetParams

func (h *UploadHandler) GetParams(msg proto.Message) error

type VersionDetails

type VersionDetails struct {
	Version   string `json:"version"`
	GoVersion string `json:"goversion"`
	GitCommit string `json:"gitcommit"`
	GitDirty  string `json:"gitdirty"`
	BuildTime string `json:"buildtime"`
	Os        string `json:"os"`
	Arch      string `json:"arch"`
}

type VersionOpts

type VersionOpts struct {
	OutputAs   string `short:"o" long:"outputas" default:"table" choice:"table" choice:"json" choice:"yaml" description:"Type of output to generate"`
	ClientOnly bool   `short:"c" long:"client-only" description:"Print only client version"`
}

func (*VersionOpts) Execute

func (options *VersionOpts) Execute(args []string) error

type VersionOutput

type VersionOutput struct {
	Client VersionDetails     `json:"client"`
	Server CoreVersionDetails `json:"server"`
}

Jump to

Keyboard shortcuts

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