Skip to content

Open-source status page, incident response and uptime monitoring

13.5 KB
Raw Blame
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: private_location/v1/private_location.proto

package v1

import (
	connect "connectrpc.com/connect"
	context "context"
	errors "errors"
	http "net/http"
	strings "strings"
)

// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect.IsAtLeastVersion1_13_0

const (
	// PrivateLocationServiceName is the fully-qualified name of the PrivateLocationService service.
	PrivateLocationServiceName = "private_location.v1.PrivateLocationService"
)

// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
	// PrivateLocationServiceMonitorsProcedure is the fully-qualified name of the
	// PrivateLocationService's Monitors RPC.
	PrivateLocationServiceMonitorsProcedure = "/private_location.v1.PrivateLocationService/Monitors"
	// PrivateLocationServiceIngestTCPProcedure is the fully-qualified name of the
	// PrivateLocationService's IngestTCP RPC.
	PrivateLocationServiceIngestTCPProcedure = "/private_location.v1.PrivateLocationService/IngestTCP"
	// PrivateLocationServiceIngestHTTPProcedure is the fully-qualified name of the
	// PrivateLocationService's IngestHTTP RPC.
	PrivateLocationServiceIngestHTTPProcedure = "/private_location.v1.PrivateLocationService/IngestHTTP"
	// PrivateLocationServiceIngestDNSProcedure is the fully-qualified name of the
	// PrivateLocationService's IngestDNS RPC.
	PrivateLocationServiceIngestDNSProcedure = "/private_location.v1.PrivateLocationService/IngestDNS"
	// PrivateLocationServiceIngestICMPProcedure is the fully-qualified name of the
	// PrivateLocationService's IngestICMP RPC.
	PrivateLocationServiceIngestICMPProcedure = "/private_location.v1.PrivateLocationService/IngestICMP"
	// PrivateLocationServiceIngestGRPCProcedure is the fully-qualified name of the
	// PrivateLocationService's IngestGRPC RPC.
	PrivateLocationServiceIngestGRPCProcedure = "/private_location.v1.PrivateLocationService/IngestGRPC"
)

// PrivateLocationServiceClient is a client for the private_location.v1.PrivateLocationService
// service.
type PrivateLocationServiceClient interface {
	Monitors(context.Context, *connect.Request[MonitorsRequest]) (*connect.Response[MonitorsResponse], error)
	IngestTCP(context.Context, *connect.Request[IngestTCPRequest]) (*connect.Response[IngestTCPResponse], error)
	IngestHTTP(context.Context, *connect.Request[IngestHTTPRequest]) (*connect.Response[IngestHTTPResponse], error)
	IngestDNS(context.Context, *connect.Request[IngestDNSRequest]) (*connect.Response[IngestDNSResponse], error)
	IngestICMP(context.Context, *connect.Request[IngestICMPRequest]) (*connect.Response[IngestICMPResponse], error)
	IngestGRPC(context.Context, *connect.Request[IngestGRPCRequest]) (*connect.Response[IngestGRPCResponse], error)
}

// NewPrivateLocationServiceClient constructs a client for the
// private_location.v1.PrivateLocationService service. By default, it uses the Connect protocol with
// the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use
// the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewPrivateLocationServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PrivateLocationServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	privateLocationServiceMethods := File_private_location_v1_private_location_proto.Services().ByName("PrivateLocationService").Methods()
	return &privateLocationServiceClient{
		monitors: connect.NewClient[MonitorsRequest, MonitorsResponse](
			httpClient,
			baseURL+PrivateLocationServiceMonitorsProcedure,
			connect.WithSchema(privateLocationServiceMethods.ByName("Monitors")),
			connect.WithClientOptions(opts...),
		),
		ingestTCP: connect.NewClient[IngestTCPRequest, IngestTCPResponse](
			httpClient,
			baseURL+PrivateLocationServiceIngestTCPProcedure,
			connect.WithSchema(privateLocationServiceMethods.ByName("IngestTCP")),
			connect.WithClientOptions(opts...),
		),
		ingestHTTP: connect.NewClient[IngestHTTPRequest, IngestHTTPResponse](
			httpClient,
			baseURL+PrivateLocationServiceIngestHTTPProcedure,
			connect.WithSchema(privateLocationServiceMethods.ByName("IngestHTTP")),
			connect.WithClientOptions(opts...),
		),
		ingestDNS: connect.NewClient[IngestDNSRequest, IngestDNSResponse](
			httpClient,
			baseURL+PrivateLocationServiceIngestDNSProcedure,
			connect.WithSchema(privateLocationServiceMethods.ByName("IngestDNS")),
			connect.WithClientOptions(opts...),
		),
		ingestICMP: connect.NewClient[IngestICMPRequest, IngestICMPResponse](
			httpClient,
			baseURL+PrivateLocationServiceIngestICMPProcedure,
			connect.WithSchema(privateLocationServiceMethods.ByName("IngestICMP")),
			connect.WithClientOptions(opts...),
		),
		ingestGRPC: connect.NewClient[IngestGRPCRequest, IngestGRPCResponse](
			httpClient,
			baseURL+PrivateLocationServiceIngestGRPCProcedure,
			connect.WithSchema(privateLocationServiceMethods.ByName("IngestGRPC")),
			connect.WithClientOptions(opts...),
		),
	}
}

// privateLocationServiceClient implements PrivateLocationServiceClient.
type privateLocationServiceClient struct {
	monitors   *connect.Client[MonitorsRequest, MonitorsResponse]
	ingestTCP  *connect.Client[IngestTCPRequest, IngestTCPResponse]
	ingestHTTP *connect.Client[IngestHTTPRequest, IngestHTTPResponse]
	ingestDNS  *connect.Client[IngestDNSRequest, IngestDNSResponse]
	ingestICMP *connect.Client[IngestICMPRequest, IngestICMPResponse]
	ingestGRPC *connect.Client[IngestGRPCRequest, IngestGRPCResponse]
}

// Monitors calls private_location.v1.PrivateLocationService.Monitors.
func (c *privateLocationServiceClient) Monitors(ctx context.Context, req *connect.Request[MonitorsRequest]) (*connect.Response[MonitorsResponse], error) {
	return c.monitors.CallUnary(ctx, req)
}

// IngestTCP calls private_location.v1.PrivateLocationService.IngestTCP.
func (c *privateLocationServiceClient) IngestTCP(ctx context.Context, req *connect.Request[IngestTCPRequest]) (*connect.Response[IngestTCPResponse], error) {
	return c.ingestTCP.CallUnary(ctx, req)
}

// IngestHTTP calls private_location.v1.PrivateLocationService.IngestHTTP.
func (c *privateLocationServiceClient) IngestHTTP(ctx context.Context, req *connect.Request[IngestHTTPRequest]) (*connect.Response[IngestHTTPResponse], error) {
	return c.ingestHTTP.CallUnary(ctx, req)
}

// IngestDNS calls private_location.v1.PrivateLocationService.IngestDNS.
func (c *privateLocationServiceClient) IngestDNS(ctx context.Context, req *connect.Request[IngestDNSRequest]) (*connect.Response[IngestDNSResponse], error) {
	return c.ingestDNS.CallUnary(ctx, req)
}

// IngestICMP calls private_location.v1.PrivateLocationService.IngestICMP.
func (c *privateLocationServiceClient) IngestICMP(ctx context.Context, req *connect.Request[IngestICMPRequest]) (*connect.Response[IngestICMPResponse], error) {
	return c.ingestICMP.CallUnary(ctx, req)
}

// IngestGRPC calls private_location.v1.PrivateLocationService.IngestGRPC.
func (c *privateLocationServiceClient) IngestGRPC(ctx context.Context, req *connect.Request[IngestGRPCRequest]) (*connect.Response[IngestGRPCResponse], error) {
	return c.ingestGRPC.CallUnary(ctx, req)
}

// PrivateLocationServiceHandler is an implementation of the
// private_location.v1.PrivateLocationService service.
type PrivateLocationServiceHandler interface {
	Monitors(context.Context, *connect.Request[MonitorsRequest]) (*connect.Response[MonitorsResponse], error)
	IngestTCP(context.Context, *connect.Request[IngestTCPRequest]) (*connect.Response[IngestTCPResponse], error)
	IngestHTTP(context.Context, *connect.Request[IngestHTTPRequest]) (*connect.Response[IngestHTTPResponse], error)
	IngestDNS(context.Context, *connect.Request[IngestDNSRequest]) (*connect.Response[IngestDNSResponse], error)
	IngestICMP(context.Context, *connect.Request[IngestICMPRequest]) (*connect.Response[IngestICMPResponse], error)
	IngestGRPC(context.Context, *connect.Request[IngestGRPCRequest]) (*connect.Response[IngestGRPCResponse], error)
}

// NewPrivateLocationServiceHandler builds an HTTP handler from the service implementation. It
// returns the path on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewPrivateLocationServiceHandler(svc PrivateLocationServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	privateLocationServiceMethods := File_private_location_v1_private_location_proto.Services().ByName("PrivateLocationService").Methods()
	privateLocationServiceMonitorsHandler := connect.NewUnaryHandler(
		PrivateLocationServiceMonitorsProcedure,
		svc.Monitors,
		connect.WithSchema(privateLocationServiceMethods.ByName("Monitors")),
		connect.WithHandlerOptions(opts...),
	)
	privateLocationServiceIngestTCPHandler := connect.NewUnaryHandler(
		PrivateLocationServiceIngestTCPProcedure,
		svc.IngestTCP,
		connect.WithSchema(privateLocationServiceMethods.ByName("IngestTCP")),
		connect.WithHandlerOptions(opts...),
	)
	privateLocationServiceIngestHTTPHandler := connect.NewUnaryHandler(
		PrivateLocationServiceIngestHTTPProcedure,
		svc.IngestHTTP,
		connect.WithSchema(privateLocationServiceMethods.ByName("IngestHTTP")),
		connect.WithHandlerOptions(opts...),
	)
	privateLocationServiceIngestDNSHandler := connect.NewUnaryHandler(
		PrivateLocationServiceIngestDNSProcedure,
		svc.IngestDNS,
		connect.WithSchema(privateLocationServiceMethods.ByName("IngestDNS")),
		connect.WithHandlerOptions(opts...),
	)
	privateLocationServiceIngestICMPHandler := connect.NewUnaryHandler(
		PrivateLocationServiceIngestICMPProcedure,
		svc.IngestICMP,
		connect.WithSchema(privateLocationServiceMethods.ByName("IngestICMP")),
		connect.WithHandlerOptions(opts...),
	)
	privateLocationServiceIngestGRPCHandler := connect.NewUnaryHandler(
		PrivateLocationServiceIngestGRPCProcedure,
		svc.IngestGRPC,
		connect.WithSchema(privateLocationServiceMethods.ByName("IngestGRPC")),
		connect.WithHandlerOptions(opts...),
	)
	return "/private_location.v1.PrivateLocationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case PrivateLocationServiceMonitorsProcedure:
			privateLocationServiceMonitorsHandler.ServeHTTP(w, r)
		case PrivateLocationServiceIngestTCPProcedure:
			privateLocationServiceIngestTCPHandler.ServeHTTP(w, r)
		case PrivateLocationServiceIngestHTTPProcedure:
			privateLocationServiceIngestHTTPHandler.ServeHTTP(w, r)
		case PrivateLocationServiceIngestDNSProcedure:
			privateLocationServiceIngestDNSHandler.ServeHTTP(w, r)
		case PrivateLocationServiceIngestICMPProcedure:
			privateLocationServiceIngestICMPHandler.ServeHTTP(w, r)
		case PrivateLocationServiceIngestGRPCProcedure:
			privateLocationServiceIngestGRPCHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

// UnimplementedPrivateLocationServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedPrivateLocationServiceHandler struct{}

func (UnimplementedPrivateLocationServiceHandler) Monitors(context.Context, *connect.Request[MonitorsRequest]) (*connect.Response[MonitorsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("private_location.v1.PrivateLocationService.Monitors is not implemented"))
}

func (UnimplementedPrivateLocationServiceHandler) IngestTCP(context.Context, *connect.Request[IngestTCPRequest]) (*connect.Response[IngestTCPResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("private_location.v1.PrivateLocationService.IngestTCP is not implemented"))
}

func (UnimplementedPrivateLocationServiceHandler) IngestHTTP(context.Context, *connect.Request[IngestHTTPRequest]) (*connect.Response[IngestHTTPResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("private_location.v1.PrivateLocationService.IngestHTTP is not implemented"))
}

func (UnimplementedPrivateLocationServiceHandler) IngestDNS(context.Context, *connect.Request[IngestDNSRequest]) (*connect.Response[IngestDNSResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("private_location.v1.PrivateLocationService.IngestDNS is not implemented"))
}

func (UnimplementedPrivateLocationServiceHandler) IngestICMP(context.Context, *connect.Request[IngestICMPRequest]) (*connect.Response[IngestICMPResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("private_location.v1.PrivateLocationService.IngestICMP is not implemented"))
}

func (UnimplementedPrivateLocationServiceHandler) IngestGRPC(context.Context, *connect.Request[IngestGRPCRequest]) (*connect.Response[IngestGRPCResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("private_location.v1.PrivateLocationService.IngestGRPC is not implemented"))
}