Files
nomad/command/agent/operator_endpoint_ce.go
Tim Gross 8a5a057d88 offline license utilization reporting (#25844)
Nomad Enterprise users operating in air-gapped or otherwise secured environments
don't want to send license reporting metrics directly from their
servers. Implement manual/offline reporting by periodically recording usage
metrics snapshots in the state store, and providing an API and CLI by which
cluster administrators can download the snapshot for review and out-of-band
transmission to HashiCorp.

This is the CE portion of the work required for implemention in the Enterprise
product. Nomad CE does not perform utilization reporting.

Ref: https://github.com/hashicorp/nomad-enterprise/pull/2673
Ref: https://hashicorp.atlassian.net/browse/NMD-68
Ref: https://go.hashi.co/rfc/nmd-210
2025-05-14 09:51:13 -04:00

39 lines
983 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
//go:build !ent
// +build !ent
package agent
import (
"net/http"
"github.com/hashicorp/nomad/api"
"github.com/hashicorp/nomad/nomad/structs"
)
func (s *HTTPServer) LicenseRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
switch req.Method {
case http.MethodGet:
resp.WriteHeader(http.StatusNoContent)
return nil, nil
case http.MethodPut:
return nil, CodedError(501, ErrEntOnly)
default:
return nil, CodedError(405, ErrInvalidMethod)
}
}
// OperatorUtilizationRequest is used get a utilization reporting bundle.
func (s *HTTPServer) OperatorUtilizationRequest(resp http.ResponseWriter, req *http.Request) (any, error) {
if req.Method != http.MethodPost {
return nil, CodedError(405, ErrInvalidMethod)
}
return nil, CodedError(501, ErrEntOnly)
}
func autopilotToAPIEntState(_ structs.OperatorHealthReply, _ *api.OperatorHealthReply) interface{} {
return nil
}