Backupify
Explore the following sections to learn more:
backupify
import "github.com/gemini-oss/rego/pkg/backupify"
pkg/backupify/activities.go
pkg/backupify/backupify.go
pkg/backupify/entities.go
pkg/backupify/exports.go
pkg/backupify/snapshots.go
pkg/backupify/users.go
Index
- type Activities
- type ActivitiesPayload
- type ActivitiesResponse
- type ActivityClient
- type ActivityDetail
- type AppType
- type Client
- func NewClient(verbosity int, opts …ClientOption) *Client
- func (c *Client) Activities() *ActivityClient
- func (c *Client) BuildURL(endpoint string, identifiers …interface{}) string
- func (c *Client) CheckExportFilters(activities *Activities)
- func (c *Client) Exports() *ExportClient
- func (c *Client) GetCache(key string, target interface{}) bool
- func (c *Client) SetCache(key string, value interface{}, duration time.Duration)
- func (c *Client) Snapshots() *SnapshotClient
- func (c *Client) UseCache() *Client
- func (c *Client) Users() *UserClient
- type ClientOption
- type Column
- type DeletePayload
- type Description
- type Export
- type ExportClient
- func (c *ExportClient) DeleteExport(activity *Item, export *Export) error
- func (c *ExportClient) DownloadAvailableExports(activities *Activities) [][]string
- func (c *ExportClient) DownloadExport(activity *Item, export *Export) ([]string, error)
- func (c *ExportClient) ExportUser(user *User) (*Exports, error)
- func (c *ExportClient) ExportUsers(users *Users) ([]Exports, error)
- type ExportPayload
- type ExportQuery
- type Exports
- type Filters
- type Item
- type Order
- type ResponseData
- type Run
- type Search
- type Service
- type Snapshot
- type SnapshotClient
- type Snapshots
- type SnapshotsPayload
- type Stats
- type User
- type UserClient
- type UserCounts
- type UserPayload
- type Users
type Activities
type Activities struct {
Export ActivityDetail `json:"export,omitempty"` // Details of export activities
Restore ActivityDetail `json:"restore,omitempty"` // Details of restore activities
Backups ActivityDetail `json:"backups,omitempty"` // Details of backup activities
}
type ActivitiesPayload
type ActivitiesPayload struct {
AppType AppType `json:"appType"` // Type of Backupify application. e.g., "GoogleDrive", "GoogleTeamDrives", etc.
}
type ActivitiesResponse
### Backupify Activity Structs ---------------------------------------------------------------------
type ActivitiesResponse struct {
Activities Activities `json:"activities,omitempty"` // Activities {Exports, Restores, Backups}
}
type ActivityClient
ActivityClient for chaining methods
type ActivityClient struct {
*Client
}
func (*ActivityClient) GetActivities
func (c *ActivityClient) GetActivities() (*Activities, error)
type ActivityDetail
type ActivityDetail struct {
HasActive bool `json:"hasActive,omitempty"` // Indicates if there is an active status
Items []*Item `json:"items,omitempty"` // List of individual items in the activity
}
func (*ActivityDetail) Map
func (ad *ActivityDetail) Map() map[int64]*Item
type AppType
type AppType string // AppType is the type of Backupify application.
var (
GoogleDrive AppType = "GoogleDrive"
SharedDrive AppType = "GoogleTeamDrives"
GoogleMail AppType = "GoogleMail"
)
type Client
### Backupify Client Structs ---------------------------------------------------------------------
type Client struct {
BaseURL string // BaseURL is the base URL for Backupify requests.
HTTP *requests.Client // HTTPClient is the client used to make HTTP requests.
Error string // Error is the error message returned from the Backupify WebUI.
Log *log.Logger // Log is the logger used to log messages.
Cache *cache.Cache // Cache is the cache used to store responses from the Backupify WebUI.
AppType AppType // AppType is the type of Backupify application.
// contains filtered or unexported fields
}
func NewClient
func NewClient(verbosity int, opts ...ClientOption) *Client
- # Generate Backupify Client
- @param logger *log.Logger
- @return *Client
- Example:
```go
b := backupify.NewClient(log.DEBUG)
```
func (*Client) Activities
func (c *Client) Activities() *ActivityClient
Entry point for activity-related operations
func (*Client) BuildURL
func (c *Client) BuildURL(endpoint string, identifiers ...interface{}) string
BuildURL builds a URL for a given resource and identifiers.
func (*Client) CheckExportFilters
func (c *Client) CheckExportFilters(activities *Activities)
func (*Client) Exports
func (c *Client) Exports() *ExportClient
Entry point for export-related operations
func (*Client) GetCache
func (c *Client) GetCache(key string, target interface{}) bool
* GetCache retrieves an Backupify response from the cache
func (*Client) SetCache
func (c *Client) SetCache(key string, value interface{}, duration time.Duration)
* SetCache stores an Backupify response in the cache
func (*Client) Snapshots
func (c *Client) Snapshots() *SnapshotClient
Entry point for export-related operations
func (*Client) UseCache
func (c *Client) UseCache() *Client
UseCache() enables caching for the next method call.
func (*Client) Users
func (c *Client) Users() *UserClient
Entry point for export-related operations
type ClientOption
type ClientOption func(*Client)
type Column
type Column struct {
Data string `json:"data"` // Data field
Name string `json:"name"` // Name of the column
Searchable bool `json:"searchable"` // Searchable flag
Orderable bool `json:"orderable"` // Orderable flag
Search Search `json:"search"` // Search criteria
}
type DeletePayload
type DeletePayload struct {
Type string `json:"type"` // Type of deletion
AppType AppType `json:"appType"` // Type of Backupify application
ID int `json:"id"` // Identity to target. e.g. [snapshotID]
}
type Description
type Description struct {
Filters interface{} `json:"filters,omitempty"` // Filters applied during the run, can be null
IncludePermissions bool `json:"includePermissions,omitempty"` // Indicates if permissions were included
ItemCount int `json:"itemCount,omitempty"` // Number of items considered
Query string `json:"query,omitempty"` // Query terms used
RecoveredBy string `json:"recoveredBy,omitempty"` // Who recovered the run
Services []*Service `json:"services,omitempty"` // Services involved in the run
Snapshot int64 `json:"snapshot,omitempty"` // Snapshot ID
TargetService *Service `json:"targetService,omitempty"` // Target service for the run, can be null
Type string `json:"type,omitempty"` // Type of the description, e.g., full or selected
}
type Export
type Export struct {
ResponseData ResponseData `json:"responseData,omitempty"` // Container for the response data
Status string `json:"state,omitempty"` // Current status of the export
SnapshotDate string `json:"snapshotDate,omitempty"` // Date and time of the snapshot
}
type ExportClient
ExportClient for chaining methods
type ExportClient struct {
*Client
}
func (*ExportClient) DeleteExport
func (c *ExportClient) DeleteExport(activity *Item, export *Export) error
func (*ExportClient) DownloadAvailableExports
func (c *ExportClient) DownloadAvailableExports(activities *Activities) [][]string
func (*ExportClient) DownloadExport
func (c *ExportClient) DownloadExport(activity *Item, export *Export) ([]string, error)
func (*ExportClient) ExportUser
func (c *ExportClient) ExportUser(user *User) (*Exports, error)
func (*ExportClient) ExportUsers
func (c *ExportClient) ExportUsers(users *Users) ([]Exports, error)
type ExportPayload
type ExportPayload struct {
ActionType string `json:"actionType"` // Type of action, e.g., "export"
AppType AppType `json:"appType"` // Type of application, e.g., "GoogleDrive"
SnapshotID string `json:"snapshotId"` // ID of the snapshot
Token string `json:"token"` // Placeholder for a variable
IncludePermissions bool `json:"includePermissions"` // Include permissions associated with the files being exported
IncludeAttachments bool `json:"includeAttachments"` // Include attachments
Services []interface{} `json:"services"` // Identity to target. e.g. [userID]
}
type ExportQuery
type ExportQuery struct {
Type string `json:"type"` // Type of query. e.g. 'export'
AppType string `json:"appType"` // Type of application. e.g. 'GoogleDrive'
ID int `json:"id"` // ID of the export
EXT string `json:"ext"` // Extension of the file. e.g. 'zip'
}
type Exports
### Backupify Export Structs ---------------------------------------------------------------------
type Exports []*Export
type Filters
type Filters struct {
IsDeleted string `json:"isDeleted,omitempty"` // Whether deleted items were included
}
type Item
type Item struct {
BytesWritten string `json:"bytesWritten,omitempty"` // The amount of data written, can be in various units
DetailsPath *string `json:"detailsPath,omitempty"` // Path to further details, can be null
Destination string `json:"destination,omitempty"` // Destination of the data
Export Export `json:"export,omitempty"` // Export details
Items string `json:"items,omitempty"` // Summary of items processed, in the format "processed / total"
RecoveredBy string `json:"recoveredBy,omitempty"` // Who recovered the item
Reason string `json:"reason,omitempty"` // Reason for the current status (typically for failed or cancelled tasks)
Run Run `json:"run,omitempty"` // Running details
RunMode string `json:"runMode,omitempty"` // Mode of the run
Source string `json:"source,omitempty"` // Source of the data
Stats Stats `json:"stats,omitempty"` // Statistical data
Status string `json:"status,omitempty"` // Current status of the item
Timestamp int64 `json:"timestamp,omitempty"` // Timestamp of the item creation or modification
Timetaken string `json:"timetaken,omitempty"` // Time taken for the operation
Type string `json:"type,omitempty"` // Type of the item
}
type Order
type Order struct {
Column string `json:"column"` // Column index
Dir string `json:"dir"` // Direction
}
type ResponseData
type ResponseData struct {
Action string `json:"action,omitempty"` // Action taken, e.g., "Export"
AppType string `json:"appType,omitempty"` // Type of application involved, e.g., "GoogleDrive"
CustomerId int `json:"customerId,omitempty"` // Numeric ID of the customer
ID int `json:"id,omitempty"` // Numeric ID associated with the responseData
Status string `json:"status,omitempty"` // Current status, e.g., "started"
}
type Run
type Run struct {
ActionType string `json:"actionType,omitempty"` // Type of action, e.g., Export or Restore
AppType string `json:"appType,omitempty"` // Application type involved
CompletedAt int64 `json:"completedAt,omitempty"` // Completion timestamp
CreatedAt int64 `json:"createdAt,omitempty"` // Creation timestamp
CustomerId int `json:"customerId,omitempty"` // ID of the customer
Description Description `json:"description,omitempty"` // Description of the run
ID int `json:"id,omitempty"` // ID of the run
TimeTakenMilliseconds int `json:"timeTakenMilliseconds,omitempty"` // Time taken in milliseconds
}
type Search
type Search struct {
Value string `json:"value"` // Search value
Regex bool `json:"regex"` // Regex flag
}
type Service
type Service struct {
ServiceEmail string `json:"serviceEmail,omitempty"` // Email associated with the service
ServiceId int `json:"serviceId,omitempty"` // ID of the service
ServiceName string `json:"serviceName,omitempty"` // Name of the service
}
type Snapshot
type Snapshot struct {
ID int64 `json:"snapshotId,omitempty"` // ID of the snapshot
Date string `json:"formattedForButton,omitempty"` // Text formatted for display on a button.
}
type SnapshotClient
SnapshotClient for chaining methods
type SnapshotClient struct {
*Client
}
func (*SnapshotClient) GetSnapshotDates
func (c *SnapshotClient) GetSnapshotDates(user *User) (*Snapshots, error)
type Snapshots
type Snapshots map[string][]Snapshot // Map of snapshot dates
type SnapshotsPayload
type SnapshotsPayload struct {
AppType AppType `json:"appType"` // Type of Backupify application
ServiceID int `json:"serviceId"` // Identity to target. e.g. [userID]
}
type Stats
type Stats struct {
BytesWritten int `json:"BytesWritten,omitempty"` // Number of bytes written
FailureCount int `json:"FailureCount,omitempty"` // Count of failed operations
SkippedCount int `json:"SkippedCount,omitempty"` // Count of skipped operations
SuccessCount int `json:"SuccessCount,omitempty"` // Count of successful operations
TotalCount int `json:"TotalCount,omitempty"` // Total number of operations
}
type User
type User struct {
AppType string `json:"appType,omitempty"` // Type of the application
CreatedAt int64 `json:"createdAt,omitempty"` // Creation timestamp
CustomerId int `json:"customerId,omitempty"` // ID of the customer
Deleted bool `json:"deleted,omitempty"` // Deletion flag
Email string `json:"email,omitempty"` // Email address
ID int `json:"id,omitempty"` // Unique identifier
LatestSnap interface{} `json:"latestSnap,omitempty"` // Latest snapshot ID
LocalSize int64 `json:"localSize,omitempty"` // Local size
Name string `json:"name,omitempty"` // Name of the item
OwnSize int64 `json:"ownSize,omitempty"` // Owned size
Path string `json:"path,omitempty"` // File path
PerfectBackups []Snapshot `json:"perfectBackups,omitempty"` // List of perfect backups
ReferencedSize int `json:"referencedSize,omitempty"` // Referenced size
Snapshots []Snapshot `json:"snapshots,omitempty"` // List of snapshots
SnapshotDates *Snapshots `json:"snapshotDates,omitempty"` // Map of snapshot dates
Status string `json:"status,omitempty"` // Status of the item
StorageFormat string `json:"storageFormat,omitempty"` // Storage format
UpdatedAt int64 `json:"updatedAt,omitempty"` // Update timestamp
UsedBytes string `json:"usedBytes,omitempty"` // Used bytes in string format
UsedBytesFloat float64 `json:"usedBytesFloat,omitempty"` // Used bytes in float format
}
type UserClient
UserClient for chaining methods
type UserClient struct {
*Client
}
func (*UserClient) GetAllUsers
func (c *UserClient) GetAllUsers() (*Users, error)
GetAllUsers() retrieves all users from Backupify.
func (*UserClient) UserStorageReport
func (c *UserClient) UserStorageReport(users *Users) map[string]UserCounts
Initialize a map to count users and sum storage by the first letter of their email
type UserCounts
type UserCounts struct {
Count int
TotalStorage float64
}
type UserPayload
type UserPayload struct {
Draw string `json:"draw"` // The draw number
Columns []Column `json:"columns"` // List of columns
Order []Order `json:"order"` // List of order items
Start int `json:"start"` // Start index
Length int `json:"length"` // Length of the request
Search Search `json:"search"` // Search criteria
AppType AppType `json:"appType"` // Type of Backupify application
}
type Users
### Backupify User Structs ---------------------------------------------------------------------
type Users struct {
Draw int `json:"draw,omitempty"` // The draw number
Data []*User `json:"data,omitempty"` // List of data items
RecordsTotal int `json:"recordsTotal,omitempty"` // Total number of records
RecordsFiltered int `json:"recordsFiltered,omitempty"` // Number of filtered records
}
func (*Users) Map
func (u *Users) Map() map[string]*User
Generated by gomarkdoc