...

Source file src/edge-infra.dev/pkg/edge/api/services/edgenode/common/interfaces.go

Documentation: edge-infra.dev/pkg/edge/api/services/edgenode/common

     1  package common
     2  
     3  import (
     4  	"context"
     5  
     6  	"edge-infra.dev/pkg/edge/api/graph/model"
     7  	"edge-infra.dev/pkg/lib/crypto"
     8  )
     9  
    10  //go:generate mockgen -destination=../../../mocks/mock_activation_code_service.go -package=mocks edge-infra.dev/pkg/edge/api/services/edgenode/common ActivationCode
    11  type ActivationCode interface {
    12  	// Fetch returns the activation code for the terminal from the database
    13  	Fetch(ctx context.Context, terminalID string) (*string, error)
    14  	// FetchFromSecret returns the activation code for the terminal from the secret value
    15  	FetchFromSecret(ctx context.Context, terminalID string) (string, error)
    16  	// Refresh generates a new activation code for the terminal, then calling Create
    17  	Refresh(ctx context.Context, terminalID string) (string, error)
    18  	// Create stores the activation code in the DB, and calls Sync
    19  	Create(ctx context.Context, activationCode crypto.Credential, terminal *model.Terminal) error
    20  	// SyncToStore creates the Secret on the cluster
    21  	SyncToStore(ctx context.Context, terminalID string, cluster *model.Cluster, activationCode string) error
    22  	// SyncAllToStore re-syncs the activation codes for all terminals in the cluster
    23  	SyncAllToStore(ctx context.Context, clusterEdgeID string) error
    24  	// MarkUsed clears the terminal's activation code in the DB and removes the Secret/ExternalSecret resources
    25  	MarkUsed(ctx context.Context, terminalID string, cluster *model.Cluster, clusterInfra *model.Cluster) error
    26  	// CleanupStore removes the following resources for each activation code of each respective terminal within the cluster:
    27  	// - ExternalSecret/Secret on store
    28  	// - IAMPolicyMember on cluster-infra
    29  	// - SecretManagerSecret
    30  	CleanupStore(ctx context.Context, cluster *model.Cluster) error
    31  	// CleanupTerminal removes the following resources for the activation code of the terminal:
    32  	// - ExternalSecret/Secret on store
    33  	// - IAMPolicyMember on cluster-infra
    34  	// - SecretManagerSecret
    35  	CleanupTerminal(ctx context.Context, terminalID string, clusterEdgeID string) error
    36  }
    37  

View as plain text