Documentation ¶
Index ¶
- Variables
- func AccountLineItems() *cobra.Command
- func ActionNotificationExportResults() *cobra.Command
- func ActionNotificationExports() *cobra.Command
- func ActionWebhookFailures() *cobra.Command
- func Actions() *cobra.Command
- func ApiKeys() *cobra.Command
- func Apps() *cobra.Command
- func As2IncomingMessages() *cobra.Command
- func As2OutgoingMessages() *cobra.Command
- func As2Partners() *cobra.Command
- func As2Stations() *cobra.Command
- func AutomationRuns() *cobra.Command
- func Automations() *cobra.Command
- func Autos() *cobra.Command
- func BandwidthSnapshots() *cobra.Command
- func Behaviors() *cobra.Command
- func BundleDownloads() *cobra.Command
- func BundleRecipients() *cobra.Command
- func BundleRegistrations() *cobra.Command
- func Bundles() *cobra.Command
- func Clickwraps() *cobra.Command
- func Config() *cobra.Command
- func DnsRecords() *cobra.Command
- func Download() *cobra.Command
- func Errors() *cobra.Command
- func ExternalEvents() *cobra.Command
- func FileActions() *cobra.Command
- func FileCommentReactions() *cobra.Command
- func FileComments() *cobra.Command
- func FileMigrations() *cobra.Command
- func FileUploadParts() *cobra.Command
- func Files() *cobra.Command
- func Folders() *cobra.Command
- func FormFieldSets() *cobra.Command
- func FormFields() *cobra.Command
- func GroupUsers() *cobra.Command
- func Groups() *cobra.Command
- func Histories() *cobra.Command
- func HistoryExportResults() *cobra.Command
- func HistoryExports() *cobra.Command
- func Images() *cobra.Command
- func InboxRecipients() *cobra.Command
- func InboxRegistrations() *cobra.Command
- func InboxUploads() *cobra.Command
- func Init(version string, config *files.Config)
- func InvoiceLineItems() *cobra.Command
- func Invoices() *cobra.Command
- func IpAddresses() *cobra.Command
- func Locks() *cobra.Command
- func LogOut() *cobra.Command
- func Login() *cobra.Command
- func MessageCommentReactions() *cobra.Command
- func MessageComments() *cobra.Command
- func MessageReactions() *cobra.Command
- func Messages() *cobra.Command
- func Notifications() *cobra.Command
- func PaymentLineItems() *cobra.Command
- func Payments() *cobra.Command
- func Permissions() *cobra.Command
- func Previews() *cobra.Command
- func Priorities() *cobra.Command
- func Profile(cmd *cobra.Command) *lib.Profiles
- func Projects() *cobra.Command
- func PublicIpAddresses() *cobra.Command
- func PublicKeys() *cobra.Command
- func RemoteBandwidthSnapshots() *cobra.Command
- func RemoteServers() *cobra.Command
- func Requests() *cobra.Command
- func Sessions() *cobra.Command
- func SettingsChanges() *cobra.Command
- func SftpHostKeys() *cobra.Command
- func Sites() *cobra.Command
- func SsoStrategies() *cobra.Command
- func Statuses() *cobra.Command
- func Styles() *cobra.Command
- func Sync() *cobra.Command
- func Upload() *cobra.Command
- func UsageDailySnapshots() *cobra.Command
- func UsageSnapshots() *cobra.Command
- func UserCipherUses() *cobra.Command
- func UserRequests() *cobra.Command
- func Users() *cobra.Command
- func WebhookTests() *cobra.Command
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ConfigDir string AgentCmd = &cobra.Command{ Use: "agent", Short: "Start Files.com Agent", Long: `To serve the current working directory with auto generated credentials simply use: $ files-cli agent Please take a look at the usage below to customize the serving parameters`, Run: func(cmd *cobra.Command, args []string) { portableDir := directoryToServe fsProvider := sdk.GetProviderByName(portableFsProvider) if !filepath.IsAbs(portableDir) { if fsProvider == sdk.LocalFilesystemProvider { portableDir, _ = filepath.Abs(portableDir) } else { portableDir = os.TempDir() } } permissions := make(map[string][]string) permissions["/"] = portablePermissions portableSFTPPrivateKey := "" if portableSFTPPrivateKeyPath != "" { contents, err := getFileContents(portableSFTPPrivateKeyPath) if err != nil { fmt.Printf("Unable to get SFTP private key: %v\n", err) os.Exit(1) } portableSFTPPrivateKey = contents } if portableFTPDPort >= 0 && portableFTPSCert != "" && portableFTPSKey != "" { keyPairs := []common.TLSKeyPair{ { Cert: portableFTPSCert, Key: portableFTPSKey, ID: common.DefaultTLSKeyPaidID, }, } _, err := common.NewCertManager(keyPairs, filepath.Clean(defaultConfigDir), "FTP portable") if err != nil { fmt.Printf("Unable to load FTPS key pair, cert file %#v key file %#v error: %v\n", portableFTPSCert, portableFTPSKey, err) os.Exit(1) } } service := service.Service{ ConfigDir: filepath.Clean(defaultConfigDir), ConfigFile: defaultConfigFile, LogFilePath: portableLogFile, LogMaxSize: defaultLogMaxSize, LogMaxBackups: defaultLogMaxBackup, LogMaxAge: defaultLogMaxAge, LogCompress: defaultLogCompress, LogVerbose: portableLogVerbose, LogUTCTime: portableLogUTCTime, Shutdown: make(chan bool), PortableMode: 1, PortableUser: dataprovider.User{ BaseUser: sdk.BaseUser{ Username: portableUsername, Password: portablePassword, PublicKeys: portablePublicKeys, Permissions: permissions, HomeDir: portableDir, Status: 1, }, Filters: dataprovider.UserFilters{ BaseUserFilters: sdk.BaseUserFilters{ FilePatterns: parsePatternsFilesFilters(), StartDirectory: portableStartDir, }, }, FsConfig: vfs.Filesystem{ Provider: sdk.GetProviderByName(portableFsProvider), CryptConfig: vfs.CryptFsConfig{ Passphrase: kms.NewPlainSecret(portableCryptPassphrase), }, SFTPConfig: vfs.SFTPFsConfig{ BaseSFTPFsConfig: sdk.BaseSFTPFsConfig{ Endpoint: portableSFTPEndpoint, Username: portableSFTPUsername, Fingerprints: portableSFTPFingerprints, Prefix: portableSFTPPrefix, DisableCouncurrentReads: portableSFTPDisableConcurrentReads, BufferSize: portableSFTPDBufferSize, }, Password: kms.NewPlainSecret(portableSFTPPassword), PrivateKey: kms.NewPlainSecret(portableSFTPPrivateKey), }, }, }, } if err := service.StartPortableMode(portableSFTPDPort, portableFTPDPort, 0, portableSSHCommands, portableAdvertiseService, portableAdvertiseCredentials, "", "", "", ""); err == nil { service.Wait() if service.Error == nil { os.Exit(0) } } os.Exit(1) }, } )
View Source
var ( Version string ProfileValue string Environment string APIKey string OutputPath string RootCmd = &cobra.Command{ Use: "files-cli [resource]", PersistentPreRun: func(cmd *cobra.Command, args []string) { sdkConfig := cmd.Context().Value("config").(*files.Config) if APIKey != "" { sdkConfig.APIKey = APIKey } sdkConfig.Environment = files.NewEnvironment(Environment) debugFlag := cmd.Flag("debug") if debugFlag.Changed { logFile, err := os.Create(debug) if err != nil { fmt.Fprintf(cmd.ErrOrStderr(), "%v\n", err) os.Exit(1) } sdkConfig.SetLogger(log.New(logFile, "", log.LstdFlags)) } profile := &lib.Profiles{} err := profile.Load(sdkConfig, ProfileValue) if err != nil { fmt.Fprintf(cmd.ErrOrStderr(), "%v\n", err) os.Exit(1) } cmd.SetContext(context.WithValue(cmd.Context(), "profile", profile)) if OutputPath != "" { output, err := os.Create(OutputPath) if err != nil { lib.ClientError(cmd.Context(), Profile(cmd), err, cmd.ErrOrStderr()) } cmd.SetOut(output) } if lib.Includes(cmd.Use, []string{"login", "logout"}) { return } if len(cmd.Aliases) != 0 && lib.Includes(cmd.Aliases[0], []string{"config-set", "config-reset", "config-show", "version"}) { return } if !ignoreVersionCheck { Profile(cmd).CheckVersion(Version, lib.FetchLatestVersionNumber(*sdkConfig, cmd.Context()), lib.InstalledViaBrew(), cmd.ErrOrStderr()) } if Profile(cmd).Config.GetAPIKey() != "" { return } if Profile(cmd).ValidSession() { return } profile.Overrides = lib.Overrides{In: cmd.InOrStdin(), Out: cmd.OutOrStdout()} if Profile(cmd).SessionExpired() { fmt.Fprintf(cmd.ErrOrStderr(), "The session has expired, you must log in again.\n") err = lib.CreateSession(files.SessionCreateParams{}, Profile(cmd)) if err != nil { fmt.Fprintf(cmd.ErrOrStderr(), "%v\n", err) os.Exit(1) } return } if Profile(cmd).Config.GetAPIKey() == "" { fmt.Fprintf(cmd.ErrOrStderr(), "No API Key found. Using session login.\n") err = lib.CreateSession(files.SessionCreateParams{}, Profile(cmd)) if err != nil { fmt.Fprintf(cmd.ErrOrStderr(), "%v\n", err) os.Exit(1) } } }, } )
View Source
var (
VersionCmd *cobra.Command
)
Functions ¶
func AccountLineItems ¶
func ActionNotificationExportResults ¶ added in v1.0.843
func ActionNotificationExports ¶ added in v1.0.843
func ActionWebhookFailures ¶ added in v1.0.1483
func As2IncomingMessages ¶ added in v1.3.11
func As2OutgoingMessages ¶ added in v1.3.11
func As2Partners ¶ added in v1.3.11
func As2Stations ¶ added in v1.3.11
func AutomationRuns ¶ added in v1.1.1672
func Automations ¶
func BandwidthSnapshots ¶ added in v1.0.2
func BundleDownloads ¶
func BundleRecipients ¶
func BundleRegistrations ¶ added in v1.0.127
func Clickwraps ¶
func DnsRecords ¶
func ExternalEvents ¶ added in v1.0.18
func FileActions ¶
func FileCommentReactions ¶
func FileComments ¶
func FileMigrations ¶ added in v1.0.1504
func FileUploadParts ¶ added in v1.0.31
func FormFieldSets ¶ added in v1.0.127
func FormFields ¶ added in v1.0.127
func GroupUsers ¶
func HistoryExportResults ¶ added in v1.0.5
func HistoryExports ¶
func InboxRecipients ¶ added in v1.0.150
func InboxRegistrations ¶ added in v1.0.127
func InboxUploads ¶ added in v1.0.127
func InvoiceLineItems ¶
func IpAddresses ¶
func MessageCommentReactions ¶
func MessageComments ¶
func MessageReactions ¶
func Notifications ¶
func PaymentLineItems ¶
func Permissions ¶
func Priorities ¶ added in v1.1.1668
func PublicIpAddresses ¶
func PublicKeys ¶
func RemoteBandwidthSnapshots ¶ added in v1.3.23
func RemoteServers ¶
func SettingsChanges ¶
func SftpHostKeys ¶ added in v1.5.13
func SsoStrategies ¶
func UsageDailySnapshots ¶
func UsageSnapshots ¶
func UserCipherUses ¶
func UserRequests ¶
func WebhookTests ¶ added in v1.0.502
Types ¶
This section is empty.
Source Files ¶
- accountlineitems.go
- actionnotificationexportresults.go
- actionnotificationexports.go
- actions.go
- actionwebhookfailures.go
- agent.go
- apikeys.go
- apps.go
- as2incomingmessages.go
- as2outgoingmessages.go
- as2partners.go
- as2stations.go
- automationruns.go
- automations.go
- autos.go
- bandwidthsnapshots.go
- behaviors.go
- bundledownloads.go
- bundlerecipients.go
- bundleregistrations.go
- bundles.go
- clickwraps.go
- config.go
- dnsrecords.go
- download.go
- errors.go
- externalevents.go
- fileactions.go
- filecommentreactions.go
- filecomments.go
- filemigrations.go
- files.go
- fileuploadparts.go
- folders.go
- formfields.go
- formfieldsets.go
- groups.go
- groupusers.go
- histories.go
- historyexportresults.go
- historyexports.go
- images.go
- inboxrecipients.go
- inboxregistrations.go
- inboxuploads.go
- invoicelineitems.go
- invoices.go
- ipaddresses.go
- locks.go
- login.go
- logout.go
- messagecommentreactions.go
- messagecomments.go
- messagereactions.go
- messages.go
- notifications.go
- paymentlineitems.go
- payments.go
- permissions.go
- previews.go
- priorities.go
- projects.go
- publicipaddresses.go
- publickeys.go
- remotebandwidthsnapshots.go
- remoteservers.go
- requests.go
- root.go
- sessions.go
- settingschanges.go
- sftphostkeys.go
- sites.go
- ssostrategies.go
- statuses.go
- styles.go
- sync.go
- upload.go
- usagedailysnapshots.go
- usagesnapshots.go
- usercipheruses.go
- userrequests.go
- users.go
- version.go
- webhooktests.go
Click to show internal directories.
Click to hide internal directories.