Skip to content

Commit

Permalink
add r33 license support
Browse files Browse the repository at this point in the history
Add function GetNginxLicense() which returns a struct of type NginxLicense
  • Loading branch information
pdabelf5 committed Nov 18, 2024
1 parent d68685e commit e0addf1
Showing 1 changed file with 24 additions and 0 deletions.
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"`
Eval bool
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

0 comments on commit e0addf1

Please sign in to comment.