var FileExtensions … var InputExtensions … const defaultHttpGetAttempts … const pathNotExistError … type Builder … var missingResourceError … var LocalResourceError … var StdinMultiUseError … // TODO: expand this to include other errors. func IsUsageError(err error) bool { … } type FilenameOptions … func (o *FilenameOptions) validate() []error { … } func (o *FilenameOptions) RequireFilenameOrKustomize() error { … } type resourceTuple … type FakeClientFunc … func NewFakeBuilder(fakeClientFn FakeClientFunc, restMapper RESTMapperFunc, categoryExpander CategoryExpanderFunc) *Builder { … } // NewBuilder creates a builder that operates on generic objects. At least one of // internal or unstructured must be specified. // TODO: Add versioned client (although versioned is still lossy) // TODO remove internal and unstructured mapper and instead have them set the negotiated serializer for use in the client func newBuilder(clientConfigFn ClientConfigFunc, restMapper RESTMapperFunc, categoryExpander CategoryExpanderFunc) *Builder { … } type noopClientGetter … func (noopClientGetter) ToRESTConfig() (*rest.Config, error) { … } func (noopClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error) { … } func (noopClientGetter) ToRESTMapper() (meta.RESTMapper, error) { … } // NewLocalBuilder returns a builder that is configured not to create REST clients and avoids asking the server for results. func NewLocalBuilder() *Builder { … } func NewBuilder(restClientGetter RESTClientGetter) *Builder { … } func (b *Builder) Schema(schema ContentValidator) *Builder { … } func (b *Builder) AddError(err error) *Builder { … } // VisitorConcurrency sets the number of concurrent visitors to use when // visiting lists. func (b *Builder) VisitorConcurrency(concurrency int) *Builder { … } // FilenameParam groups input in two categories: URLs and files (files, directories, STDIN) // If enforceNamespace is false, namespaces in the specs will be allowed to // override the default namespace. If it is true, namespaces that don't match // will cause an error. // If ContinueOnError() is set prior to this method, objects on the path that are not // recognized will be ignored (but logged at V(2)). func (b *Builder) FilenameParam(enforceNamespace bool, filenameOptions *FilenameOptions) *Builder { … } // Unstructured updates the builder so that it will request and send unstructured // objects. Unstructured objects preserve all fields sent by the server in a map format // based on the object's JSON structure which means no data is lost when the client // reads and then writes an object. Use this mode in preference to Internal unless you // are working with Go types directly. func (b *Builder) Unstructured() *Builder { … } // WithScheme uses the scheme to manage typing, conversion (optional), and decoding. If decodingVersions // is empty, then you can end up with internal types. You have been warned. func (b *Builder) WithScheme(scheme *runtime.Scheme, decodingVersions ...schema.GroupVersion) *Builder { … } // LocalParam calls Local() if local is true. func (b *Builder) LocalParam(local bool) *Builder { … } // Local will avoid asking the server for results. func (b *Builder) Local() *Builder { … } func (b *Builder) isLocal() bool { … } // Mapper returns a copy of the current mapper. func (b *Builder) Mapper() *mapper { … } // URL accepts a number of URLs directly. func (b *Builder) URL(httpAttemptCount int, urls ...*url.URL) *Builder { … } // Stdin will read objects from the standard input. If ContinueOnError() is set // prior to this method being called, objects in the stream that are unrecognized // will be ignored (but logged at V(2)). If StdinInUse() is set prior to this method // being called, an error will be recorded as there are multiple entities trying to use // the single standard input stream. func (b *Builder) Stdin() *Builder { … } // StdinInUse will mark standard input as in use by this Builder, and therefore standard // input should not be used by another entity. If Stdin() is set prior to this method // being called, an error will be recorded as there are multiple entities trying to use // the single standard input stream. func (b *Builder) StdinInUse() *Builder { … } // Stream will read objects from the provided reader, and if an error occurs will // include the name string in the error message. If ContinueOnError() is set // prior to this method being called, objects in the stream that are unrecognized // will be ignored (but logged at V(2)). func (b *Builder) Stream(r io.Reader, name string) *Builder { … } // Path accepts a set of paths that may be files, directories (all can containing // one or more resources). Creates a FileVisitor for each file and then each // FileVisitor is streaming the content to a StreamVisitor. If ContinueOnError() is set // prior to this method being called, objects on the path that are unrecognized will be // ignored (but logged at V(2)). func (b *Builder) Path(recursive bool, paths ...string) *Builder { … } // ResourceTypes is a list of types of resources to operate on, when listing objects on // the server or retrieving objects that match a selector. func (b *Builder) ResourceTypes(types ...string) *Builder { … } // ResourceNames accepts a default type and one or more names, and creates tuples of // resources func (b *Builder) ResourceNames(resource string, names ...string) *Builder { … } // LabelSelectorParam defines a selector that should be applied to the object types to load. // This will not affect files loaded from disk or URL. If the parameter is empty it is // a no-op - to select all resources invoke `b.LabelSelector(labels.Everything.String)`. func (b *Builder) LabelSelectorParam(s string) *Builder { … } // LabelSelector accepts a selector directly and will filter the resulting list by that object. // Use LabelSelectorParam instead for user input. func (b *Builder) LabelSelector(selector string) *Builder { … } // FieldSelectorParam defines a selector that should be applied to the object types to load. // This will not affect files loaded from disk or URL. If the parameter is empty it is // a no-op - to select all resources. func (b *Builder) FieldSelectorParam(s string) *Builder { … } // NamespaceParam accepts the namespace that these resources should be // considered under from - used by DefaultNamespace() and RequireNamespace() func (b *Builder) NamespaceParam(namespace string) *Builder { … } // DefaultNamespace instructs the builder to set the namespace value for any object found // to NamespaceParam() if empty. func (b *Builder) DefaultNamespace() *Builder { … } // AllNamespaces instructs the builder to metav1.NamespaceAll as a namespace to request resources // across all of the namespace. This overrides the namespace set by NamespaceParam(). func (b *Builder) AllNamespaces(allNamespace bool) *Builder { … } // RequireNamespace instructs the builder to set the namespace value for any object found // to NamespaceParam() if empty, and if the value on the resource does not match // NamespaceParam() an error will be returned. func (b *Builder) RequireNamespace() *Builder { … } // RequestChunksOf attempts to load responses from the server in batches of size limit // to avoid long delays loading and transferring very large lists. If unset defaults to // no chunking. func (b *Builder) RequestChunksOf(chunkSize int64) *Builder { … } // TransformRequests alters API calls made by clients requested from this builder. Pass // an empty list to clear modifiers. func (b *Builder) TransformRequests(opts ...RequestTransform) *Builder { … } // Subresource instructs the builder to retrieve the object at the // subresource path instead of the main resource path. func (b *Builder) Subresource(subresource string) *Builder { … } // SelectEverythingParam func (b *Builder) SelectAllParam(selectAll bool) *Builder { … } // ResourceTypeOrNameArgs indicates that the builder should accept arguments // of the form `(<type1>[,<type2>,...]|<type> <name1>[,<name2>,...])`. When one argument is // received, the types provided will be retrieved from the server (and be comma delimited). // When two or more arguments are received, they must be a single type and resource name(s). // The allowEmptySelector permits to select all the resources (via Everything func). func (b *Builder) ResourceTypeOrNameArgs(allowEmptySelector bool, args ...string) *Builder { … } // ReplaceAliases accepts an argument and tries to expand any existing // aliases found in it func (b *Builder) ReplaceAliases(input string) string { … } func hasCombinedTypeArgs(args []string) (bool, error) { … } // Normalize args convert multiple resources to resource tuples, a,b,c d // as a transform to a/d b/d c/d func normalizeMultipleResourcesArgs(args []string) []string { … } // splitResourceTypeName handles type/name resource formats and returns a resource tuple // (empty or not), whether it successfully found one, and an error func splitResourceTypeName(s string) (resourceTuple, bool, error) { … } // Flatten will convert any objects with a field named "Items" that is an array of runtime.Object // compatible types into individual entries and give them their own items. The original object // is not passed to any visitors. func (b *Builder) Flatten() *Builder { … } // Latest will fetch the latest copy of any objects loaded from URLs or files from the server. func (b *Builder) Latest() *Builder { … } // RequireObject ensures that resulting infos have an object set. If false, resulting info may not have an object set. func (b *Builder) RequireObject(require bool) *Builder { … } // ContinueOnError will attempt to load and visit as many objects as possible, even if some visits // return errors or some objects cannot be loaded. The default behavior is to terminate after // the first error is returned from a VisitorFunc. func (b *Builder) ContinueOnError() *Builder { … } // SingleResourceType will cause the builder to error if the user specifies more than a single type // of resource. func (b *Builder) SingleResourceType() *Builder { … } // mappingFor returns the RESTMapping for the Kind given, or the Kind referenced by the resource. // Prefers a fully specified GroupVersionResource match. If one is not found, we match on a fully // specified GroupVersionKind, or fallback to a match on GroupKind. func (b *Builder) mappingFor(resourceOrKindArg string) (*meta.RESTMapping, error) { … } func (b *Builder) resourceMappings() ([]*meta.RESTMapping, error) { … } func (b *Builder) resourceTupleMappings() (map[string]*meta.RESTMapping, error) { … } func (b *Builder) visitorResult() *Result { … } func (b *Builder) visitBySelector() *Result { … } func (b *Builder) getClient(gv schema.GroupVersion) (RESTClient, error) { … } func (b *Builder) visitByResource() *Result { … } func (b *Builder) visitByName() *Result { … } func (b *Builder) visitByPaths() *Result { … } // Do returns a Result object with a Visitor for the resources identified by the Builder. // The visitor will respect the error behavior specified by ContinueOnError. Note that stream // inputs are consumed by the first execution - use Infos() or Object() on the Result to capture a list // for further iteration. func (b *Builder) Do() *Result { … } // SplitResourceArgument splits the argument with commas and returns unique // strings in the original order. func SplitResourceArgument(arg string) []string { … } // HasNames returns true if the provided args contain resource names func HasNames(args []string) (bool, error) { … } // expandIfFilePattern returns all the filenames that match the input pattern // or the filename if it is a specific filename and not a pattern. // If the input is a pattern and it yields no result it will result in an error. func expandIfFilePattern(pattern string) ([]string, error) { … } type cachingCategoryExpanderFunc … func (c *cachingCategoryExpanderFunc) ToCategoryExpander() (restmapper.CategoryExpander, error) { … }