func (instance *ComponentInstance) UpdateTimes(createdAt time.Time, updatedAt time.Time) {
	if time.Time.IsZero(instance.CreatedAt) || (!time.Time.IsZero(createdAt) && createdAt.Before(instance.CreatedAt)) {
		instance.CreatedAt = createdAt
	}
	if !time.Time.IsZero(updatedAt) && updatedAt.After(instance.UpdatedAt) {
		instance.UpdatedAt = updatedAt
	}
}
UpdateTimes updates component creation and update times
package resolve
import (
	"fmt"
	"strconv"
	"time"
	"github.com/Aptomi/aptomi/pkg/errors"
	"github.com/Aptomi/aptomi/pkg/lang"
	"github.com/Aptomi/aptomi/pkg/runtime"
	"github.com/Aptomi/aptomi/pkg/util"
)
var TypeComponentInstance = &runtime.TypeInfo{
	Kind:        "component-instance",
	Storable:    true,
	Versioned:   false,
	Constructor: func() runtime.Object { return &ComponentInstance{} },
}
type ComponentInstanceMetadata struct {
	Key *ComponentInstanceKey
}
const AllowIngres = "allow_ingress"
type ComponentInstance struct {
	runtime.TypeKind `yaml:",inline"`
	Metadata *ComponentInstanceMetadata
	Error error
	ClaimKeys map[string]int
	IsCode bool
	CalculatedLabels *lang.LabelSet
	CalculatedDiscovery util.NestedParameterMap
	CalculatedCodeParams util.NestedParameterMap
	DataForPlugins map[string]string
	EdgesOut map[string]bool
	CreatedAt time.Time
	UpdatedAt time.Time
	EndpointsUpToDate bool
	Endpoints map[string]string
}
func newComponentInstance(cik *ComponentInstanceKey) *ComponentInstance {
	return &ComponentInstance{
		TypeKind:             TypeComponentInstance.GetTypeKind(),
		Metadata:             &ComponentInstanceMetadata{Key: cik},
		ClaimKeys:            make(map[string]int),
		CalculatedLabels:     lang.NewLabelSet(make(map[string]string)),
		CalculatedDiscovery:  util.NestedParameterMap{},
		CalculatedCodeParams: util.NestedParameterMap{},
		EdgesOut:             make(map[string]bool),
		DataForPlugins:       make(map[string]string),
		Endpoints:            make(map[string]string),
	}
}
func (instance *ComponentInstance) GetKey() string {
	return instance.Metadata.Key.GetKey()
}
func (instance *ComponentInstance) GetDeployName() string {
	return instance.Metadata.Key.GetDeployName()
}
func (instance *ComponentInstance) GetNamespace() string {
	return runtime.SystemNS
}
func (instance *ComponentInstance) GetName() string {
	return instance.GetKey()
}
func (instance *ComponentInstance) GetRunningTime() time.Duration {
	return time.Since(instance.CreatedAt)
}
func (instance *ComponentInstance) addClaim(claimKey string, depth int) {
	instance.ClaimKeys[claimKey] = depth
}
func (instance *ComponentInstance) addRuleInformation(result *lang.RuleActionResult) {
	instance.DataForPlugins[AllowIngres] = strconv.FormatBool(!result.RejectIngress)
}
func (instance *ComponentInstance) addCodeParams(codeParams util.NestedParameterMap) error {
	if len(instance.CalculatedCodeParams) == 0 {
		instance.CalculatedCodeParams = codeParams
	} else if !instance.CalculatedCodeParams.DeepEqual(codeParams) {
		return errors.NewErrorWithDetails(
			fmt.Sprintf("conflicting code parameters for component instance: %s", instance.GetKey()),
			errors.Details{
				"code_params_existing": instance.CalculatedCodeParams,
				"code_params_new":      codeParams,
				"diff":                 instance.CalculatedCodeParams.Diff(codeParams),
			},
		)
	}
	return nil
}
func (instance *ComponentInstance) addDiscoveryParams(discoveryParams util.NestedParameterMap) error {
	if len(instance.CalculatedDiscovery) == 0 {
		instance.CalculatedDiscovery = discoveryParams
	} else if !instance.CalculatedDiscovery.DeepEqual(discoveryParams) {
		return errors.NewErrorWithDetails(
			fmt.Sprintf("conflicting discovery parameters for component instance: %s", instance.GetKey()),
			errors.Details{
				"discovery_params_existing": instance.CalculatedDiscovery,
				"discovery_params_new":      discoveryParams,
				"diff":                      instance.CalculatedDiscovery.Diff(discoveryParams),
			},
		)
	}
	return nil
}
func (instance *ComponentInstance) addLabels(labels *lang.LabelSet) {
	instance.CalculatedLabels.AddLabels(labels.Labels)
}
func (instance *ComponentInstance) addEdgeOut(dstKey string) {
	instance.EdgesOut[dstKey] = true
}