MCPcopy
hub / github.com/redspread/spread / Get

Method Get

pkg/deploy/cluster.go:185–205  ·  view source on GitHub ↗

Get retrieves an objects from a cluster using it's namespace name and API version.

(kind, namespace, name string, export bool)

Source from the content-addressed store, hash-verified

183
184// Get retrieves an objects from a cluster using it's namespace name and API version.
185func (c *KubeCluster) Get(kind, namespace, name string, export bool) (KubeObject, error) {
186 kind = KubeShortForm(kind)
187
188 req := c.Client.Get().Resource(kind).Namespace(namespace).Name(name)
189
190 if export {
191 req.Param("export", "true")
192 }
193
194 runObj, err := req.Do().Get()
195 if err != nil {
196 return nil, fmt.Errorf("Failed to retrieve resource '%s/%s (namespace=%s)' from Kube API server: %v", kind, name, namespace, err)
197 }
198
199 kubeObj, err := AsKubeObject(runObj)
200 if err != nil {
201 return nil, fmt.Errorf("Unable to change into KubeObject: %v", err)
202 }
203
204 return kubeObj, nil
205}
206
207// get retrieves the object from the cluster.
208func (c *KubeCluster) get(namespace, name string, export bool, mapping *meta.RESTMapping) (KubeObject, error) {

Callers 14

updateMethod · 0.45
getMethod · 0.45
createMethod · 0.45
DeploymentMethod · 0.45
printLoadBalancersFunction · 0.45
fetchFunction · 0.45
ParamMethod · 0.45
PullMethod · 0.45
BuildMethod · 0.45
LinkMethod · 0.45
ShowMethod · 0.45
AddMethod · 0.45

Calls 4

KubeShortFormFunction · 0.85
AsKubeObjectFunction · 0.85
NameMethod · 0.80
ParamMethod · 0.80

Tested by

no test coverage detected