get.porter.sh/porter@v1.3.0/pkg/storage/installation_provider.go (about)

     1  package storage
     2  
     3  import (
     4  	"context"
     5  )
     6  
     7  // InstallationProvider is an interface for interacting with Porter's claim data.
     8  type InstallationProvider interface {
     9  	// InsertInstallation saves a new Installation document.
    10  	InsertInstallation(ctx context.Context, installation Installation) error
    11  
    12  	// InsertRun saves a new Run document.
    13  	InsertRun(ctx context.Context, run Run) error
    14  
    15  	// InsertResult saves a new Result document.
    16  	InsertResult(ctx context.Context, result Result) error
    17  
    18  	// InsertOutput saves a new Output document.
    19  	InsertOutput(ctx context.Context, output Output) error
    20  
    21  	// UpdateInstallation saves changes to an existing Installation document.
    22  	UpdateInstallation(ctx context.Context, installation Installation) error
    23  
    24  	// UpsertRun saves changes a Run document, creating it if it doesn't already exist.
    25  	UpsertRun(ctx context.Context, run Run) error
    26  
    27  	// UpsertInstallation saves an Installation document, creating it if it doesn't already exist.
    28  	UpsertInstallation(ctx context.Context, installation Installation) error
    29  
    30  	// FindInstallations applies the find operation against installations collection
    31  	// using the specified options.
    32  	FindInstallations(ctx context.Context, opts FindOptions) ([]Installation, error)
    33  
    34  	// GetInstallation retrieves an Installation document by name.
    35  	GetInstallation(ctx context.Context, namespace string, name string) (Installation, error)
    36  
    37  	// ListInstallations returns Installations sorted in ascending order by the namespace and then name.
    38  	ListInstallations(ctx context.Context, listOption ListOptions) ([]Installation, error)
    39  
    40  	// ListRuns returns Run documents sorted in ascending order by ID.
    41  	ListRuns(ctx context.Context, namespace string, installation string) ([]Run, map[string][]Result, error)
    42  
    43  	// ListResults returns Result documents sorted in ascending order by ID.
    44  	ListResults(ctx context.Context, runID string) ([]Result, error)
    45  
    46  	// ListOutputs returns Output documents sorted in ascending order by name.
    47  	ListOutputs(ctx context.Context, resultID string) ([]Output, error)
    48  
    49  	// GetRun returns a Run document by ID.
    50  	GetRun(ctx context.Context, id string) (Run, error)
    51  
    52  	// GetResult returns a Result document by ID.
    53  	GetResult(ctx context.Context, id string) (Result, error)
    54  
    55  	// GetLastRun returns the last run of an Installation.
    56  	GetLastRun(ctx context.Context, namespace string, installation string) (Run, error)
    57  
    58  	// GetLastOutput returns the most recent value (last) of the specified
    59  	// Output associated with the installation.
    60  	GetLastOutput(ctx context.Context, namespace string, installation string, name string) (Output, error)
    61  
    62  	// GetLastOutputs returns the most recent (last) value of each Output
    63  	// associated with the installation.
    64  	GetLastOutputs(ctx context.Context, namespace string, installation string) (Outputs, error)
    65  
    66  	// RemoveInstallation by its name.
    67  	RemoveInstallation(ctx context.Context, namespace string, name string) error
    68  
    69  	// GetLogs returns the logs from the specified Run.
    70  	GetLogs(ctx context.Context, runID string) (logs string, hasLogs bool, err error)
    71  
    72  	// GetLastLogs returns the logs from the last run of an Installation.
    73  	GetLastLogs(ctx context.Context, namespace string, installation string) (logs string, hasLogs bool, err error)
    74  }