MCPcopy Index your code
hub / github.com/FairwindsOps/pluto / IsVersioned

Method IsVersioned

pkg/api/versions.go:103–125  ·  view source on GitHub ↗

IsVersioned returns a version if the file data sent can be unmarshaled into a stub and matches a known version in the VersionList

(data []byte)

Source from the content-addressed store, hash-verified

101// can be unmarshaled into a stub and matches a known
102// version in the VersionList
103func (instance *Instance) IsVersioned(data []byte) ([]*Output, error) {
104 var outputs []*Output
105 stubs, err := containsStub(data)
106 if err != nil {
107 return nil, err
108 }
109 if len(stubs) > 0 {
110 for _, stub := range stubs {
111 var output Output
112 version := instance.checkVersion(stub)
113 if version != nil {
114 output.Name = stub.Metadata.Name
115 output.Namespace = stub.Metadata.Namespace
116 output.APIVersion = version
117 } else {
118 continue
119 }
120 outputs = append(outputs, &output)
121 }
122 return outputs, nil
123 }
124 return nil, nil
125}
126
127// containsStub checks to see if a []byte has a stub in it
128func containsStub(data []byte) ([]*Stub, error) {

Callers 5

checkForAPIVersionMethod · 0.80
Test_IsVersionedFunction · 0.80
GetApiResourcesMethod · 0.80
CheckForAPIVersionMethod · 0.80
root.goFile · 0.80

Calls 2

checkVersionMethod · 0.95
containsStubFunction · 0.85

Tested by 1

Test_IsVersionedFunction · 0.64