// GetReplicaSetPodsEvents gets events associated to pods in replica set.
func GetReplicaSetPodsEvents(client client.Interface, namespace, replicaSetName string) (
	[]api.Event, error) {

	replicaSet, err := client.Extensions().ReplicaSets(namespace).Get(replicaSetName)

	if err != nil {
		return nil, err
	}

	podEvents, err := event.GetPodsEvents(client, namespace, replicaSet.Spec.Selector.MatchLabels)

	if err != nil {
		return nil, err
	}

	return podEvents, nil
}
// GetJobPodsEvents gets events associated to pods in job.
func GetJobPodsEvents(client client.Interface, namespace, jobName string) (
	[]api.Event, error) {

	job, err := client.Extensions().Jobs(namespace).Get(jobName)

	if err != nil {
		return nil, err
	}

	podEvents, err := event.GetPodsEvents(client, namespace, job.Spec.Selector.MatchLabels)

	if err != nil {
		return nil, err
	}

	return podEvents, nil
}
// GetPetSetPodsEvents gets events associated to pods in pet set.
func GetPetSetPodsEvents(client *client.Client, namespace, petSetName string) (
	[]api.Event, error) {

	petSet, err := client.Apps().PetSets(namespace).Get(petSetName)

	if err != nil {
		return nil, err
	}

	podEvents, err := event.GetPodsEvents(client, namespace, petSet.Spec.Selector.MatchLabels)

	if err != nil {
		return nil, err
	}

	return podEvents, nil
}
func GetReplicationControllerPodsEvents(client client.Interface, namespace,
	replicationControllerName string) ([]api.Event, error) {

	replicationController, err := client.ReplicationControllers(namespace).Get(replicationControllerName)

	if err != nil {
		return nil, err
	}

	podEvents, err := resourceEvent.GetPodsEvents(client, namespace,
		replicationController.Spec.Selector)

	if err != nil {
		return nil, err
	}

	return podEvents, nil
}