Documentation
¶
Index ¶
- Constants
- Variables
- func AddFormFields(form map[string]io.Reader, values ...string) error
- func BuildCumulocityQuery(cmd *cobra.Command, fixedParts []string, orderBy string) func([]byte) []byte
- func ExactArgsOrExample(n int) cobra.PositionalArgs
- func FilterJsonLines(line []byte) bool
- func GetCollectionPropertyFromAnnotation(cmd *cobra.Command) (value string)
- func GetDeprecationNoticeFromAnnotation(cmd *cobra.Command) (value string)
- func GetDuration(v string, inferUnit bool, unit time.Duration) (time.Duration, error)
- func GetDurationFlag(cmd *cobra.Command, name string, inferUnit bool, unit time.Duration) (time.Duration, error)
- func GetFlagStringValues(cmd *cobra.Command, name string) ([]string, error)
- func GetIDArray(values []string) (ids []string)
- func GetIDs(cmd *cobra.Command, args []string) (ids []string)
- func GetSemanticMethodFromAnnotation(cmd *cobra.Command) (value string)
- func GetStringFromAnnotation(cmd *cobra.Command, path string) (value string)
- func HasValueFromPipeline(cmd *cobra.Command, name string) bool
- func IsRuntimePipelineProperty(v string) bool
- func MakeFormDataReopenable(form map[string]io.Reader) error
- func MarkDeprecated(cmd *cobra.Command, name string, notice string)
- func NewFlagFileContents(cmd *cobra.Command, name string) (iterator.Iterator, error)
- func NewFlagWithPipeIterator(cmd *cobra.Command, pipeOpt *PipelineOptions, supportsPipeline bool) (iterator.Iterator, error)
- func ReopenFormData(form map[string]io.Reader) (map[string]io.Reader, error)
- func ResolveTemplate(value string, pathResolver Resolver) (string, error)
- func ShouldReadFromPipeline(v string) bool
- func UnpackGetterOptions(defaultFormat string, options ...string) (src string, dst string, formatter string)
- func ValidateID(v []byte) (err error)
- func WithBody(cmd *cobra.Command, body *mapbuilder.MapBuilder, ...) (err error)
- func WithC8YQueryOptions(cmd *cobra.Command, inputIterators *RequestInputIterators, opts ...GetOption) ([]string, error)
- func WithFormDataOptions(cmd *cobra.Command, form map[string]io.Reader, ...) (err error)
- func WithFormFields(cmd *cobra.Command, form map[string]io.Reader, flagName string) error
- func WithHeaders(cmd *cobra.Command, header http.Header, inputIterators *RequestInputIterators, ...) (err error)
- func WithOptions(cmd *cobra.Command, opts ...Option) *cobra.Command
- func WithParameters(cmd *cobra.Command, path *StringTemplate, ...) (err error)
- func WithPathParameters(cmd *cobra.Command, path *StringTemplate, ...) (err error)
- func WithQueryParameterMutuallyExclusive(name ...string) c8y.RequestValidator
- func WithQueryParameterOneRequired(name ...string) c8y.RequestValidator
- func WithQueryParameterRequiredTogether(name ...string) c8y.RequestValidator
- func WithQueryParameters(cmd *cobra.Command, query *QueryTemplate, ...) (err error)
- func WithRequestOptions(cmd *cobra.Command, args []string, req *c8y.RequestOptions, ...) (err error)
- type Action
- type AnyString
- type DefaultTemplateString
- type DurationGenerator
- type FilePath
- type FormDataProperty
- type FormField
- type FormFile
- type FormFileContents
- type FormText
- type GetOption
- func NewTimestampFromRelative(encode bool, utc bool, opts ...string) GetOption
- func WithAnyStringValue(opts ...string) GetOption
- func WithBoolValue(opts ...string) GetOption
- func WithBooleanAsString(opts ...string) GetOption
- func WithCertificateFile(opts ...string) GetOption
- func WithCumulocityQuery(queryOptions []GetOption, opts ...string) GetOption
- func WithCurrentPage() GetOption
- func WithCustomStringSlice(valuesFunc func() ([]string, error), opts ...string) GetOption
- func WithCustomStringValue(transform func([]byte) []byte, targetFunc func() string, opts ...string) GetOption
- func WithDataFlagValue() GetOption
- func WithDataValue(opts ...string) GetOption
- func WithDataValueAdvanced(stripCumulocityKeys bool, raw bool, opts ...string) GetOption
- func WithDefaultBoolValue(opts ...string) GetOption
- func WithDefaultTemplateString(value string) GetOption
- func WithDuration(opts ...string) GetOption
- func WithEncodedRelativeTimestamp(opts ...string) GetOption
- func WithEncodedRelativeTimestampUTC(opts ...string) GetOption
- func WithFileBaseName(opts ...string) GetOption
- func WithFileContentsAsString(opts ...string) GetOption
- func WithFileMIMEType(name string, opts ...string) GetOption
- func WithFilePath(opts ...string) GetOption
- func WithFileReader(opts ...string) GetOption
- func WithFloatValue(opts ...string) GetOption
- func WithFormDataFile(srcFile string, srcData string) []GetOption
- func WithFormDataFileAndInfo(srcFile string, srcData string) []GetOption
- func WithFormDataFileAndInfoWithTemplateSupport(templateResolver Resolver, srcFile string, srcData string) []GetOption
- func WithFormDataProperty(name string) GetOption
- func WithIntValue(opts ...string) GetOption
- func WithInventoryChildType(opts ...string) GetOption
- func WithOptionalFragment(opts ...string) GetOption
- func WithOverrideValue(opts ...string) GetOption
- func WithPageSize() GetOption
- func WithPipelineIterator(opts *PipelineOptions) GetOption
- func WithProcessingModeValue() GetOption
- func WithRelativeDate(encode bool, opts ...string) GetOption
- func WithRelativeTimestamp(opts ...string) GetOption
- func WithRelativeTimestampUTC(opts ...string) GetOption
- func WithRequiredProperties(values ...string) GetOption
- func WithRequiredTemplateString(value string) GetOption
- func WithStaticStringValue(opts ...string) GetOption
- func WithStaticStringValue2(opts ...string) GetOption
- func WithStringDefaultValue(defaultValue string, opts ...string) GetOption
- func WithStringFormValue(opts ...string) GetOption
- func WithStringSliceCSV(opts ...string) GetOption
- func WithStringSliceValues(opts ...string) GetOption
- func WithStringValue(opts ...string) GetOption
- func WithTemplateOptions(templateName string, variablesName string, pathResolver Resolver) []GetOption
- func WithTemplateString(value string, applyLast bool) GetOption
- func WithTemplateValue(src string, pathResolver Resolver) GetOption
- func WithTemplateVariablesValue(src ...string) GetOption
- func WithTotalElements() GetOption
- func WithTotalPages() GetOption
- func WithVersion(fallbackSrc string, opts ...string) GetOption
- type Option
- func MarkRenamed(previous, current string) Option
- func WithBatchOptions(acceptInputFile bool) Option
- func WithCollectionProperty(property string) Option
- func WithCommonCumulocityQueryOptions() Option
- func WithData() Option
- func WithDeprecationNotice(message string) Option
- func WithExtendedPipelineSupport(name string, property string, required bool, aliases ...string) Option
- func WithPipelineAliases(property string, aliases ...string) Option
- func WithPipelineSupport(name string) Option
- func WithProcessingMode() Option
- func WithRuntimePipelineProperty() Option
- func WithSemanticMethod(v string) Option
- func WithTemplateNoCompletion() Option
- type OptionBuilder
- type ParameterError
- type PipelineOptions
- type QueryTemplate
- func (b *QueryTemplate) Execute(ignoreIterators bool) (query url.Values, input any, err error)
- func (b *QueryTemplate) GetNext() ([]byte, interface{}, error)
- func (b *QueryTemplate) GetQueryUnescape(ignoreIterators bool) (string, error)
- func (b *QueryTemplate) HasVariable(name string) bool
- func (b *QueryTemplate) IsBound() bool
- func (b *QueryTemplate) SetVariable(name string, value interface{})
- type RawString
- type ReopenableReader
- type RequestBuilder
- type RequestInputIterators
- type RequiredKeys
- type RequiredTemplateString
- type Resolver
- type StringTemplate
- func (b *StringTemplate) CheckRequired() error
- func (b *StringTemplate) Execute(ignoreIterators bool, template ...string) (output string, input interface{}, err error)
- func (b *StringTemplate) GetNext() ([]byte, interface{}, error)
- func (b *StringTemplate) GetTemplate() string
- func (b *StringTemplate) IsBound() bool
- func (b *StringTemplate) SetAllowEmptyValues(value bool)
- func (b *StringTemplate) SetTemplate(template string)
- func (b *StringTemplate) SetVariable(name string, value interface{})
- type Template
- type TemplateVariables
Constants ¶
const ( FlagDataName = "data" FlagDataTemplateName = "template" FlagDataTemplateVariablesName = "templateVars" FlagOutputTemplate = "outputTemplate" FlagProcessingModeName = "processingMode" FlagWithTotalPages = "withTotalPages" FlagWithTotalElements = "withTotalElements" FlagPageSize = "pageSize" FlagCurrentPage = "currentPage" FlagNullInput = "nullInput" FlagAllowEmptyPipe = "allowEmptyPipe" FlagReadFromPipeText = "-" FlagReadFromPipeJSON = "-." )
const ( AnnotationValuePipelineAlias = "pipelineAliases" AnnotationValueFromPipeline = "valueFromPipeline" AnnotationValueFromPipelineData = "valueFromPipeline.data" AnnotationValueCollectionProperty = "collectionProperty" AnnotationValueDeprecated = "deprecatedNotice" AnnotationValueSemanticMethod = "semanticMethod" )
const ( FormDataKeyFilename = "filename" FormDataKeyContentType = "contentType" )
Form data keys which the multipart encoder uses as metadata for the uploaded file rather than as standalone form fields
Variables ¶
var ErrFlagDoesNotExist = errors.New("Flag does not exist")
var ErrFlagError = errors.New("failed to parse arguments")
var ErrInvalidDuration = errors.New("invalid duration")
ErrInvalidDuration invalid duration
var ErrInvalidIDFormat = errors.New("invalid id format")
ErrInvalidIDFormat invalid ID format
var ErrInvalidJSON = errors.New("invalid json")
var ErrInvalidQueryParameter error = errors.New("invalid query parameters")
var ErrParameterMissing error = errors.New("missing required parameter")
var ErrReadFile = errors.New("failed to read file")
var ErrUnsupportedType = errors.New("unsupported type")
Functions ¶
func AddFormFields ¶ added in v2.57.0
AddFormFields adds curl style form fields to the form data. Each field name can only be used once. The file options (type and filename) can only be used by a single file field as the multipart encoder uses them for all files
func BuildCumulocityQuery ¶
func ExactArgsOrExample ¶
func ExactArgsOrExample(n int) cobra.PositionalArgs
ExactArgsOrExample returns an error if there are not exactly n args or --examples is not used
func FilterJsonLines ¶
func GetCollectionPropertyFromAnnotation ¶
GetCollectionPropertyFromAnnotation returns the collection property path used to return a subset of the json response by default
func GetDeprecationNoticeFromAnnotation ¶ added in v2.15.0
GetDeprecationNoticeFromAnnotation returns the deprecated notice if present
func GetDuration ¶
GetDuration get duration with an option of assuming the string is referring to seconds
func GetDurationFlag ¶
func GetFlagStringValues ¶
GetFlagStringValues get string slice from either a string slice or string flag
func GetIDArray ¶
func GetIDs ¶
GetIDs returns a list of IDs --id 1234,1234 (comma separated list (without spaces!)) --id "22437097744 1235" [22437097744, 1235] --id 22437097744 1235,1234 (requires positional arguments as well) --id 22437097744 1235,1234 asdfasdf asdfasdf will be ignored as it does not match the pattern
func GetSemanticMethodFromAnnotation ¶ added in v2.22.1
GetSemanticMethodFromAnnotation returns semantic REST method related to the action from the annotations
func GetStringFromAnnotation ¶
GetStringFromAnnotation returns a string value stored in the annotations
func HasValueFromPipeline ¶
HasValueFromPipeline checks if the given flag name supported values from pipeline It checks the command for a special annotation
func IsRuntimePipelineProperty ¶ added in v2.53.0
Check if the given string is using the pipeline syntax, "-" or "-.myProperty"
func MakeFormDataReopenable ¶ added in v2.57.0
MakeFormDataReopenable converts the form data values so that they can be reopened for each request. Files are reopened by their path, and other readers are buffered in memory
func MarkDeprecated ¶ added in v2.49.0
func NewFlagFileContents ¶
NewFlagFileContents returns iterator which will iterate over the lines in a file
func NewFlagWithPipeIterator ¶
func NewFlagWithPipeIterator(cmd *cobra.Command, pipeOpt *PipelineOptions, supportsPipeline bool) (iterator.Iterator, error)
NewFlagWithPipeIterator creates an iterator from a command argument or from the pipeline It will automatically try to get the value from a String or a StringSlice flag
func ReopenFormData ¶ added in v2.57.0
ReopenFormData returns a copy of the form data where each ReopenableReader is replaced by a fresh reader. Other values are copied as is
func ResolveTemplate ¶ added in v2.32.0
ResolveTemplate returns the contents of the template file, or the value itself if it is not a file. An error is returned if the file is in a denied location
func ShouldReadFromPipeline ¶ added in v2.20.2
func UnpackGetterOptions ¶
func ValidateID ¶
ValidateID returns an error if the input value does not match an id
func WithBody ¶
func WithBody(cmd *cobra.Command, body *mapbuilder.MapBuilder, inputIterators *RequestInputIterators, opts ...GetOption) (err error)
WithBody returns a body from given command line arguments
func WithC8YQueryOptions ¶
func WithC8YQueryOptions(cmd *cobra.Command, inputIterators *RequestInputIterators, opts ...GetOption) ([]string, error)
WithC8YQueryOptions applies given options to a URL Query parameters
func WithFormDataOptions ¶
func WithFormDataOptions(cmd *cobra.Command, form map[string]io.Reader, inputIterators *RequestInputIterators, opts ...GetOption) (err error)
WithFormDataOptions returns a body from given command line arguments
func WithFormFields ¶ added in v2.57.0
WithFormFields adds curl style form fields from a string array flag
func WithHeaders ¶
func WithHeaders(cmd *cobra.Command, header http.Header, inputIterators *RequestInputIterators, opts ...GetOption) (err error)
WithHeaders sets header values from command line arguments
func WithOptions ¶
WithOptions applies given options to the command
func WithParameters ¶ added in v2.53.0
func WithParameters(cmd *cobra.Command, path *StringTemplate, inputIterators *RequestInputIterators, opts ...GetOption) (err error)
WithParameters returns a string from command line arguments
func WithPathParameters ¶
func WithPathParameters(cmd *cobra.Command, path *StringTemplate, inputIterators *RequestInputIterators, opts ...GetOption) (err error)
WithPathParameters returns a path parameter values given from command line arguments
func WithQueryParameterMutuallyExclusive ¶ added in v2.40.0
func WithQueryParameterMutuallyExclusive(name ...string) c8y.RequestValidator
func WithQueryParameterOneRequired ¶ added in v2.40.0
func WithQueryParameterOneRequired(name ...string) c8y.RequestValidator
func WithQueryParameterRequiredTogether ¶ added in v2.40.0
func WithQueryParameterRequiredTogether(name ...string) c8y.RequestValidator
func WithQueryParameters ¶
func WithQueryParameters(cmd *cobra.Command, query *QueryTemplate, inputIterators *RequestInputIterators, opts ...GetOption) (err error)
WithQueryParameters returns a query parameter values given from command line arguments
func WithRequestOptions ¶
func WithRequestOptions(cmd *cobra.Command, args []string, req *c8y.RequestOptions, builderOpts *RequestBuilder) (err error)
Types ¶
type AnyString ¶ added in v2.20.0
type AnyString string
AnyString string type which allows also empty values
type DefaultTemplateString ¶
type DefaultTemplateString string
type DurationGenerator ¶
func GetDurationGenerator ¶
func GetDurationGenerator(cmd *cobra.Command, minFlag, maxFlag string, inferUnit bool, unit time.Duration) (DurationGenerator, error)
GetDurationGenerator returns a random duration generator func. The generator will return a random duration between the given min or max
type FormDataProperty ¶ added in v2.40.0
type FormDataProperty string
type FormField ¶ added in v2.57.0
type FormField struct {
Name string
Value string
File string
ContentFile string
Filename string
ContentType string
}
FormField is a parsed curl style form field, e.g. name=value, name=@file or name=<file
func ParseFormField ¶ added in v2.57.0
ParseFormField parses a curl style form field:
name=value text field name=@path[;type=mime/type][;filename=name] file upload name=<path text field using the contents of a file
type FormFile ¶ added in v2.57.0
type FormFile struct {
Path string
// contains filtered or unexported fields
}
FormFile is a form field which is uploaded as a file. The file is opened for each request
func NewFormFile ¶ added in v2.57.0
NewFormFile creates a new file form field
type FormFileContents ¶ added in v2.57.0
type FormFileContents struct {
Path string
// contains filtered or unexported fields
}
FormFileContents is a text form field whose value is read from a file for each request
func NewFormFileContents ¶ added in v2.57.0
func NewFormFileContents(path string) *FormFileContents
NewFormFileContents creates a text form field which uses the contents of a file
type FormText ¶ added in v2.57.0
type FormText struct {
// contains filtered or unexported fields
}
FormText is a text form field
func NewFormText ¶ added in v2.57.0
NewFormText creates a new text form field
type GetOption ¶
type GetOption func(cmd *cobra.Command, inputIterators *RequestInputIterators) (name string, value interface{}, err error)
GetOption gets the value from a flag and returns the value which can be set accordingly
func NewTimestampFromRelative ¶ added in v2.31.0
func WithAnyStringValue ¶ added in v2.43.3
WithAnyStringValue adds a string from cli arguments but allows the user to set an empty string
func WithBoolValue ¶
WithBoolValue adds a boolean value from cli arguments to a query parameter
func WithBooleanAsString ¶ added in v2.44.0
WithBooleanAsString adds a boolean value from cli arguments where the flag accepts a value
func WithCertificateFile ¶ added in v2.13.0
WithCertificateFile adds a PEM certificate file contents
func WithCumulocityQuery ¶ added in v2.15.0
WithCumulocityQuery build a Cumulocity Query Expression
func WithCurrentPage ¶
func WithCurrentPage() GetOption
func WithCustomStringSlice ¶
WithCustomStringSlice adds string map values from cli arguments
func WithCustomStringValue ¶
func WithCustomStringValue(transform func([]byte) []byte, targetFunc func() string, opts ...string) GetOption
WithCustomStringValue add a custom string value with a custom transform function
func WithDataFlagValue ¶
func WithDataFlagValue() GetOption
func WithDataValue ¶
func WithDataValueAdvanced ¶
WithDataValueAdvanced adds json or shorthand json parsing with additional option to strip the Cumulocity properties from the input
func WithDefaultBoolValue ¶
WithDefaultBoolValue sets a boolean value regardless if the value has been provided by the flag or not
func WithDuration ¶ added in v2.53.0
WithDuration adds a time.Duration value from cli arguments
func WithEncodedRelativeTimestamp ¶
WithEncodedRelativeTimestamp adds a encoded timestamp (string) value from cli arguments
func WithEncodedRelativeTimestampUTC ¶ added in v2.31.0
func WithFileBaseName ¶
WithFileBaseName adds the filename basename from cli arguments
func WithFileContentsAsString ¶ added in v2.30.0
WithFileContentsAsString read the file contents and provide the value as a string
func WithFileMIMEType ¶
WithFileMIMEType adds the file MIME type from cli arguments
func WithFilePath ¶
WithFilePath adds a file path from cli arguments
func WithFileReader ¶
WithFileReader adds file (as reader) from cli arguments
func WithFloatValue ¶
WithFloatValue adds a float (float32) value from cli arguments
func WithFormDataFile ¶
WithFormDataFile adds form data from cli arguments
func WithFormDataFileAndInfo ¶
WithFormDataFileAndInfo adds form data from cli arguments
func WithFormDataFileAndInfoWithTemplateSupport ¶ added in v2.14.0
func WithFormDataProperty ¶ added in v2.40.0
func WithIntValue ¶
WithIntValue adds a integer (int) value from cli arguments
func WithInventoryChildType ¶ added in v2.15.0
func WithOptionalFragment ¶
WithOptionalFragment adds fragment if the boolean value is true a boolean value from cli arguments to a query parameter
func WithOverrideValue ¶
WithOverrideValue adds an options to override a value via cli arguments. Pipeline input is ignored if this value is present However if the argument refers to an existing file then the value will be ignored!
func WithPageSize ¶
func WithPageSize() GetOption
func WithPipelineIterator ¶
func WithPipelineIterator(opts *PipelineOptions) GetOption
WithPipelineIterator adds pipeline support from cli arguments
func WithProcessingModeValue ¶
func WithProcessingModeValue() GetOption
WithProcessingModeValue adds the processing module value from cli arguments
func WithRelativeDate ¶
WithRelativeDate adds a date (only, no time) (string) value from cli arguments
func WithRelativeTimestamp ¶
WithRelativeTimestamp adds a timestamp (string) value from cli arguments
func WithRelativeTimestampUTC ¶ added in v2.31.0
func WithRequiredProperties ¶
func WithStaticStringValue ¶
WithStaticStringValue add a fixed string value
func WithStaticStringValue2 ¶ added in v2.20.0
func WithStringDefaultValue ¶
WithStringDefaultValue adds a string value from cli arguments
func WithStringFormValue ¶ added in v2.14.0
WithStringFormValue adds string (as reader) from cli arguments
func WithStringSliceCSV ¶
WithStringSliceCSV adds a string slice as comma separated variables from cli arguments
func WithStringSliceValues ¶
WithStringSliceValues adds a string slice from cli arguments
func WithStringValue ¶
WithStringValue adds a string value from cli arguments
func WithTemplateOptions ¶
func WithTemplateString ¶
func WithTemplateValue ¶
func WithTotalElements ¶ added in v2.16.0
func WithTotalElements() GetOption
func WithTotalPages ¶
func WithTotalPages() GetOption
func WithVersion ¶
type Option ¶
Option adds flags to a given command
func MarkRenamed ¶ added in v2.49.0
func WithBatchOptions ¶
WithBatchOptions adds support for batch options
func WithCollectionProperty ¶
WithCollectionProperty adds the default property to be plucked from the raw json response so that the important information is returned by default
func WithCommonCumulocityQueryOptions ¶
func WithCommonCumulocityQueryOptions() Option
WithCommonCumulocityQueryOptions adds support for common query parameter options like query, orderBy etc.
func WithDeprecationNotice ¶ added in v2.15.0
WithDeprecationNotice marks a commands as being deprecated
func WithPipelineAliases ¶ added in v2.17.0
WithPipelineAliases adds a list of aliases for a flag if it is selected to be sourced from the pipeline
func WithPipelineSupport ¶
WithPipelineSupport adds support for pipeline to a argument
func WithProcessingMode ¶
func WithProcessingMode() Option
WithProcessingMode adds support for processing mode
func WithRuntimePipelineProperty ¶ added in v2.17.0
func WithRuntimePipelineProperty() Option
func WithSemanticMethod ¶ added in v2.22.1
WithSemanticMethod sets a semantic REST method which may be different to the actual REST method used useful to be more descriptive about how the action should behave (e.g. prompting).
func WithTemplateNoCompletion ¶ added in v2.18.0
func WithTemplateNoCompletion() Option
WithTemplateNoCompletion adds support for templates
type OptionBuilder ¶ added in v2.40.0
type OptionBuilder struct {
Options []GetOption
}
func WithOptionBuilder ¶ added in v2.40.0
func WithOptionBuilder() *OptionBuilder
func (*OptionBuilder) Append ¶ added in v2.40.0
func (b *OptionBuilder) Append(opts ...GetOption) *OptionBuilder
func (*OptionBuilder) AppendSlice ¶ added in v2.40.0
func (b *OptionBuilder) AppendSlice(opts []GetOption) *OptionBuilder
func (*OptionBuilder) Build ¶ added in v2.40.0
func (b *OptionBuilder) Build() []GetOption
type ParameterError ¶
func (*ParameterError) Error ¶
func (e *ParameterError) Error() string
type PipelineOptions ¶
type PipelineOptions struct {
Name string `json:"name"`
Required bool `json:"required"`
EmptyPipe bool `json:"allowEmptyPipe"`
Disabled bool `json:"disabled"`
Property string `json:"property"`
Aliases []string `json:"aliases"`
IsID bool `json:"isID"`
Values []string `json:"values"`
Mode stream.Mode `json:"mode"`
Validator iterator.Validator `json:"-"`
Formatter func([]byte) []byte `json:"-"`
Format string `json:"-"`
InputFilter func([]byte) bool `json:"-"`
PostActions []Action `json:"-"`
}
func GetPipeOptionsFromAnnotation ¶
func GetPipeOptionsFromAnnotation(cmd *cobra.Command) (options *PipelineOptions, err error)
GetPipeOptionsFromAnnotation returns the pipeline options stored in the annotations
type QueryTemplate ¶
type QueryTemplate struct {
// contains filtered or unexported fields
}
QueryTemplate is an iterator that can be used to construct HTTP request queries
func NewQueryTemplate ¶
func NewQueryTemplate() *QueryTemplate
NewQueryTemplate returns a new query iterator template
func (*QueryTemplate) Execute ¶
Execute evaluates the variables and returns a query parameters which can be used for rest requests
func (*QueryTemplate) GetNext ¶
func (b *QueryTemplate) GetNext() ([]byte, interface{}, error)
GetNext returns the next template path
func (*QueryTemplate) GetQueryUnescape ¶
func (b *QueryTemplate) GetQueryUnescape(ignoreIterators bool) (string, error)
GetQueryUnescape returns the unescaped query. User can choose whether iterators are evaluated or not
func (*QueryTemplate) HasVariable ¶
func (b *QueryTemplate) HasVariable(name string) bool
HasVariable returns true if the variable has already been defined
func (*QueryTemplate) IsBound ¶
func (b *QueryTemplate) IsBound() bool
IsBound return true if the iterator is bound
func (*QueryTemplate) SetVariable ¶
func (b *QueryTemplate) SetVariable(name string, value interface{})
SetVariable sets a give path variable which will be evaluated when fetching the next value
type ReopenableReader ¶ added in v2.57.0
ReopenableReader is a form data value which can create a fresh reader for each request, so the same form data can be sent multiple times (e.g. when piping input to a command). Read can be used directly, however it can only be consumed once.
type RequestBuilder ¶
type RequestInputIterators ¶
type RequestInputIterators struct {
Total int
Path *StringTemplate
Body *mapbuilder.MapBuilder
Query *QueryTemplate
PipeOptions *PipelineOptions
}
RequestInputIterators contains all request input iterators
type RequiredKeys ¶
type RequiredKeys []string
type RequiredTemplateString ¶
type RequiredTemplateString string
type StringTemplate ¶
type StringTemplate struct {
// contains filtered or unexported fields
}
StringTemplate is a template which can input parameters which will be ev
func NewStringTemplate ¶
func NewStringTemplate(template string) *StringTemplate
NewStringTemplate returns a new string template
func (*StringTemplate) CheckRequired ¶
func (b *StringTemplate) CheckRequired() error
CheckRequired check if all required variables are provided
func (*StringTemplate) Execute ¶
func (b *StringTemplate) Execute(ignoreIterators bool, template ...string) (output string, input interface{}, err error)
Execute replaces all of the path parameters in a given URI with the provided values Example:
"alarm/alarms/{id}" => "alarm/alarms/1234" if given a parameter map of {"id": "1234"}
func (*StringTemplate) GetNext ¶
func (b *StringTemplate) GetNext() ([]byte, interface{}, error)
GetNext returns the next template path
func (*StringTemplate) GetTemplate ¶
func (b *StringTemplate) GetTemplate() string
GetTemplate return the string template
func (*StringTemplate) IsBound ¶
func (b *StringTemplate) IsBound() bool
IsBound return true if the iterator is bound
func (*StringTemplate) SetAllowEmptyValues ¶
func (b *StringTemplate) SetAllowEmptyValues(value bool)
func (*StringTemplate) SetTemplate ¶
func (b *StringTemplate) SetTemplate(template string)
SetTemplate updates the string template
func (*StringTemplate) SetVariable ¶
func (b *StringTemplate) SetVariable(name string, value interface{})
SetVariable sets a give path variable which will be evaluated when fetching the next value
type TemplateVariables ¶
type TemplateVariables map[string]interface{}