Usage Snapshots

A UsageSnapshot is a site-wide utilization report of storage, bandwidth, APIs, and user accounts of your Files.com site for the given time period.

List Usage Snapshots

SDK Method

usagesnapshot.List()

Return Object

[]*UsageSnapshot

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    usage_snapshot "github.com/Files-com/files-sdk-go/v3/usagesnapshot"
)

usageSnapshotIterator, err := usage_snapshot.List(files_sdk.UsageSnapshotListParams{})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

for usageSnapshotIterator.Next() {
    usageSnapshot := usageSnapshotIterator.usageSnapshot()
}
err = usageSnapshotIterator.Err()
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Get the most recent usage snapshot (usage data for billing purposes) for a Site

SDK Method

site.GetUsage

Return Object

UsageSnapshot

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    "github.com/Files-com/files-sdk-go/v3/site"
)

usageSnapshot, err := site.GetUsage()
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

The UsageSnapshot Object

Some of the methods above return a UsageSnapshot object. The attributes of this object are listed below.

AttributeDescription
Id
int64
Usage snapshot ID
StartAt
date-time
Usage snapshot start date/time
EndAt
date-time
Usage snapshot end date/time
HighWaterUserCount
int64
Highest user count number in time period
TransformationCreditsUsage
int64
Total Transformation and AI credits used in this usage period. Updated daily. Does not include credits consumed today.
CurrentStorage
int64
Current total Storage Usage GB as of end date (not necessarily high water mark, which is used for billing)
HighWaterStorage
int64
Highest Storage Usage GB recorded in time period (used for billing)
RootStorage
int64
Storage Usage for root folder as of end date (not necessarily high water mark, which is used for billing)
DeletedFilesCountedInMinimum
int64
Storage Usage for files that are deleted but uploaded within last 30 days as of end date (not necessarily high water mark, which is used for billing)
DeletedFilesStorage
int64
Storage Usage for files that are deleted but retained as backups as of end date (not necessarily high water mark, which is used for billing)
TotalBillableUsage
int64
Storage + Transfer Usage - Total Billable amount
TotalBillableTransferUsage
int64
Transfer usage for period - Total Billable amount
BytesSent
int64
Transfer Usage for period - Outbound GB from Files Native Storage
SyncBytesReceived
int64
Transfer Usage for period - Inbound GB to Remote Servers (Sync/Mount)
SyncBytesSent
int64
Transfer Usage for period - Outbound GB from Remote Servers (Sync/Mount)
UsageByTopLevelDir
array(object)
Storage Usage - map of root folders to their usage as of end date (not necessarily high water mark, which is used for billing)