http

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 26 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	UseCacheQueryKey              = "useCache"
	UseMulticastQueryKey          = "useMulticast"
	UseEndpointsQueryKey          = "useEndpoints"
	TimeoutQueryKey               = "timeout"
	OwnershipStatusFilterQueryKey = "ownershipStatusFilter"
	TypeFilterQueryKey            = "typeFilter"
)
View Source
const (
	DeviceIDKey          = "deviceId"
	ResourceHrefKey      = "resourceHref"
	ResourcesPathKey     = "resources"
	ResourceLinksPathKey = "resource-links"

	ApplicationProtoJsonContentType = "application/protojson"
	ApplicationJsonContentType      = "application/json"

	Api   = "/api"
	ApiV1 = Api + "/v1"

	Devices             = ApiV1 + "/devices"
	Device              = Devices + "/{" + DeviceIDKey + "}"
	DeviceResourceLinks = Devices + "/{" + DeviceIDKey + "}/" + ResourceLinksPathKey
	DeviceResourceLink  = DeviceResourceLinks + "/{" + ResourceHrefKey + "}"
	DeviceResources     = Device + "/" + ResourcesPathKey
	DeviceResource      = DeviceResources + "/{" + ResourceHrefKey + "}"
	OwnDevice           = Device + "/own"
	DisownDevice        = Device + "/disown"
	WebConfiguration    = "/web_configuration.json"
)

HTTP Service URIs.

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	AllowedOrigins   []string `yaml:"allowedOrigins"  json:"allowedOrigins"`
	AllowedHeaders   []string `yaml:"allowedHeaders"  json:"allowedHeaders"`
	AllowedMethods   []string `yaml:"allowedMethods"  json:"allowedMethods"`
	AllowCredentials bool     `yaml:"allowCredentials"  json:"allowCredentials"`
}

type Config

type Config struct {
	listener.Config `yaml:",inline"`
	CORS            CORSConfig `yaml:"cors"  json:"cors"`
	UI              UIConfig   `yaml:"ui" json:"ui"`
}

func (*Config) Validate

func (c *Config) Validate() error

type RequestHandler

type RequestHandler struct {
	// contains filtered or unexported fields
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, serviceName string, config Config, clientApplicationServer *grpc.ClientApplicationServer, logger log.Logger, tracerProvider trace.TracerProvider) (*Service, error)

New creates new HTTP service

func (*Service) Address

func (s *Service) Address() string

func (*Service) Serve

func (s *Service) Serve() error

Serve starts the service's HTTP server and blocks

func (*Service) Shutdown

func (s *Service) Shutdown() error

Shutdown ends serving

type UIConfig

type UIConfig struct {
	Enabled   bool   `yaml:"enabled" json:"enabled"`
	Directory string `yaml:"directory" json:"directory"`
}

func (*UIConfig) Validate

func (c *UIConfig) Validate() error

type WebConfigurationConfig

type WebConfigurationConfig struct {
	HTTPGatewayAddress string `yaml:"httpGatewayAddress" json:"httpGatewayAddress"`
}

WebConfiguration represents web configuration for user interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL