{"modulePath":"github.com/cloudnative-pg/barman-cloud","version":"v0.7.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package command\n\nPackage command contains the utilities to interact with barman-cloud.\n\nThis package is able to download the backup catalog, given an object store, and to find the required backup to recreate a cluster, given a certain point in time. It can also delete backups according to barman object store configuration and retention policies, and find the latest successful backup. This is useful to recovery from the last consistent state. We detect the possible commands to be executed, fulfilling the barman capabilities, and define an interface for building commands.\n\nA backup catalog is represented by the Catalog structure, and can be created using the NewCatalog function or by downloading it from an object store via GetBackupList. A backup catalog is just a sorted list of BackupInfo objects.\n\nWe also have features to gather all the environment variables required for the barman-cloud utilities to work correctly.\n\nThe functions which call the barman-cloud utilities (such as GetBackupList) require the environment variables to be passed, and the calling code is supposed gather them (i.e. via the EnvSetCloudCredentials) before calling them. A Kubernetes client is required to get the environment variables, as we need to download the content from the required secrets, but is not required to call barman-cloud.\n\nPackage command contains\n\n## Functions\n\n```go\nfunc AppendCloudProviderOptionsFromBackup(\n\tctx context.Context,\n\toptions []string,\n\tcredentials barmanApi.BarmanCredentials,\n) ([]string, error)\n```\nAppendCloudProviderOptionsFromBackup takes an options array and adds the cloud provider specified in the Backup object\n\n```go\nfunc AppendCloudProviderOptionsFromConfiguration(\n\tctx context.Context,\n\toptions []string,\n\tbarmanConfiguration *barmanApi.BarmanObjectStoreConfiguration,\n) ([]string, error)\n```\nAppendCloudProviderOptionsFromConfiguration takes an options array and adds the cloud provider specified in the Barman configuration object\n\n```go\nfunc CloudWalRestoreOptions(\n\tctx context.Context,\n\tconfiguration *barmanApi.BarmanObjectStoreConfiguration,\n\tclusterName string,\n) ([]string, error)\n```\nCloudWalRestoreOptions returns the options needed to execute the barman command successfully\n\n```go\nfunc ContextWithDefaultAzureCredentials(ctx context.Context, enabled bool) context.Context\n```\nContextWithDefaultAzureCredentials creates a context that contains the contextKeyUseDefaultAzureCredentials flag. When set to true barman-cloud will use the default Azure credentials.\n\nDeprecated: Use AzureCredentials.UseDefaultAzureCredentials instead.\n\n```go\nfunc DeleteBackupsByPolicy(\n\tctx context.Context,\n\tbarmanConfiguration *barmanApi.BarmanObjectStoreConfiguration,\n\tserverName string,\n\tenv []string,\n\tretentionPolicy string,\n) error\n```\nDeleteBackupsByPolicy executes a command that deletes backups, given the Barman object store configuration, the retention policies, the server name and the environment variables\n\n```go\nfunc GetBackupByName(\n\tctx context.Context,\n\tbackupName string,\n\tserverName string,\n\tbarmanConfiguration *barmanApi.BarmanObjectStoreConfiguration,\n\tenv []string,\n) (*catalog.BarmanBackup, error)\n```\nGetBackupByName returns the backup data found for a given backup\n\n```go\nfunc GetBackupList(\n\tctx context.Context,\n\tbarmanConfiguration *barmanApi.BarmanObjectStoreConfiguration,\n\tserverName string,\n\tenv []string,\n) (*catalog.Catalog, error)\n```\nGetBackupList returns the catalog reading it from the object store\n\n```go\nfunc GetLatestBackup(\n\tctx context.Context,\n\tserverName string,\n\tbarmanConfiguration *barmanApi.BarmanObjectStoreConfiguration,\n\tenv []string,\n) (*catalog.BarmanBackup, error)\n```\nGetLatestBackup returns the latest executed backup\n\n```go\nfunc UnmarshalBarmanCloudRestoreExitCode(exitCode int) error\n```\nUnmarshalBarmanCloudRestoreExitCode returns the correct error for a certain barman-cloud-restore exit code\n\n## Types\n\n```go\ntype CloudRestoreError struct {\n\t// The exit code returned by Barman\n\tExitCode int\n}\n```\nCloudRestoreError is raised when barman-cloud-restore fails\n\n```go\nfunc (err *CloudRestoreError) Error() string\n```\nError implements the error interface\n\n```go\nfunc (err *CloudRestoreError) IsRetriable() bool\n```\nIsRetriable returns true whether the error is temporary, and it could be a good idea to retry the restore later\n\n","path":"github.com/cloudnative-pg/barman-cloud/pkg/command","name":"command","synopsis":"Package command contains the utilities to interact with barman-cloud.","isRedistributable":true}
