github.com/Axway/agent-sdk@v1.1.101/pkg/agent/handler/marketplacehandler.go (about)

     1  package handler
     2  
     3  import (
     4  	v1 "github.com/Axway/agent-sdk/pkg/apic/apiserver/models/api/v1"
     5  	prov "github.com/Axway/agent-sdk/pkg/apic/provisioning"
     6  	"github.com/Axway/agent-sdk/pkg/watchmanager/proto"
     7  )
     8  
     9  type marketplaceHandler struct{}
    10  
    11  func (m *marketplaceHandler) shouldProcessPending(status *v1.ResourceStatus, state string) bool {
    12  	return status.Level == prov.Pending.String() && state != v1.ResourceDeleting
    13  }
    14  
    15  func (m *marketplaceHandler) shouldIgnoreSubResourceUpdate(action proto.Event_Type, meta *proto.EventMeta) bool {
    16  	if meta == nil {
    17  		return false
    18  	}
    19  	return action == proto.Event_SUBRESOURCEUPDATED && meta.Subresource != "status"
    20  }
    21  
    22  // shouldProcessDeleting returns true when the resource is in a deleting state and has finalizers
    23  func (m *marketplaceHandler) shouldProcessDeleting(status *v1.ResourceStatus, state string, finalizers []v1.Finalizer) bool {
    24  	return status.Level == prov.Success.String() && state == v1.ResourceDeleting && len(finalizers) > 0
    25  }
    26  
    27  func (m *marketplaceHandler) shouldProcessForTrace(status *v1.ResourceStatus, state string) bool {
    28  	return status.Level == prov.Success.String() && state != v1.ResourceDeleting
    29  }