Documentation
¶
Index ¶
- type Client
- func (c *Client) Close()
- func (c *Client) CrawlFolder(ctx context.Context, rootFolderID string, skipFolderNames []string, ...) (*CrawlResult, error)
- func (c *Client) DownloadFile(ctx context.Context, fileID string, maxRetries int) (io.ReadCloser, error)
- func (c *Client) GetFilePermissions(ctx context.Context, fileID string, maxRetries int) ([]Permission, []string, error)
- type CrawlRecord
- type CrawlResult
- type FileIDs
- type FolderIDs
- type InaccessibleFile
- type InaccessibleFolder
- type InaccessibleItems
- type InaccessibleShortcutFile
- type InaccessibleShortcutFolder
- type Orchestrator
- type OrchestratorConfig
- type Permission
- type PermissionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps Controller-GoogleClient, Google Drive, LDAP, and cache clients to provide folder crawling and permission resolution functionality.
func NewClient ¶
func NewClient( googleClient google.GoogleClient, globalGoogleClient google.GoogleClient, ldapClient ldap.Client, cacheClient cache.Cache, ) (*Client, error)
NewClient creates a new gdrive Client with the provided dependencies.
func (*Client) Close ¶
func (c *Client) Close()
Close releases resources held by the underlying clients.
func (*Client) CrawlFolder ¶
func (c *Client) CrawlFolder( ctx context.Context, rootFolderID string, skipFolderNames []string, maxRetries int, ) (*CrawlResult, error)
CrawlFolder recursively crawls a root folder and returns all discovered file records and any inaccessible items.
func (*Client) DownloadFile ¶
func (c *Client) DownloadFile( ctx context.Context, fileID string, maxRetries int, ) (io.ReadCloser, error)
DownloadFile downloads the content of a Google Drive file. For Google Workspace files (Docs, Sheets, Slides), it exports to a portable format. The caller must close the returned ReadCloser.
func (*Client) GetFilePermissions ¶
func (c *Client) GetFilePermissions( ctx context.Context, fileID string, maxRetries int, ) ([]Permission, []string, error)
GetFilePermissions retrieves all permissions for a given file ID. It filters out service accounts, expands Google group memberships, and resolves user identities via LDAP when configured. Returns permissions, a list of warning messages (if any), and an error.
type CrawlRecord ¶
type CrawlRecord struct {
FileID string `json:"file_id"`
FileName string `json:"file_name"`
MimeType string `json:"mime_type"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Owner string `json:"owner"`
FileSize int64 `json:"file_size"`
RootFolderID string `json:"root_folder_id"`
ParentFolderID string `json:"parent_folder_id"`
ParentFolderName string `json:"parent_folder_name"`
Status string `json:"status"`
Reason string `json:"reason,omitempty"`
}
CrawlRecord represents one file discovered during folder crawling.
type CrawlResult ¶
type CrawlResult struct {
Records []CrawlRecord
InaccessibleItems InaccessibleItems
// contains filtered or unexported fields
}
CrawlResult holds the output of a folder crawl.
type FileIDs ¶
type FileIDs struct {
FileIDs []string `json:"file_ids"`
}
FileIDs is the input format for file-based permission processing.
type FolderIDs ¶
type FolderIDs struct {
FolderIDs []string `json:"folder_ids"`
}
FolderIDs is the input format for folder-based crawling.
type InaccessibleFile ¶
type InaccessibleFile struct {
FileID string `json:"file_id"`
ParentFolderID string `json:"parent_folder_id"`
RootFolderID string `json:"root_folder_id"`
}
InaccessibleFile represents a file whose metadata could not be fetched.
type InaccessibleFolder ¶
type InaccessibleFolder struct {
FolderID string `json:"folder_id"`
FolderName string `json:"folder_name"`
RootFolderID string `json:"root_folder_id"`
}
InaccessibleFolder represents a folder that could not be listed.
type InaccessibleItems ¶
type InaccessibleItems struct {
Folders []InaccessibleFolder `json:"inaccessible_folders"`
Files []InaccessibleFile `json:"inaccessible_files"`
ShortcutTargetFolders []InaccessibleShortcutFolder `json:"inaccessible_shortcut_target_folders"`
ShortcutTargetFiles []InaccessibleShortcutFile `json:"inaccessible_shortcut_target_files"`
}
InaccessibleItems collects all items that could not be accessed during crawling.
type InaccessibleShortcutFile ¶
type InaccessibleShortcutFile struct {
ShortcutFileID string `json:"shortcut_file_id"`
TargetFileID string `json:"target_file_id"`
RootFolderID string `json:"root_folder_id"`
}
InaccessibleShortcutFile represents a shortcut target file that could not be accessed.
type InaccessibleShortcutFolder ¶
type InaccessibleShortcutFolder struct {
ShortcutFileID string `json:"shortcut_file_id"`
TargetFolderID string `json:"target_folder_id"`
RootFolderID string `json:"root_folder_id"`
}
InaccessibleShortcutFolder represents a shortcut target folder that could not be accessed.
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
Orchestrator coordinates the folder crawling and permission resolution pipeline.
func NewOrchestrator ¶
func NewOrchestrator(cfg OrchestratorConfig) *Orchestrator
NewOrchestrator creates a new Orchestrator instance.
type OrchestratorConfig ¶
type OrchestratorConfig struct {
CredentialsFile string
FileIDsPath string
FolderIDsPath string
OutputDir string
FailedFileIDsName string
Config *config.Config
}
OrchestratorConfig holds the configuration for the orchestrator.
type Permission ¶
type Permission struct {
Type string `json:"type"`
Role string `json:"role"`
UID string `json:"uid"`
Domain string `json:"domain"`
Email string `json:"email,omitempty"`
}
Permission represents a single permission entry on a file.
type PermissionResponse ¶
type PermissionResponse struct {
FileID string `json:"file_id"`
Permissions []Permission `json:"permissions"`
}
PermissionResponse wraps permissions for a single file.