remove mutual exclusivity check - local, unstructured builder attrs

This commit is contained in:
juanvallejo 2017-10-24 14:16:47 -04:00
parent 0736c55776
commit 6144799f75
No known key found for this signature in database
GPG Key ID: 7D2C958002D6448D

View File

@ -68,9 +68,6 @@ type Builder struct {
defaultNamespace bool
requireNamespace bool
isLocal bool
isUnstructured bool
flatten bool
latest bool
@ -86,8 +83,6 @@ type Builder struct {
schema validation.Schema
}
var LocalUnstructuredBuilderError = fmt.Errorf("Unstructured objects cannot be handled with a local builder - Local and Unstructured attributes cannot be used in conjunction")
var missingResourceError = fmt.Errorf(`You must provide one or more resources by argument or filename.
Example resource specifications include:
'-f rsrc.yaml'
@ -169,12 +164,6 @@ func (b *Builder) FilenameParam(enforceNamespace bool, filenameOptions *Filename
// Local wraps the builder's clientMapper in a DisabledClientMapperForMapping
func (b *Builder) Local(mapperFunc ClientMapperFunc) *Builder {
if b.isUnstructured {
b.errs = append(b.errs, LocalUnstructuredBuilderError)
return b
}
b.isLocal = true
b.mapper.ClientMapper = DisabledClientForMapping{ClientMapper: ClientMapperFunc(mapperFunc)}
return b
}
@ -182,12 +171,6 @@ func (b *Builder) Local(mapperFunc ClientMapperFunc) *Builder {
// Unstructured updates the builder's ClientMapper, RESTMapper,
// ObjectTyper, and codec for working with unstructured api objects
func (b *Builder) Unstructured(mapperFunc ClientMapperFunc, mapper meta.RESTMapper, typer runtime.ObjectTyper) *Builder {
if b.isLocal {
b.errs = append(b.errs, LocalUnstructuredBuilderError)
return b
}
b.isUnstructured = true
b.mapper.RESTMapper = mapper
b.mapper.ObjectTyper = typer
b.mapper.Decoder = unstructured.UnstructuredJSONScheme