Documentation ¶
Index ¶
- Constants
- func NewDebugServer() *debugServer
- func ParseBytesToChefAction(body []byte) *ingestProto.Action
- func ParseBytesToChefRun(body []byte) *ingestProto.Run
- func ParseBytesToComplianceReport(body []byte) *complianceEvent.Report
- func ParseBytesToLivenessPing(body []byte) *ingestProto.Liveness
- func UnmarshalProtoFromBytes(body []byte, pb proto.Message) error
- func UnmarshalProtoFromString(body string, pb proto.Message) error
- type ClientConfig
- type ClientsFactory
- type Config
- type ConnectionOptions
- type NotifierOptions
- type Opts
- func WithAuthorizer(a middleware.SwitchingAuthorizationHandler) Opts
- func WithAutomateURL(u *url.URL) Opts
- func WithClientsFactory(fy ClientsFactory) Opts
- func WithConnectionsFactory(fy *secureconn.Factory) Opts
- func WithGRPCURI(hostname string, port int) Opts
- func WithLogLevel(lvl string) Opts
- func WithOpenAPIUIDir(dir string) Opts
- func WithRouteFeatureToggles(c *Config) Opts
- func WithServiceKeyPair(cert *tls.Certificate, root *x509.CertPool) Opts
- func WithTrialLicenseURL(u *url.URL) Opts
- func WithURI(hostname string, port int) Opts
- type ProfileRequest
- type Server
- func (s *Server) AsyncChefRunNotification(ctx context.Context, run *ingestProto.Run)
- func (s *Server) NewGRPCServer() (*grpc.Server, error)
- func (s *Server) ProfileCreateHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) ProfileTarHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) RegisterGRPCServices(grpcServer *grpc.Server) error
- func (s *Server) ReportExportHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) Serve() error
Constants ¶
const ( UnknownMsg dataCollectorMsgType ChefActionMsg ChefRunStartMsg ChefRunConvergeMsg LivenessAgentMsg ComplianceReportMsg )
Variables ¶
This section is empty.
Functions ¶
func NewDebugServer ¶
func NewDebugServer() *debugServer
func ParseBytesToChefAction ¶
func ParseBytesToChefAction(body []byte) *ingestProto.Action
ParseBytesToChefAction converts a message body in bytes to a ChefAction protobuf msg
func ParseBytesToChefRun ¶
func ParseBytesToChefRun(body []byte) *ingestProto.Run
ParseBytesToChefRun converts a message body in bytes to a ChefRun protobuf msg
func ParseBytesToComplianceReport ¶
func ParseBytesToComplianceReport(body []byte) *complianceEvent.Report
ParseBytesToComplianceReport converts a message body in bytes to a Report protobuf msg
func ParseBytesToLivenessPing ¶
func ParseBytesToLivenessPing(body []byte) *ingestProto.Liveness
ParseBytesToLivenessPing converts a message body in bytes to a Liveness protobuf msg
func UnmarshalProtoFromBytes ¶
UnmarshalProtoFromBytes unmarshals a message body in byte to a generic protobuf msg
Types ¶
type ClientConfig ¶
type ClientConfig struct { Endpoints map[string]ConnectionOptions `mapstructure:"endpoints" toml:"endpoints"` Notifier NotifierOptions `mapstructure:"notifier" toml:"notifier"` }
ClientConfig describes the endpoints we wish to connect to
type ClientsFactory ¶
type ClientsFactory interface { CfgMgmtClient() (cfgmgmt.CfgMgmtClient, error) IngestStatusClient() (chef_ingest.IngestStatusClient, error) ChefIngesterClient() (chef_ingest.ChefIngesterClient, error) ChefIngesterJobSchedulerClient() (chef_ingest.JobSchedulerClient, error) ComplianceIngesterClient() (cc_ingest.ComplianceIngesterClient, error) NotificationsClient() (notifications.NotificationsClient, error) AuthenticationClient() (authn.AuthenticationClient, error) AuthorizationClient() (authz.AuthorizationClient, error) AuthorizationV2Client() (iam_v2beta.AuthorizationClient, error) PoliciesClient() (iam_v2beta.PoliciesClient, error) ProjectsClient() (iam_v2beta.ProjectsClient, error) TeamsV1Client() (teams_v1.TeamsV1Client, error) TeamsV2Client() (teams_v2.TeamsV2Client, error) TokensMgmtClient() (authn.TokensMgmtClient, error) UsersMgmtClient() (local_user.UsersMgmtClient, error) Notifier() (notifier.Notifier, error) ApplicationsClient() (applications.ApplicationsServiceClient, error) SecretClient() (secrets.SecretsServiceClient, error) NodesClient() (nodes.NodesServiceClient, error) FeedClient() (automate_feed.FeedServiceClient, error) ComplianceReportingServiceClient() (cc_reporting.ReportingServiceClient, error) ComplianceProfilesServiceClient() (profiles.ProfilesServiceClient, error) ComplianceJobsServiceClient() (jobs.JobsServiceClient, error) ComplianceStatsServiceClient() (cc_stats.StatsServiceClient, error) ComplianceVersionServiceClient() (cc_version.VersionServiceClient, error) NodeManagerClient() (manager.NodeManagerServiceClient, error) LicenseControlClient() (license_control.LicenseControlClient, error) DeploymentServiceClient() (deployment.DeploymentClient, error) }
ClientsFactory is the interface for grpc client connections
func NewClientsFactory ¶
func NewClientsFactory(config ClientConfig, connFactory *secureconn.Factory) ClientsFactory
NewClientsFactory creates a client factory that keeps one ClientConn per endpoint. Each factory method that returns a client will reuse the ClientConn endpoint. What this means is that you are allowed to cache each client. The target can never change. The underlying ClientConn will be responsible for maintaining the connection, where maintaining includes dealing with disconnects, service processes entering and leaving the pool, ip addresses changing, etc.
type Config ¶
type Config struct { ExternalFqdn string `mapstructure:"external_fqdn" toml:"external_fqdn"` GrpcClients ClientConfig `mapstructure:"grpc_clients" toml:"grpc_clients"` GRPCPort int `mapstructure:"grpc_port" toml:"grpc_port"` Hostname string `mapstructure:"host" toml:"host"` Log struct { Level string `mapstructure:"level" toml:"level"` } `mapstructure:"log" toml:"log"` OpenAPIUIDir string `mapstructure:"open_api_ui_dir" toml:"open_api_ui_dir"` Port int `mapstructure:"port" toml:"port"` ServiceCerts *certs.ServiceCerts TLSConfig certs.TLSConfig `mapstructure:"tls" toml:"tls"` TrialLicenseURL string `mapstructure:"trial_license_url" toml:"trial_license_url"` EnableAppsFeature bool `mapstructure:"enable_apps_feature" toml:"enable_apps_feature"` }
func ConfigFromViper ¶
ConfigFromViper returns a Gateway config from the services configuration file and the viper CLI arguments.
type ConnectionOptions ¶
type ConnectionOptions struct { // Target to connect to Target string `mapstructure:"target" toml:"target"` Secure bool `mapstructure:"secure" toml:"secure"` }
ConnectionOptions describes how we wish to connect to a certain endpoint.
type NotifierOptions ¶
type NotifierOptions struct { }
NotifierOptions contains options used to configure Notifier
type Opts ¶
type Opts func(*Server)
Opts is for supporting functional options like WithClientsFactory, WithConnectionFactory, ..., passed to New()
func WithAuthorizer ¶
func WithAuthorizer(a middleware.SwitchingAuthorizationHandler) Opts
WithAuthorizer allows setting the Authorizer to use
func WithAutomateURL ¶
WithAutomateURL allows setting the URL used externally
func WithClientsFactory ¶
func WithClientsFactory(fy ClientsFactory) Opts
WithClientsFactory allows setting the ClientsFactory to use
func WithConnectionsFactory ¶
func WithConnectionsFactory(fy *secureconn.Factory) Opts
WithConnectionsFactory allows setting the ConnectionsFactory to use
func WithGRPCURI ¶
WithGRPCURI allows setting the internal GRPC URI to use from hostname/port
func WithLogLevel ¶
WithLogLevel sets the log level to use.
Note that we keep the "functional options" style here, although we end up changing the global logger's settings, not the Server. This could become confusing, but it's also paving a way for having the Server control _its own logger_, instead of using the global one. The potential confusing scenario is unlikely: spinning up multiple Server instances with different log levels.
func WithOpenAPIUIDir ¶
WithOpenAPIUIDir sets the swagger ui directory
func WithRouteFeatureToggles ¶
func WithServiceKeyPair ¶
func WithServiceKeyPair(cert *tls.Certificate, root *x509.CertPool) Opts
WithServiceKeyPair allows setting the ServiceKeyPair to use
func WithTrialLicenseURL ¶
WithTrialLicenseURL allows setting the URL used for trial-license-service
type ProfileRequest ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the state of an instance of this service
func NewFromConfig ¶
NewFromConfig initializes a Server given a Config
func (*Server) AsyncChefRunNotification ¶
func (s *Server) AsyncChefRunNotification(ctx context.Context, run *ingestProto.Run)
func (*Server) NewGRPCServer ¶
NewGRPCServer returns a *grpc.Server instance
func (*Server) ProfileCreateHandler ¶
func (s *Server) ProfileCreateHandler(w http.ResponseWriter, r *http.Request)
func (*Server) ProfileTarHandler ¶
func (s *Server) ProfileTarHandler(w http.ResponseWriter, r *http.Request)
func (*Server) RegisterGRPCServices ¶
RegisterGRPCServices registers all grpc services in the passed *grpc.Server
func (*Server) ReportExportHandler ¶
func (s *Server) ReportExportHandler(w http.ResponseWriter, r *http.Request)