func (rl *replicaSetList) GetItems() ResourceList {
	r := make([]KubeResourceInterface, 0)
	for i := range rl.Items {
		r = append(r, &rl.Items[i])
	}
	return r
}
GetItems interface method
package kubectl
import (
	"errors"
	"fmt"
	"strings"
)
const (
	KindDeployment = "deployment"
	KindReplicaSet = "replicaset"
	KindNamespace = "namespace"
	KindPod = "pod"
	KindList = "list"
	PodStatusRunning = "Running"
	ClusterContextEnv = "CLUSTER_CONTEXT"
	strategyTypeRollingUpdate = "RollingUpdate"
)
type (
	resourceMetadata struct {
		Name       string            `yaml:"name"`
		Namespace  string            `yaml:"namespace"`
		Labels     map[string]string `yaml:"labels"`
		Generation int               `yaml:"generation"`
		UID        string            `yaml:"uid"`
	}
	resourceStatus struct {
		AvailableReplicas   int    `yaml:"availableReplicas"`    
		ObservedGeneration  int    `yaml:"observedGeneration"`   
		Replicas            int    `yaml:"replicas"`             
		UpdatedReplicas     int    `yaml:"updatedReplicas"`      
		UnavailableReplicas int    `yaml:"unavailableReplicas"`  
		Phase               string `yaml:"phase"`                
	}
	resourceContainer struct {
		Image string `yaml:"image"`  
		Name  string `yaml:"name"`
	}
	resourceContainerSpec struct {
		Containers []resourceContainer `yaml:"containers"`
	}
	resourceMetadataSpec struct {
		Labels map[string]string `yaml:"labels"`
	}
	resourceTemplate struct {
		Metadata resourceMetadataSpec  `yaml:"metadata"`
		Spec     resourceContainerSpec `yaml:"spec"`
	}
	resourceStrategyRolling struct {
		MaxSurge       int `yaml:"maxSurge"`
		MaxUnavailable int `yaml:"maxUnavailable"`
	}
	resourceStrategy struct {
		Type          string                  `yaml:"type"`
		RollingUpdate resourceStrategyRolling `yaml:"rollingUpdate"`
	}
	resourceSpec struct {
		Replicas int              `yaml:"replicas"`
		Template resourceTemplate `yaml:"template"`
		Strategy resourceStrategy `yaml:"strategy"`
	}
	kubeResourceList struct {
		Kind  string         `yaml:"kind"`
		Items []kubeResource `yaml:"items"`
	}
	kubeResource struct {
		Kind     string           `yaml:"kind"`
		Metadata resourceMetadata `yaml:"metadata"`
		Spec     resourceSpec     `yaml:"spec"`
		Status   resourceStatus   `yaml:"status"`
	}
	kubeResourceListInterface interface {
		GetItems() ResourceList
	}
	podList struct {
		Items []Pod `yaml:"items"`
	}
	deploymentList struct {
		Items []Deployment `yaml:"items"`
	}
	replicaSetList struct {
		Items []ReplicaSet `yaml:"items"`
	}
	namespaceList struct {
		Items []Namespace `yaml:"items"`
	}
	KubeResourceInterface interface {
		GetKind() string
		GetName() string
		ToDeployment() (*Deployment, error)
	}
	ResourceList []KubeResourceInterface
	Pod struct {
		Kind     string                `yaml:"kind"`
		Metadata resourceMetadata      `yaml:"metadata"`
		Spec     resourceContainerSpec `yaml:"spec"`
		Status   resourceStatus        `yaml:"status"`
	}
	Deployment struct {
		Kind     string           `yaml:"kind"`
		Metadata resourceMetadata `yaml:"metadata"`
		Spec     resourceSpec     `yaml:"spec"`
		Status   resourceStatus   `yaml:"status"`
	}
	ReplicaSet struct {
		Kind     string           `yaml:"kind"`
		Metadata resourceMetadata `yaml:"metadata"`
		Spec     resourceSpec     `yaml:"spec"`
		Status   resourceStatus   `yaml:"status"`
	}
	Namespace struct {
		Kind     string           `yaml:"kind"`
		Metadata resourceMetadata `yaml:"metadata"`
	}
)
func (rl ResourceList) FilteredByKind(kind string) ResourceList {
	result := make(ResourceList, 0)
	for _, obj := range rl {
		if obj.GetKind() == kind {
			result = append(result, obj)
		}
	}
	return result
}
func (rl ResourceList) ToDeploymentList() []Deployment {
	dlist := make([]Deployment, 0)
	for _, obj := range rl {
		if obj.GetKind() == KindDeployment {
			d, _ := obj.(*Deployment)
			dlist = append(dlist, *d)
		}
	}
	return dlist
}
func (rl ResourceList) ToReplicaSetList() []ReplicaSet {
	rlist := make([]ReplicaSet, 0)
	for _, obj := range rl {
		if obj.GetKind() == KindReplicaSet {
			r, _ := obj.(*ReplicaSet)
			rlist = append(rlist, *r)
		}
	}
	return rlist
}
func (rl ResourceList) ToNamespaceList() []Namespace {
	nlist := make([]Namespace, 0)
	for _, obj := range rl {
		if obj.GetKind() == KindNamespace {
			n, _ := obj.(*Namespace)
			nlist = append(nlist, *n)
		}
	}
	return nlist
}
func (rl ResourceList) ToPodList() []Pod {
	plist := make([]Pod, 0)
	for _, obj := range rl {
		if obj.GetKind() == KindPod {
			p, _ := obj.(*Pod)
			plist = append(plist, *p)
		}
	}
	return plist
}
func (k *kubeResource) GetKind() string {
	return strings.ToLower(k.Kind)
}
func (k *kubeResource) GetName() string {
	return k.Metadata.Name
}
func (k *kubeResource) ToDeployment() (*Deployment, error) {
	return nil, errors.New("kubeResource can't be transformed to deployment")
}
func (d *kubeResourceList) GetKind() string {
	return strings.ToLower(d.Kind)
}
func (d *kubeResourceList) GetItems() ResourceList {
	r := make([]KubeResourceInterface, 0)
	for i := range d.Items {
		r = append(r, &d.Items[i])
	}
	return r
}
func (d *Deployment) GetKind() string {
	return strings.ToLower(d.Kind)
}
func (d *Deployment) GetName() string {
	return d.Metadata.Name
}
func (d *Deployment) GetNamespace() string {
	return formatNamespace(d.Metadata.Namespace)
}
func (d *Deployment) GetUUID() string {
	return d.Metadata.UID
}
func (d *Deployment) GetKey() string {
	return fmt.Sprintf("%s/%s", d.GetNamespace(), d.GetName())
}
func (d *Deployment) GetGeneration() int {
	return d.Metadata.Generation
}
func (d *Deployment) GetSelector() []string {
	selectorList := make([]string, 0)
	for key, value := range d.Metadata.Labels {
		selectorList = append(selectorList, fmt.Sprintf("%s=%s", key, value))
	}
	return selectorList
}
func (d *Deployment) GetPodSelector() []string {
	selectorList := make([]string, 0)
	for key, value := range d.Spec.Template.Metadata.Labels {
		selectorList = append(selectorList, fmt.Sprintf("%s=%s", key, value))
	}
	return selectorList
}
func (d *Deployment) ToDeployment() (*Deployment, error) {
	return d, nil
}
func (d *Deployment) IsReady() bool {
	isReady := d.Status.ObservedGeneration >= d.Metadata.Generation
	isReady = isReady && (d.Status.UpdatedReplicas >= d.Spec.Replicas)
	isReady = isReady && (d.Status.UnavailableReplicas == 0)
	if (d.Spec.Replicas != 0) && (d.Spec.Strategy.Type == strategyTypeRollingUpdate) {
		replicaMinRequired := d.Spec.Replicas - d.Spec.Strategy.RollingUpdate.MaxUnavailable
		isReady = isReady && (d.Status.AvailableReplicas >= replicaMinRequired)
	}
	return isReady
}
func (d *Deployment) GetStatusString() string {
	return fmt.Sprintf(
		"Ready: %v, Generation: meta=%d observed=%d, Replicas: s=%d, u=%d, a=%d, na=%d",
		d.IsReady(),
		d.Metadata.Generation,
		d.Status.ObservedGeneration,
		d.Spec.Replicas,
		d.Status.UpdatedReplicas,
		d.Status.AvailableReplicas,
		d.Status.UnavailableReplicas,
	)
}
func (dl *deploymentList) GetItems() ResourceList {
	r := make([]KubeResourceInterface, 0)
	for i := range dl.Items {
		r = append(r, &dl.Items[i])
	}
	return r
}
func (r *ReplicaSet) GetKind() string {
	return strings.ToLower(r.Kind)
}
func (r *ReplicaSet) GetName() string {
	return r.Metadata.Name
}
func (r *ReplicaSet) GetImages() []string {
	items := make([]string, 0)
	for _, c := range r.Spec.Template.Spec.Containers {
		items = append(items, c.Image)
	}
	return items
}
func (r *ReplicaSet) ToDeployment() (*Deployment, error) {
	return nil, errors.New("ReplicaSet can't be transformed to deployment")
}