Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add license support #414

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions client/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,20 @@ type NginxInfo struct {
ParentProcessID uint64 `json:"ppid"`
}

// LicenseReporting contains information about license status for NGINX Plus.
type LicenseReporting struct {
Healthy bool
Fails uint64
Grace uint64
}

// NginxLicense contains licensing information about NGINX Plus.
type NginxLicense struct {
ActiveTill uint64 `json:"active_till"`
sjberman marked this conversation as resolved.
Show resolved Hide resolved
Eval bool
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
Reporting LicenseReporting
}

// Caches is a map of cache stats by cache zone.
type Caches = map[string]HTTPCache

Expand Down Expand Up @@ -1553,6 +1567,16 @@ func (client *NginxClient) GetNginxInfo(ctx context.Context) (*NginxInfo, error)
return &info, nil
}

// GetNginxLicense returns Nginx License data with a context.
func (client *NginxClient) GetNginxLicense(ctx context.Context) (*NginxLicense, error) {
var info NginxLicense
err := client.get(ctx, "license", &info)
if err != nil {
return nil, fmt.Errorf("failed to get info: %w", err)
}
return &info, nil
}

// GetCaches returns Cache stats with a context.
func (client *NginxClient) GetCaches(ctx context.Context) (*Caches, error) {
var caches Caches
Expand Down
Loading