github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/worker/uniter/secrets/interface.go (about)

     1  // Copyright 2022 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package secrets
     5  
     6  import (
     7  	"github.com/juju/juju/worker/uniter/hook"
     8  )
     9  
    10  // SecretStateTracker provides access to the unit agent's
    11  // state for secrets.
    12  type SecretStateTracker interface {
    13  	// PrepareHook returns an error if the hook is unknown
    14  	// or invalid given current state.
    15  	PrepareHook(hook.Info) error
    16  
    17  	// CommitHook persists the state change encoded in the supplied secret
    18  	// hook, or returns an error if the hook is unknown or invalid given
    19  	// current secret state.
    20  	CommitHook(info hook.Info) error
    21  
    22  	// ConsumedSecretRevision returns the revision that
    23  	// is currently tracked for the given secret.
    24  	ConsumedSecretRevision(uri string) int
    25  
    26  	// SecretObsoleteRevisions returns the obsolete
    27  	// revisions that have been reported already for
    28  	// the given secret.
    29  	SecretObsoleteRevisions(uri string) []int
    30  
    31  	// SecretsRemoved updates the unit secrets state
    32  	// when secrets are removed.
    33  	SecretsRemoved(uris []string) error
    34  
    35  	// Report provides information for the engine report.
    36  	Report() map[string]interface{}
    37  }
    38  
    39  // Logger represents the logging methods used in this package.
    40  type Logger interface {
    41  	Warningf(string, ...interface{})
    42  	Debugf(string, ...interface{})
    43  }