diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76147e0..c81832c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,16 +17,6 @@ jobs: with: go-version: 1.20.3 - - name: Set up protoc - run: | - wget https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip - unzip protoc-25.1-linux-x86_64.zip - sudo mv bin/protoc /usr/local/bin/protoc - sudo mv include/* /usr/local/include/ - - - name: Install protoc-gen-go - run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 - - name: Generated protofiles are up to date run: | make generate-protos diff --git a/Dockerfile.protos b/Dockerfile.protos new file mode 100644 index 0000000..4522c9a --- /dev/null +++ b/Dockerfile.protos @@ -0,0 +1,44 @@ +FROM debian:12.5-slim + +WORKDIR / + +ENV GO_VERSION=1.20 +ENV RUBY_VERSION=3.2 +ENV PYTHON_VERSION=3.10 + +RUN apt-get update && \ + apt-get install -y \ + git \ + wget \ + unzip \ + ruby-dev \ + python3-dev \ + python3-pip \ + python3-grpcio \ + python3-grpc-tools + +# protobuf compiler +ENV PROTOC_VERSION=25.1 +RUN PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ + wget https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/$PROTOC_ZIP -O /tmp/$PROTOC_ZIP && \ + unzip /tmp/$PROTOC_ZIP -d /usr/local bin/protoc && \ + unzip /tmp/$PROTOC_ZIP -d /usr/local 'include/*' && \ + rm -f /tmp/$PROTOC_ZIP + +# Go +ENV PATH="/usr/local/go/bin:$PATH" +ENV PATH="/root/go/bin:$PATH" +RUN wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz && \ + rm go$GO_VERSION.linux-amd64.tar.gz +RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 && \ + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 + +# Ruby +RUN gem install grpc grpc-tools + +ENV PROTO_DIR=./protos +COPY generate_protos.sh /generate_protos.sh +RUN chmod +x /generate_protos.sh + +CMD ["/generate_protos.sh"] diff --git a/Makefile b/Makefile index 7277bca..5554397 100644 --- a/Makefile +++ b/Makefile @@ -63,19 +63,14 @@ generate-certs: clean: find $(PROTO_DIR) -type f ! -name '*.proto' -delete -generate-golang: - protoc --go_out=./ --go_opt=paths=source_relative $(PROTO_DIR)/*.proto +generate-mocks: + mockgen -source protos/data_connector_service_grpc.pb.go -destination=test/mocks/data_connector_service_grpc.go -package mocks -generate-python: - protoc -I=$(PROTO_DIR) --python_out=$(PROTO_DIR)/python/ $(PROTO_DIR)/*.proto - -generate-ruby: - protoc --ruby_out=$(PROTO_DIR)/ruby/ --proto_path=$(PROTO_DIR) $(PROTO_FILES) - -generate-protos: clean generate-golang generate-python generate-ruby +generate-protos: clean + docker run -v ./protos:/protos:rw --rm `docker build -qf Dockerfile.protos .` image-gen: docker build -t $(ALPHA_IMAGE_NAME) . docker save $(ALPHA_IMAGE_NAME) | gzip > $(ALPHA_IMAGE_COMPRESSED_FILENAME).tar.gz -.PHONY: test build vet linters install integration image-gen generate-protos generate-golang generate-python generate-ruby clean +.PHONY: test build vet linters install integration image-gen generate-protos generate-mocks clean diff --git a/README.md b/README.md index 6f0ea2c..c3ec89d 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,21 @@ The following [dispatchers](./telemetry/producer.go#L10-L19) are supported >NOTE: To add a new dispatcher, please provide integration tests and updated documentation. To serialize dispatcher data as json instead of protobufs, add a config `transmit_decoded_records` and set value to `true` as shown [here](config/test_configs_test.go#L186) +## Data Connectors + +Data connectors can be configured to fetch data from a external sources to enhance server functionality. + +**Available capabilities**: +- `vin_allowed`: checks if a vin is allowed to connect to the server. It is recommended to configure this to enhance security. + +**Available data connectors**: +- Redis +- GRPC +- HTTP +- File + +To learn about configuring, see their [full documentation](./connector/README.md). + ## Reliable Acks Fleet telemetry allows you to send ack messages back to the vehicle. This is useful for applications that need to ensure the data was received and processed. To enable this feature, set `reliable_ack_sources` to one of configured dispatchers (`kafka`,`kinesis`,`pubsub`,`zmq`) in the config file. You can only set reliable acks to one dispatcher per recordType. See [here](./test/integration/config.json#L8) for sample config. @@ -175,9 +190,8 @@ To suppress [tls handshake error logging](https://cs.opensource.google/go/go/+/m ## Protos Data is encapsulated into protobuf messages of different types. Protos can be recompiled via: - 1. Install protoc, currently on version 4.25.1: https://grpc.io/docs/protoc-installation/ - 2. Install protoc-gen-go: `go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28` - 3. Run make command + 1. Install Docker + 2. Run make command ```sh make generate-protos ``` diff --git a/config/config.go b/config/config.go index 473c5b5..a8392a3 100644 --- a/config/config.go +++ b/config/config.go @@ -18,6 +18,7 @@ import ( confluent "github.com/confluentinc/confluent-kafka-go/v2/kafka" githublogrus "github.com/sirupsen/logrus" + "github.com/teslamotors/fleet-telemetry/connector" "github.com/teslamotors/fleet-telemetry/datastore/googlepubsub" "github.com/teslamotors/fleet-telemetry/datastore/kafka" "github.com/teslamotors/fleet-telemetry/datastore/kinesis" @@ -88,6 +89,12 @@ type Config struct { // TransmitDecodedRecords if true decodes proto message before dispatching it to supported datastores TransmitDecodedRecords bool `json:"transmit_decoded_records,omitempty"` + // DataConnector defines sources of supplemental data to enhance the server's functionality + DataConnectorConfig connector.Config `json:"data_connectors,omitempty"` + + // DataConnector manages accessing supplemental data from external sources + DataConnector *connector.ConnectorProvider + // MetricCollector collects metrics for the application MetricCollector metrics.MetricCollector @@ -235,6 +242,10 @@ func (c *Config) configureMetricsCollector(logger *logrus.Logger) { c.MetricCollector = metrics.NewCollector(c.Monitoring, logger) } +func (c *Config) configureDataConnector(logger *logrus.Logger) { + c.DataConnector = connector.NewConnectorProvider(c.DataConnectorConfig, c.MetricCollector, logger) +} + func (c *Config) prometheusEnabled() bool { if c.Monitoring != nil && c.Monitoring.PrometheusMetricsPort > 0 { return true diff --git a/config/config_initializer.go b/config/config_initializer.go index deeef47..3ebddae 100644 --- a/config/config_initializer.go +++ b/config/config_initializer.go @@ -32,6 +32,7 @@ func LoadApplicationConfiguration() (config *Config, logger *logrus.Logger, err config.configureLogger(logger) config.configureMetricsCollector(logger) + config.configureDataConnector(logger) return config, logger, nil } diff --git a/connector/README.md b/connector/README.md new file mode 100644 index 0000000..6be6596 --- /dev/null +++ b/connector/README.md @@ -0,0 +1,123 @@ +# Data Connectors + +Data connectors can be configured to fetch data from an external source to enhance server functionality. + +Currently available capabilities: +- `vin_allowed`: Check if a VIN is allowed to connect to the server. + +## Available Connectors + +### File + +Reads from a JSON file. Watches for file changes at runtime. + +- `capabilities`: `[]string` capabilities to use the data connector for. +- `vin_allowed.path`: `string` path of the file to watch. + +**Example File**: +```json +{ + "vins_allowed": ["VIN1"] +} +``` + +**Example Config**: +```json +{ + "data_connectors": { + "file": { + "capabilities": ["vin_allowed"], + "path": "path/to/file" + } + } +} +``` + +### Redis + +Obtains data from a Redis cache. + +- `capabilities`: `[]string` capabilities to use the data connector for. +- `vin_allowed.prefix`: `string` prefix for all Redis keys when checking if a VIN is allowed to connect. +- `vin_allowed.allow_on_failure`: `bool` whether a VIN should be allowed to connect to the server if an error is encountered while fetching from Redis. + +**Example Config**: + +```json +{ + "data_connectors": { + "redis": { + "capabilities": ["vin_allowed"], + "vin_allowed": { + "prefix": "vin_allowed:", + "allow_on_failure": true + } + } + } +} +``` + +### HTTP + +Obtains data from an REST API. + +- `capabilities`: `[]string` capabilities to use the data connector for. +- `host`: `string` host of the remote server. +- `timeout_seconds`: `int` seconds to wait for a response. +- `transport`: `http.Transport` [golang transport options](https://pkg.go.dev/net/http#Transport). +- `vin_allowed.cache_results`: `bool` whether results from the API should be cached in memory. +- `vin_allowed.cache_ttl_minutes`: `int` how many minutes each result should be remembered in the cache. Defaults to no expiration. +- `vin_allowed.allow_on_failure`: `bool` whether a VIN should be allowed to connect to the server if an error is encountered while fetching from Redis. + +**Example Config**: + +```json +{ + "data_connectors": { + "http": { + "capabilities": ["vin_allowed"], + "host": "localhost", + "timeout_seconds": 10, + "vin_allowed": { + "cache_results": true, + "cache_ttl_minutes": 60, + "allow_on_failure": false + } + } + } +} +``` + +### gRPC + +Obtains data from a gRPC service. + +- `capabilities`: capabilities to use the data connector for. +- `host`: host of the gRPC server. +- `tls.cert_file`: path to cert to use when connecting. +- `tls.key_file`: path to key to use when connecting. +- `vin_allowed.cache_results`: `bool` whether results from the API should be cached in memory. +- `vin_allowed.cache_ttl_minutes`: `int` how many minutes each result should be remembered in the cache. Defaults to no expiration. +- `vin_allowed.allow_on_failure`: `bool` whether a VIN should be allowed to connect to the server if an error is encountered while fetching from Redis. + +**Example Config**: + +```json +{ + "data_connectors": { + "grpc": { + "capabilities": ["vin_allowed"], + "host": "grpc_host", + "tls": { + "cert_file": "path/to/cert", + "key_file": "path/to/key" + }, + "vin_allowed": { + "cache_results": true, + "cache_ttl_minutes": 60, + "allow_on_failure": false + } + } + } +} +``` diff --git a/connector/adapter/file/file.go b/connector/adapter/file/file.go new file mode 100644 index 0000000..c5ce2d4 --- /dev/null +++ b/connector/adapter/file/file.go @@ -0,0 +1,159 @@ +package file + +import ( + "encoding/json" + "os" + "sync" + "time" + + "github.com/fsnotify/fsnotify" + + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics" + "github.com/teslamotors/fleet-telemetry/metrics/adapter" +) + +var ( + serverMetricsRegistry ServerMetrics + serverMetricsOnce sync.Once +) + +type ServerMetrics struct { + fileReadErrorCount adapter.Counter + fileEventCount adapter.Counter +} + +type Config struct { + Path string `json:"path"` + Capabilities []string `json:"capabilities"` +} + +type Data struct { + AllowedVins []string `json:"allowed_vins,omitempty"` +} + +type Connector struct { + watcher *fsnotify.Watcher + allowedVins map[string]bool + LastUpdate time.Time + logger *logrus.Logger + metricsCollector metrics.MetricCollector +} + +func NewConnector(config Config, metricsCollector metrics.MetricCollector, logger *logrus.Logger) (*Connector, error) { + registerMetricsOnce(metricsCollector) + connector := &Connector{ + logger: logger, + metricsCollector: metricsCollector, + } + + err := connector.processFile(config.Path) + if err != nil { + return nil, err + } + err = connector.setupWatcher(config.Path) + if err != nil { + return nil, err + } + + return connector, nil +} + +func (c *Connector) VinAllowed(vin string) (bool, error) { + if c.allowedVins == nil { + return true, nil + } + + return c.allowedVins[vin], nil +} + +func (c *Connector) Close() error { + return c.watcher.Close() +} + +func (c *Connector) processUpdates() { + for { + select { + case event, ok := <-c.watcher.Events: + if !ok { + return + } + if event.Op&fsnotify.Write == fsnotify.Write { + err := c.processFile(event.Name) + serverMetricsRegistry.fileEventCount.Inc(nil) + if err != nil { + serverMetricsRegistry.fileReadErrorCount.Inc(nil) + c.logger.ErrorLog("file_connector_invalid_file_content", err, nil) + } + } + case err, ok := <-c.watcher.Errors: + if !ok { + return + } + c.logger.ErrorLog("file_connector_watcher_error", err, nil) + } + } +} + +func (c *Connector) processFile(filepath string) error { + fileBytes, err := os.ReadFile(filepath) + if err != nil { + return err + } + fileData := Data{} + err = json.Unmarshal(fileBytes, &fileData) + if err != nil { + return err + } + + c.processAllowedVins(fileData) + + c.LastUpdate = time.Now() + return nil +} + +func (c *Connector) processAllowedVins(fileData Data) { + if fileData.AllowedVins == nil { + c.allowedVins = nil + return + } + + allowedVins := make(map[string]bool, len(fileData.AllowedVins)) + for _, vin := range fileData.AllowedVins { + allowedVins[vin] = true + } + c.allowedVins = allowedVins +} + +func (c *Connector) setupWatcher(filepath string) error { + watcher, err := fsnotify.NewWatcher() + if err != nil { + return err + } + err = watcher.Add(filepath) + if err != nil { + return err + } + c.watcher = watcher + go c.processUpdates() + + return nil +} + +func registerMetricsOnce(metricsCollector metrics.MetricCollector) { + serverMetricsOnce.Do(func() { registerMetrics(metricsCollector) }) +} + +func registerMetrics(metricsCollector metrics.MetricCollector) { + serverMetricsRegistry.fileEventCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_file_event_count", + Help: "The number of file events processed.", + Labels: []string{}, + }) + + serverMetricsRegistry.fileReadErrorCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_file_read_error_count", + Help: "The number of errors while processing file.", + Labels: []string{}, + }) +} diff --git a/connector/adapter/file/file_suite_test.go b/connector/adapter/file/file_suite_test.go new file mode 100644 index 0000000..0e75c58 --- /dev/null +++ b/connector/adapter/file/file_suite_test.go @@ -0,0 +1,13 @@ +package file_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestConfigs(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "File Connector") +} diff --git a/connector/adapter/file/file_test.go b/connector/adapter/file/file_test.go new file mode 100644 index 0000000..e2c791b --- /dev/null +++ b/connector/adapter/file/file_test.go @@ -0,0 +1,116 @@ +package file_test + +import ( + "encoding/json" + "fmt" + "os" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + f "github.com/teslamotors/fleet-telemetry/connector/adapter/file" + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics/adapter/noop" +) + +func saveFileBytes(testFilePath string, b []byte, connector *f.Connector) { + before := connector.LastUpdate + + err := os.WriteFile(testFilePath, b, 0644) + Expect(err).NotTo(HaveOccurred()) + + Eventually(func() int64 { + return connector.LastUpdate.UnixNano() + }).Should(BeNumerically(">", before.UnixNano())) +} + +func saveFile(testFilePath string, testData f.Data, connector *f.Connector) { + jsonData, err := json.Marshal(testData) + Expect(err).NotTo(HaveOccurred()) + saveFileBytes(testFilePath, jsonData, connector) +} + +var _ = Describe("Connector", func() { + var ( + testFilePath string + testConnector *f.Connector + logger *logrus.Logger + ) + + BeforeEach(func() { + logger, _ = logrus.NoOpLogger() + file, err := os.CreateTemp("/tmp", "test-file-*.json") + Expect(err).NotTo(HaveOccurred()) + defer file.Close() + + testFilePath = file.Name() + + testData := f.Data{ + AllowedVins: []string{"VIN1", "VIN2"}, + } + jsonData, err := json.Marshal(testData) + Expect(err).NotTo(HaveOccurred()) + + err = os.WriteFile(testFilePath, jsonData, 0644) + Expect(err).NotTo(HaveOccurred()) + + connector, err := f.NewConnector(f.Config{Path: testFilePath}, &noop.Collector{}, logger) + Expect(err).NotTo(HaveOccurred()) + testConnector = connector + }) + + AfterEach(func() { + os.Remove(testFilePath) + testConnector.Close() + }) + + Describe("VinAllowed", func() { + Context("with vins in the file", func() { + It("should return true for allowed VIN", func() { + Expect(testConnector.VinAllowed("VIN1")).To(BeTrue()) + }) + + It("should return false for not allowed VIN", func() { + Expect(testConnector.VinAllowed("VIN3")).To(BeFalse()) + }) + + It("should update after file change", func() { + Expect(testConnector.VinAllowed("VIN3")).To(BeFalse()) + + saveFile(testFilePath, f.Data{ + AllowedVins: []string{"VIN3"}, + }, testConnector) + + Eventually(func() { + Expect(testConnector.VinAllowed("VIN3")).To(BeTrue()) + Expect(testConnector.VinAllowed("VIN1")).To(BeFalse()) + }) + }) + }) + + Context("with no vins in the file", func() { + JustBeforeEach(func() { + saveFile(testFilePath, f.Data{}, testConnector) + }) + + It("allows all vins", func() { + for i := 0; i < 5; i++ { + Expect(testConnector.VinAllowed(fmt.Sprintf("VIN%d", i))).To(BeTrue()) + } + }) + }) + + Context("with invalid file", func() { + JustBeforeEach(func() { + err := os.WriteFile(testFilePath, []byte("test"), 0644) + Expect(err).NotTo(HaveOccurred()) + }) + + It("keeps prior rules", func() { + Expect(testConnector.VinAllowed("VIN1")).To(BeTrue()) + Expect(testConnector.VinAllowed("VIN2")).To(BeTrue()) + Expect(testConnector.VinAllowed("VIN3")).To(BeFalse()) + }) + }) + }) +}) diff --git a/connector/adapter/grpc/grpc.go b/connector/adapter/grpc/grpc.go new file mode 100644 index 0000000..50d0dd8 --- /dev/null +++ b/connector/adapter/grpc/grpc.go @@ -0,0 +1,149 @@ +package grpc + +import ( + "context" + "sync" + "time" + + "github.com/teslamotors/fleet-telemetry/connector/util" + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics" + "github.com/teslamotors/fleet-telemetry/metrics/adapter" + pb "github.com/teslamotors/fleet-telemetry/protos" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" +) + +const ( + cacheCleanupInterval = 5 * time.Minute +) + +var ( + serverMetricsRegistry ServerMetrics + serverMetricsOnce sync.Once +) + +type ServerMetrics struct { + cacheHitCount adapter.Counter + requestErrorCount adapter.Counter + requestCount adapter.Counter +} + +type VinAllowed struct { + AllowOnFailure bool `json:"allow_on_failure,omitempty"` + CacheResults bool `json:"cache_results,omitempty"` + CacheTTLMinutes int `json:"cache_ttl_minutes,omitempty"` + cacheTTL time.Duration +} + +type Config struct { + Host string `json:"host"` + Tls *TlsConfig `json:"tls,omitempty"` + Capabilities []string `json:"capabilities"` + VinAllowed VinAllowed `json:"vin_allowed,omitempty"` +} + +type TlsConfig struct { + CertFile string `json:"cert_file"` + KeyFile string `json:"key_file"` +} + +type Connector struct { + Client pb.VehicleServiceClient + Config Config + vinAllowedCache *util.Cache[bool] + + conn *grpc.ClientConn + logger *logrus.Logger + metricsCollector metrics.MetricCollector +} + +func NewConnector(config Config, metricsCollector metrics.MetricCollector, logger *logrus.Logger) (*Connector, error) { + registerMetricsOnce(metricsCollector) + + var opts []grpc.DialOption + if config.Tls != nil { + creds, err := credentials.NewClientTLSFromFile(config.Tls.CertFile, config.Tls.KeyFile) + if err != nil { + return nil, err + } + opts = append(opts, grpc.WithTransportCredentials(creds)) + } + + conn, err := grpc.NewClient(config.Host, opts...) + if err != nil { + return nil, err + } + + config.VinAllowed.cacheTTL = time.Duration(config.VinAllowed.CacheTTLMinutes) * time.Minute + + return &Connector{ + Client: pb.NewVehicleServiceClient(conn), + conn: conn, + vinAllowedCache: util.NewCache[bool](cacheCleanupInterval), + Config: config, + logger: logger, + metricsCollector: metricsCollector, + }, nil +} + +func NewTestGrpcConnector(client pb.VehicleServiceClient, config Config, metricsCollector metrics.MetricCollector, logger *logrus.Logger) *Connector { + registerMetricsOnce(metricsCollector) + return &Connector{ + Client: client, + vinAllowedCache: util.NewCache[bool](cacheCleanupInterval), + Config: config, + logger: logger, + } +} + +func (c *Connector) VinAllowed(vin string) (bool, error) { + serverMetricsRegistry.requestCount.Inc(adapter.Labels{"capability": util.VinAllowed}) + + if allowed, ok := c.vinAllowedCache.Get(vin); ok { + serverMetricsRegistry.cacheHitCount.Inc(adapter.Labels{"capability": util.VinAllowed}) + return *allowed, nil + } + + req := &pb.VinAllowedRequest{Vin: vin} + res, err := c.Client.VinAllowed(context.Background(), req) + if err != nil { + c.logger.ErrorLog("grpc_connector_vin_allowed_error", err, nil) + serverMetricsRegistry.requestErrorCount.Inc(adapter.Labels{"capability": util.VinAllowed}) + return c.Config.VinAllowed.AllowOnFailure, err + } + + if c.Config.VinAllowed.CacheResults { + c.vinAllowedCache.Set(vin, res.Allowed, c.Config.VinAllowed.cacheTTL) + } + + return res.Allowed, nil +} + +func (c *Connector) Close() error { + return c.conn.Close() +} + +func registerMetricsOnce(metricsCollector metrics.MetricCollector) { + serverMetricsOnce.Do(func() { registerMetrics(metricsCollector) }) +} + +func registerMetrics(metricsCollector metrics.MetricCollector) { + serverMetricsRegistry.requestCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_grpc_request_count", + Help: "The number requests hanlded by grpc connector.", + Labels: []string{"capability"}, + }) + + serverMetricsRegistry.requestErrorCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_grpc_request_error_count", + Help: "The number of errors encountered by grpc connector.", + Labels: []string{"capability"}, + }) + + serverMetricsRegistry.cacheHitCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_grpc_request_cache_hit_count", + Help: "The number of requests served by grpc cache.", + Labels: []string{"capability"}, + }) +} diff --git a/connector/adapter/grpc/grpc_suite_test.go b/connector/adapter/grpc/grpc_suite_test.go new file mode 100644 index 0000000..a05c1eb --- /dev/null +++ b/connector/adapter/grpc/grpc_suite_test.go @@ -0,0 +1,13 @@ +package grpc + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestConfigs(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "GRPC Connector") +} diff --git a/connector/adapter/grpc/grpc_test.go b/connector/adapter/grpc/grpc_test.go new file mode 100644 index 0000000..d067034 --- /dev/null +++ b/connector/adapter/grpc/grpc_test.go @@ -0,0 +1,87 @@ +package grpc_test + +import ( + "fmt" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "go.uber.org/mock/gomock" + + g "github.com/teslamotors/fleet-telemetry/connector/adapter/grpc" + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics/adapter/noop" + pb "github.com/teslamotors/fleet-telemetry/protos" + "github.com/teslamotors/fleet-telemetry/test/mocks" +) + +var _ = Describe("GrpcConnector", func() { + var ( + mockCtrl *gomock.Controller + mockClient *mocks.MockVehicleServiceClient + connector *g.Connector + logger *logrus.Logger + ) + + BeforeEach(func() { + logger, _ = logrus.NoOpLogger() + mockCtrl = gomock.NewController(GinkgoT()) + mockClient = mocks.NewMockVehicleServiceClient(mockCtrl) + connector = g.NewTestGrpcConnector(mockClient, g.Config{}, noop.NewCollector(), logger) + }) + + AfterEach(func() { + mockCtrl.Finish() + }) + + Describe("VinAllowed", func() { + It("should return true if VIN is allowed", func() { + mockClient.EXPECT().VinAllowed( + gomock.Any(), + &pb.VinAllowedRequest{Vin: "123"}, + ).Return(&pb.VinAllowedResponse{Allowed: true}, nil) + + allowed, err := connector.VinAllowed("123") + Expect(err).NotTo(HaveOccurred()) + Expect(allowed).To(BeTrue()) + }) + It("should return false if VIN is not allowed", func() { + mockClient.EXPECT().VinAllowed( + gomock.Any(), + &pb.VinAllowedRequest{Vin: "123"}, + ).Return(&pb.VinAllowedResponse{Allowed: false}, nil) + + allowed, err := connector.VinAllowed("123") + Expect(err).NotTo(HaveOccurred()) + Expect(allowed).To(BeFalse()) + }) + + It("should return an error if the client fails", func() { + mockClient.EXPECT().VinAllowed( + gomock.Any(), + &pb.VinAllowedRequest{Vin: "789"}, + ).Return(nil, fmt.Errorf("client failure")) + + allowed, err := connector.VinAllowed("789") + Expect(err).To(HaveOccurred()) + Expect(allowed).To(BeFalse()) + }) + + It("caches second request", func() { + connector.Config.VinAllowed.CacheResults = true + mockClient.EXPECT().VinAllowed( + gomock.Any(), + &pb.VinAllowedRequest{Vin: "789"}, + ).Return(&pb.VinAllowedResponse{Allowed: false}, nil).Times(1) + + // makes grpc call + allowed, err := connector.VinAllowed("789") + Expect(err).ToNot(HaveOccurred()) + Expect(allowed).To(BeFalse()) + + // uses cache + allowed, err = connector.VinAllowed("789") + Expect(err).ToNot(HaveOccurred()) + Expect(allowed).To(BeFalse()) + }) + }) +}) diff --git a/connector/adapter/http/http.go b/connector/adapter/http/http.go new file mode 100644 index 0000000..1781f1e --- /dev/null +++ b/connector/adapter/http/http.go @@ -0,0 +1,153 @@ +package http + +import ( + "encoding/json" + "fmt" + "net/http" + "sync" + "time" + + "github.com/teslamotors/fleet-telemetry/connector/util" + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics" + "github.com/teslamotors/fleet-telemetry/metrics/adapter" +) + +const ( + cacheCleanupInterval = 5 * time.Minute +) + +var ( + serverMetricsRegistry ServerMetrics + serverMetricsOnce sync.Once +) + +type ServerMetrics struct { + requestErrorCount adapter.Counter + requestCount adapter.Counter + cacheHitCount adapter.Counter +} + +type VinAllowed struct { + AllowOnFailure bool `json:"allow_on_failure,omitempty"` + CacheResults bool `json:"cache_results,omitempty"` + CacheTTLMinutes int `json:"cache_ttl_minutes,omitempty"` + cacheTTL time.Duration +} + +type Config struct { + Host string `json:"host"` + TimeoutSeconds int `json:"timeout_seconds,omitempty"` + Transport *http.Transport `json:"transport,omitempty"` + Capabilities []string `json:"capabilities"` + VinAllowed VinAllowed `json:"vin_allowed,omitempty"` +} + +type Connector struct { + Config *Config + client *http.Client + vinAllowedCache *util.Cache[bool] + + logger *logrus.Logger + metricsCollector metrics.MetricCollector +} + +type VinAllowedResponse struct { + Allowed bool `json:"allowed"` +} + +func NewConnector(config *Config, metricsCollector metrics.MetricCollector, logger *logrus.Logger) (*Connector, error) { + registerMetricsOnce(metricsCollector) + populateDefaults(config) + + config.VinAllowed.cacheTTL = time.Duration(config.VinAllowed.CacheTTLMinutes) * time.Minute + + return &Connector{ + Config: config, + vinAllowedCache: util.NewCache[bool](cacheCleanupInterval), + client: &http.Client{ + Timeout: time.Duration(config.TimeoutSeconds) * time.Second, + Transport: config.Transport, + }, + logger: logger, + metricsCollector: metricsCollector, + }, nil +} + +func (c *Connector) VinAllowed(vin string) (bool, error) { + serverMetricsRegistry.requestCount.Inc(adapter.Labels{"capability": util.VinAllowed}) + if allowed, ok := c.vinAllowedCache.Get(vin); ok { + serverMetricsRegistry.cacheHitCount.Inc(adapter.Labels{"capability": util.VinAllowed}) + return *allowed, nil + } + + var vinAllowedResponse VinAllowedResponse + res, err := c.get(fmt.Sprintf("%s/allowed", vin), &vinAllowedResponse) + if err != nil { + c.logger.ErrorLog("http_connector_vin_allowed_error", err, nil) + serverMetricsRegistry.requestErrorCount.Inc(adapter.Labels{"capability": util.VinAllowed, "status": "0"}) + return c.Config.VinAllowed.AllowOnFailure, err + } + if res.StatusCode != http.StatusOK { + c.logger.ErrorLog("http_connector_vin_allowed_error", fmt.Errorf("unexpected status code: %d", res.StatusCode), logrus.LogInfo{"status": res.StatusCode}) + serverMetricsRegistry.requestErrorCount.Inc(adapter.Labels{"capability": "vin_allowed", "status": fmt.Sprintf("%d", res.StatusCode)}) + return c.Config.VinAllowed.AllowOnFailure, nil + } + + if c.Config.VinAllowed.CacheResults { + c.vinAllowedCache.Set(vin, vinAllowedResponse.Allowed, c.Config.VinAllowed.cacheTTL) + } + + return vinAllowedResponse.Allowed, nil +} + +func (c *Connector) Close() error { + return nil +} + +func (c *Connector) get(path string, resultStruct interface{}) (*http.Response, error) { + res, err := c.client.Get(fmt.Sprintf("%s/%s", c.Config.Host, path)) + if err != nil { + return nil, err + } + defer res.Body.Close() + + if res.StatusCode == http.StatusOK { + err = json.NewDecoder(res.Body).Decode(resultStruct) + } + + return res, err +} + +func populateDefaults(config *Config) { + if config.TimeoutSeconds <= 0 { + config.TimeoutSeconds = 10 + } + if config.Transport == nil { + config.Transport = http.DefaultTransport.(*http.Transport) + } +} + +func registerMetricsOnce(metricsCollector metrics.MetricCollector) { + serverMetricsOnce.Do(func() { registerMetrics(metricsCollector) }) +} + +func registerMetrics(metricsCollector metrics.MetricCollector) { + serverMetricsRegistry.requestCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_http_request_count", + Help: "The number requests handled by http connector.", + Labels: []string{"capability"}, + }) + + serverMetricsRegistry.requestErrorCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_http_request_error_count", + Help: "The number of errors encountered by http connector.", + Labels: []string{"capability", "status"}, + }) + + serverMetricsRegistry.cacheHitCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_http_request_cache_hit_count", + Help: "The number of requests served by http cache.", + Labels: []string{"capability"}, + }) +} diff --git a/connector/adapter/http/http_suite_test.go b/connector/adapter/http/http_suite_test.go new file mode 100644 index 0000000..6460a37 --- /dev/null +++ b/connector/adapter/http/http_suite_test.go @@ -0,0 +1,13 @@ +package http_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestConfigs(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "HTTP Connector") +} diff --git a/connector/adapter/http/http_test.go b/connector/adapter/http/http_test.go new file mode 100644 index 0000000..8b54e5e --- /dev/null +++ b/connector/adapter/http/http_test.go @@ -0,0 +1,107 @@ +package http_test + +import ( + "net/http" + "net/http/httptest" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + httpConnector "github.com/teslamotors/fleet-telemetry/connector/adapter/http" + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics/adapter/noop" +) + +var _ = Describe("HttpConnector", func() { + var ( + mockServer *httptest.Server + connector *httpConnector.Connector + config *httpConnector.Config + err error + logger *logrus.Logger + + vinAllowedCount int + vinRejectedCount int + errorCount int + ) + + BeforeEach(func() { + logger, _ = logrus.NoOpLogger() + mockServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/VIN-allowed/allowed" { + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{"allowed": true}`)) + vinAllowedCount++ + return + } + + if r.URL.Path == "/VIN-not-allowed/allowed" { + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{"allowed": false}`)) + vinRejectedCount++ + return + } + + errorCount++ + http.Error(w, "not found", http.StatusNotFound) + })) + + vinAllowedCount = 0 + vinRejectedCount = 0 + errorCount = 0 + + config = &httpConnector.Config{ + Host: mockServer.URL, + TimeoutSeconds: 5, + VinAllowed: httpConnector.VinAllowed{ + AllowOnFailure: true, + CacheResults: true, + }, + } + + connector, err = httpConnector.NewConnector(config, noop.NewCollector(), logger) + Expect(err).NotTo(HaveOccurred()) + }) + + AfterEach(func() { + mockServer.Close() + }) + + Describe("VinAllowed", func() { + Context("when VIN is allowed", func() { + It("should return true", func() { + Expect(connector.VinAllowed("VIN-allowed")).To(BeTrue()) + Expect(vinAllowedCount).To(Equal(1)) + }) + }) + + Context("when VIN is not allowed", func() { + It("should return false", func() { + Expect(connector.VinAllowed("VIN-not-allowed")).To(BeFalse()) + Expect(vinRejectedCount).To(Equal(1)) + }) + }) + + Context("when there is an error", func() { + BeforeEach(func() { + connector, err = httpConnector.NewConnector(config, noop.NewCollector(), logger) + Expect(err).NotTo(HaveOccurred()) + }) + + It("should return AllowOnFailure value", func() { + config.VinAllowed.AllowOnFailure = false + Expect(connector.VinAllowed("VIN")).To(Equal(false)) + + config.VinAllowed.AllowOnFailure = true + Expect(connector.VinAllowed("VIN")).To(Equal(true)) + Expect(errorCount).To(Equal(2)) + }) + }) + + It("should cache results", func() { + Expect(connector.VinAllowed("VIN-allowed")).To(BeTrue()) + Expect(connector.VinAllowed("VIN-allowed")).To(BeTrue()) + Expect(vinAllowedCount).To(Equal(1)) + }) + }) +}) diff --git a/connector/adapter/redis/redis.go b/connector/adapter/redis/redis.go new file mode 100644 index 0000000..78c9bb3 --- /dev/null +++ b/connector/adapter/redis/redis.go @@ -0,0 +1,98 @@ +package redis + +import ( + "context" + "fmt" + "sync" + + "github.com/redis/go-redis/v9" + + "github.com/teslamotors/fleet-telemetry/connector/util" + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics" + "github.com/teslamotors/fleet-telemetry/metrics/adapter" +) + +var ( + serverMetricsRegistry ServerMetrics + serverMetricsOnce sync.Once +) + +type ServerMetrics struct { + requestCount adapter.Counter + requestErrorCount adapter.Counter +} + +type VinAllowed struct { + AllowOnFailure bool `json:"allow_on_failure,omitempty"` + Prefix string `json:"prefix"` +} + +type Config struct { + Client redis.Options `json:"client,omitempty"` + Capabilities []string `json:"capabilities"` + + VinAllowed VinAllowed `json:"vin_allowed"` +} + +type Connector struct { + Client *redis.Client + Config Config + + logger *logrus.Logger + metricsCollector metrics.MetricCollector +} + +func NewConnector(config Config, metricsCollector metrics.MetricCollector, logger *logrus.Logger) (*Connector, error) { + registerMetricsOnce(metricsCollector) + return &Connector{ + Client: redis.NewClient(&config.Client), + Config: config, + metricsCollector: metricsCollector, + logger: logger, + }, nil +} + +func NewTestRedisConnector(client *redis.Client, config Config) *Connector { + return &Connector{ + Client: client, + Config: config, + } +} + +func (c *Connector) VinAllowed(vin string) (bool, error) { + serverMetricsRegistry.requestCount.Inc(adapter.Labels{"capability": util.VinAllowed}) + exists, err := c.Client.Exists(context.TODO(), c.createRedisKey(c.Config.VinAllowed.Prefix, vin)).Result() + if err != nil { + serverMetricsRegistry.requestErrorCount.Inc(adapter.Labels{"capability": util.VinAllowed}) + return c.Config.VinAllowed.AllowOnFailure, err + } + + return exists == 1, err +} + +func (c *Connector) Close() error { + return c.Client.Close() +} + +func (c *Connector) createRedisKey(prefix, vin string) string { + return fmt.Sprintf("%s%s", prefix, vin) +} + +func registerMetricsOnce(metricsCollector metrics.MetricCollector) { + serverMetricsOnce.Do(func() { registerMetrics(metricsCollector) }) +} + +func registerMetrics(metricsCollector metrics.MetricCollector) { + serverMetricsRegistry.requestCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_redis_request_count", + Help: "The number requests hanlded by redis connector.", + Labels: []string{"capability"}, + }) + + serverMetricsRegistry.requestErrorCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "data_connector_redis_request_error_count", + Help: "The number of errors encountered by redis connector.", + Labels: []string{"capability"}, + }) +} diff --git a/connector/adapter/redis/redis_suite_test.go b/connector/adapter/redis/redis_suite_test.go new file mode 100644 index 0000000..d7f46db --- /dev/null +++ b/connector/adapter/redis/redis_suite_test.go @@ -0,0 +1,13 @@ +package redis_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestConfigs(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Redis Connector") +} diff --git a/connector/adapter/redis/redis_test.go b/connector/adapter/redis/redis_test.go new file mode 100644 index 0000000..73eff0a --- /dev/null +++ b/connector/adapter/redis/redis_test.go @@ -0,0 +1,78 @@ +package redis_test + +import ( + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/go-redis/redismock/v9" + "github.com/redis/go-redis/v9" + + r "github.com/teslamotors/fleet-telemetry/connector/adapter/redis" + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics/adapter/noop" +) + +var _ = Describe("RedisConnector", func() { + var ( + mock redismock.ClientMock + client *redis.Client + connector *r.Connector + config r.Config + ) + + BeforeEach(func() { + client, mock = redismock.NewClientMock() + config = r.Config{ + VinAllowed: r.VinAllowed{ + Prefix: "vin_allowed:", + }, + } + + connector = r.NewTestRedisConnector(client, config) + }) + + AfterEach(func() { + mock.ClearExpect() + }) + + Describe("NewRedisConnector", func() { + It("should create a new RedisConnector with default prefix", func() { + connector, err := r.NewConnector(config, noop.NewCollector(), &logrus.Logger{}) + Expect(err).NotTo(HaveOccurred()) + Expect(connector).NotTo(BeNil()) + }) + }) + + Describe("VinAllowed", func() { + Context("with default prefix", func() { + It("should return true if VIN is allowed", func() { + mock.ExpectExists("vin_allowed:123").SetVal(1) + + allowed, err := connector.VinAllowed("123") + Expect(err).NotTo(HaveOccurred()) + Expect(allowed).To(BeTrue()) + }) + + It("should return false if VIN is not allowed", func() { + mock.ExpectExists("vin_allowed:456").SetVal(0) + + allowed, err := connector.VinAllowed("456") + Expect(err).NotTo(HaveOccurred()) + Expect(allowed).To(BeFalse()) + }) + }) + + Context("with custom prefix", func() { + BeforeEach(func() { + connector.Config.VinAllowed.Prefix = "other_prefix:" + }) + It("should use custom prefix", func() { + mock.ExpectExists("other_prefix:123").SetVal(0) + + allowed, err := connector.VinAllowed("123") + Expect(err).NotTo(HaveOccurred()) + Expect(allowed).To(BeFalse()) + }) + }) + }) +}) diff --git a/connector/connector.go b/connector/connector.go new file mode 100644 index 0000000..0ff738a --- /dev/null +++ b/connector/connector.go @@ -0,0 +1,141 @@ +package connector + +import ( + "fmt" + + "github.com/teslamotors/fleet-telemetry/connector/adapter/file" + "github.com/teslamotors/fleet-telemetry/connector/adapter/grpc" + "github.com/teslamotors/fleet-telemetry/connector/adapter/http" + "github.com/teslamotors/fleet-telemetry/connector/adapter/redis" + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics" +) + +type Connector interface { + VinAllowed(vin string) (bool, error) + Close() error +} + +type Config struct { + File *file.Config `json:"file,omitempty"` + Grpc *grpc.Config `json:"grpc,omitempty"` + Http *http.Config `json:"http,omitempty"` + Redis *redis.Config `json:"redis,omitempty"` +} + +type Connectors struct { + File *file.Connector + Grpc *grpc.Connector + Http *http.Connector + Redis *redis.Connector +} + +type ConnectorProvider struct { + VinAllowedConnector Connector + Connectors Connectors + + config Config + logger *logrus.Logger +} + +func NewConnectorProvider(config Config, metricsCollector metrics.MetricCollector, logger *logrus.Logger) *ConnectorProvider { + provider := &ConnectorProvider{ + logger: logger, + config: config, + } + + err := provider.configure(metricsCollector, logger) + if err != nil { + logger.ErrorLog("connector_provider_configure_sources_error", err, nil) + return nil + } + + return provider +} + +func (c *ConnectorProvider) VinAllowed(vin string) (bool, error) { + if c.VinAllowedConnector == nil { + return true, nil + } + + return c.VinAllowedConnector.VinAllowed(vin) +} + +func (c *ConnectorProvider) Close() { + if c.Connectors.File != nil { + c.Connectors.File.Close() + } + if c.Connectors.Http != nil { + c.Connectors.Http.Close() + } + if c.Connectors.Redis != nil { + c.Connectors.Redis.Close() + } + if c.Connectors.Grpc != nil { + c.Connectors.Grpc.Close() + } +} + +func (c *ConnectorProvider) configure(metricsCollector metrics.MetricCollector, logger *logrus.Logger) error { + if c.config.File != nil && len(c.config.File.Capabilities) > 0 { + connector, err := file.NewConnector(*c.config.File, metricsCollector, logger) + if err == nil { + c.Connectors.File = connector + c.configureConnectorCapabilities(connector, c.config.File.Capabilities) + } else { + logger.ErrorLog("connector_provider_configure_sources_file_error", err, nil) + } + } + + if c.config.Grpc != nil && len(c.config.Grpc.Capabilities) > 0 { + connector, err := grpc.NewConnector(*c.config.Grpc, metricsCollector, logger) + if err == nil { + c.Connectors.Grpc = connector + c.configureConnectorCapabilities(connector, c.config.Grpc.Capabilities) + + } else { + logger.ErrorLog("connector_provider_configure_sources_grpc_error", err, nil) + } + } + + if c.config.Http != nil && len(c.config.Http.Capabilities) > 0 { + connector, err := http.NewConnector(c.config.Http, metricsCollector, logger) + if err == nil { + c.Connectors.Http = connector + c.configureConnectorCapabilities(connector, c.config.Http.Capabilities) + } else { + logger.ErrorLog("connector_provider_configure_sources_http_error", err, nil) + } + } + + if c.config.Redis != nil && len(c.config.Redis.Capabilities) > 0 { + connector, err := redis.NewConnector(*c.config.Redis, metricsCollector, logger) + if err == nil { + c.Connectors.Redis = connector + c.configureConnectorCapabilities(connector, c.config.Redis.Capabilities) + } else { + logger.ErrorLog("connector_provider_configure_sources_redis_error", err, nil) + } + } + + return nil +} + +func (c *ConnectorProvider) configureConnectorCapabilities(connector Connector, capabilities []string) { + for _, capability := range capabilities { + c.setCapabilityByName(capability, connector) + } +} + +func (c *ConnectorProvider) setCapabilityByName(name string, connector Connector) error { + switch name { + case "vin_allowed": + if c.VinAllowedConnector != nil { + c.logger.Log(logrus.WARN, "vin_allowed capability specified multiple times", logrus.LogInfo{}) + } + c.VinAllowedConnector = connector + default: + c.logger.Log(logrus.WARN, fmt.Sprintf("unknown capability %s", name), logrus.LogInfo{}) + } + return nil +} diff --git a/connector/connector_suite_test.go b/connector/connector_suite_test.go new file mode 100644 index 0000000..24a4881 --- /dev/null +++ b/connector/connector_suite_test.go @@ -0,0 +1,13 @@ +package connector_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestConfigs(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Connector") +} diff --git a/connector/connector_test.go b/connector/connector_test.go new file mode 100644 index 0000000..b292977 --- /dev/null +++ b/connector/connector_test.go @@ -0,0 +1,73 @@ +package connector_test + +import ( + "net/http" + "net/http/httptest" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/teslamotors/fleet-telemetry/connector" + "github.com/teslamotors/fleet-telemetry/connector/adapter/file" + "github.com/teslamotors/fleet-telemetry/connector/adapter/grpc" + httpConnector "github.com/teslamotors/fleet-telemetry/connector/adapter/http" + "github.com/teslamotors/fleet-telemetry/connector/adapter/redis" + logrus "github.com/teslamotors/fleet-telemetry/logger" + "github.com/teslamotors/fleet-telemetry/metrics" + "github.com/teslamotors/fleet-telemetry/metrics/adapter/noop" +) + +var _ = Describe("ConnectorProvider", func() { + var ( + config connector.Config + logger *logrus.Logger + metrics metrics.MetricCollector + connProvider *connector.ConnectorProvider + mockServer *httptest.Server + ) + + BeforeEach(func() { + mockServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{"allowed": true}`)) + })) + + config = connector.Config{ + File: &file.Config{}, + Grpc: &grpc.Config{}, + Redis: &redis.Config{}, + Http: &httpConnector.Config{ + Host: mockServer.URL, + Capabilities: []string{"vin_allowed"}, + }, + } + + logger, _ = logrus.NoOpLogger() + metrics = noop.NewCollector() + + connProvider = connector.NewConnectorProvider(config, metrics, logger) + Expect(connProvider).NotTo(BeNil()) + }) + + AfterEach(func() { + mockServer.Close() + }) + + It("gets data using configured source", func() { + allowed, err := connProvider.VinAllowed("testVin") + Expect(err).To(BeNil()) + Expect(allowed).To(BeTrue()) + }) + + Context("configuring sources", func() { + It("should not initialize unconfigured sources", func() { + Expect(connProvider.Connectors.File).To(BeNil()) + Expect(connProvider.Connectors.Grpc).To(BeNil()) + Expect(connProvider.Connectors.Redis).To(BeNil()) + }) + + It("should initialize configured source", func() { + Expect(connProvider.Connectors.Http).NotTo(BeNil()) + }) + }) +}) diff --git a/connector/util/cache.go b/connector/util/cache.go new file mode 100644 index 0000000..1d0caf7 --- /dev/null +++ b/connector/util/cache.go @@ -0,0 +1,82 @@ +package util + +import ( + "time" +) + +const ( + defaultTTL = time.Hour * 24 * 365 * 10 // 10 years +) + +type CacheValue[T any] struct { + Value T + Expires time.Time +} + +type Cache[T any] struct { + Data map[string]CacheValue[T] + doneChan chan interface{} + cleanupInterval time.Duration +} + +func NewCache[T any](cleanupInterval time.Duration) *Cache[T] { + done := make(chan interface{}) + cache := Cache[T]{ + Data: make(map[string]CacheValue[T]), + doneChan: done, + cleanupInterval: cleanupInterval, + } + + go func() { + timer := time.NewTicker(cleanupInterval) + defer timer.Stop() + + for { + select { + case <-timer.C: + cache.DeleteExpired() + case <-done: + return + } + } + }() + + return &cache +} + +func (c *Cache[T]) Get(key string) (*T, bool) { + v, ok := c.Data[key] + if !ok { + return nil, false + } + return &v.Value, ok +} + +func (c *Cache[T]) Set(key string, value T, ttl time.Duration) { + if ttl <= 0 { + ttl = defaultTTL + } + + c.Data[key] = CacheValue[T]{Value: value, Expires: time.Now().Add(ttl)} +} + +func (c *Cache[T]) Delete(key string) { + delete(c.Data, key) +} + +func (c *Cache[T]) Clear() { + c.Data = make(map[string]CacheValue[T]) +} + +func (c *Cache[T]) DeleteExpired() { + now := time.Now() + for k, v := range c.Data { + if v.Expires.Before(now) { + delete(c.Data, k) + } + } +} + +func (c *Cache[T]) Close() { + close(c.doneChan) +} diff --git a/connector/util/cache_test.go b/connector/util/cache_test.go new file mode 100644 index 0000000..057469b --- /dev/null +++ b/connector/util/cache_test.go @@ -0,0 +1,95 @@ +package util_test + +import ( + "time" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/teslamotors/fleet-telemetry/connector/util" +) + +var _ = Describe("Cache", func() { + var c *util.Cache[string] + + BeforeEach(func() { + c = util.NewCache[string](5 * time.Millisecond) + }) + + AfterEach(func() { + c.Close() + }) + + Describe("Set and Get", func() { + It("should store and retrieve a value", func() { + c.Set("key1", "value1", time.Minute) + val, ok := c.Get("key1") + Expect(ok).To(BeTrue()) + Expect(*val).To(Equal("value1")) + }) + + It("should return not ok for a non-existent key", func() { + _, ok := c.Get("non-existent") + Expect(ok).To(BeFalse()) + }) + }) + + Describe("Delete", func() { + It("should delete a value", func() { + c.Set("key1", "value1", time.Minute) + c.Delete("key1") + _, ok := c.Get("key1") + Expect(ok).To(BeFalse()) + }) + }) + + Describe("Clear", func() { + It("should clear all values", func() { + c.Set("key1", "value1", time.Minute) + c.Set("key2", "value2", time.Minute) + c.Clear() + _, ok1 := c.Get("key1") + _, ok2 := c.Get("key2") + Expect(ok1).To(BeFalse()) + Expect(ok2).To(BeFalse()) + }) + }) + + Describe("DeleteExpired", func() { + It("should delete expired values", func() { + c.Set("key1", "value1", time.Millisecond) + Eventually(func() bool { + _, ok := c.Get("key1") + return ok + }).Should(BeFalse()) + }) + + It("should not delete non-expired values", func() { + c.Set("key1", "value1", time.Minute) + c.DeleteExpired() + val, ok := c.Get("key1") + Expect(ok).To(BeTrue()) + Expect(*val).To(Equal("value1")) + }) + }) + + Describe("Close", func() { + JustAfterEach(func() { + // give the regular AfterEach a cache to close + c = util.NewCache[string](5 * time.Millisecond) + }) + + It("should stop the cleanup goroutine", func() { + c.Set("key1", "value1", time.Millisecond) + Eventually(func() bool { + _, ok := c.Get("key1") + return ok + }).Should(BeFalse()) + c.Close() + c.Set("key2", "value2", time.Minute) + time.Sleep(10 * time.Millisecond) + _, ok := c.Get("key2") + Expect(ok).To(BeTrue()) + }) + }) +}) diff --git a/connector/util/metric_labels.go b/connector/util/metric_labels.go new file mode 100644 index 0000000..8e1b512 --- /dev/null +++ b/connector/util/metric_labels.go @@ -0,0 +1,5 @@ +package util + +const ( + VinAllowed = "vin_allowed" +) diff --git a/connector/util/util_suite_test.go b/connector/util/util_suite_test.go new file mode 100644 index 0000000..c9edce3 --- /dev/null +++ b/connector/util/util_suite_test.go @@ -0,0 +1,13 @@ +package util_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestConfigs(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Data Connector Utils") +} diff --git a/docker-compose.yml b/docker-compose.yml index b98f888..c33a71f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,6 +33,8 @@ services: condition: service_started errbit: condition: service_healthy + redis: + condition: service_healthy zookeeper: image: confluentinc/cp-zookeeper:7.2.6 @@ -148,3 +150,13 @@ services: depends_on: prometheus: condition: service_started + + redis: + image: redis:7.0.15 + ports: + - "6379:6379" + healthcheck: + test: redis-cli ping + interval: 5s + timeout: 3s + retries: 3 diff --git a/examples/data.json b/examples/data.json new file mode 100644 index 0000000..3a96f1c --- /dev/null +++ b/examples/data.json @@ -0,0 +1,5 @@ +{ + "allowed_vins": [ + "VIN1" + ] +} diff --git a/examples/server_config.json b/examples/server_config.json index bc2dc43..e750991 100644 --- a/examples/server_config.json +++ b/examples/server_config.json @@ -26,6 +26,12 @@ "logger" ] }, + "data_connectors": { + "file": { + "capabilities": ["vin_allowed"], + "path": "examples/data.json" + } + }, "tls": { "server_cert": "/etc/certs/server/tls.crt", "server_key": "/etc/certs/server/tls.key" diff --git a/generate_protos.sh b/generate_protos.sh new file mode 100755 index 0000000..fb7ef7a --- /dev/null +++ b/generate_protos.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Generates protobuf in python, golang and ruby + +# python +python3 -m grpc_tools.protoc -I$PROTO_DIR --python_out=$PROTO_DIR/python $PROTO_DIR/*.proto +python3 -m grpc_tools.protoc -I$PROTO_DIR --grpc_python_out=$PROTO_DIR/python $PROTO_DIR/*_service.proto + +# golang +protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative $PROTO_DIR/*.proto + +# ruby +grpc_tools_ruby_protoc -I $PROTO_DIR --ruby_out=$PROTO_DIR/ruby/ --grpc_out=$PROTO_DIR/ruby/ $PROTO_DIR/*.proto diff --git a/go.mod b/go.mod index 89ecb19..38f5e46 100644 --- a/go.mod +++ b/go.mod @@ -3,41 +3,50 @@ module github.com/teslamotors/fleet-telemetry go 1.20 require ( - cloud.google.com/go/pubsub v1.30.0 + cloud.google.com/go/pubsub v1.36.1 github.com/airbrake/gobrake/v5 v5.6.1 github.com/aws/aws-sdk-go v1.44.278 github.com/beefsack/go-rate v0.0.0-20220214233405-116f4ca011a0 github.com/confluentinc/confluent-kafka-go/v2 v2.3.0 + github.com/fsnotify/fsnotify v1.7.0 + github.com/go-redis/redismock/v9 v9.2.0 + github.com/golang/protobuf v1.5.4 github.com/google/flatbuffers v23.3.3+incompatible - github.com/google/uuid v1.3.0 + github.com/google/uuid v1.6.0 github.com/gorilla/websocket v1.5.0 github.com/mattn/go-colorable v0.1.13 - github.com/onsi/ginkgo/v2 v2.4.0 - github.com/onsi/gomega v1.24.0 + github.com/onsi/ginkgo/v2 v2.7.0 + github.com/onsi/gomega v1.25.0 github.com/pebbe/zmq4 v1.2.10 github.com/prometheus/client_golang v1.14.0 + github.com/redis/go-redis/v9 v9.5.3 github.com/sirupsen/logrus v1.9.0 github.com/smira/go-statsd v1.3.2 go.uber.org/automaxprocs v1.5.2 - google.golang.org/api v0.114.0 - google.golang.org/protobuf v1.33.0 + go.uber.org/mock v0.4.0 + google.golang.org/api v0.169.0 + google.golang.org/grpc v1.64.0 + google.golang.org/protobuf v1.34.1 ) require ( - cloud.google.com/go v0.110.0 // indirect - cloud.google.com/go/compute v1.19.1 // indirect + cloud.google.com/go v0.112.1 // indirect + cloud.google.com/go/compute v1.25.1 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v0.13.0 // indirect + cloud.google.com/go/iam v1.1.6 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/caio/go-tdigest/v4 v4.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.5.9 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.8.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jonboulle/clockwork v0.3.0 // indirect github.com/kr/text v0.2.0 // indirect @@ -48,13 +57,21 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/net v0.23.0 // indirect - golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/grpc v1.56.3 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect + golang.org/x/crypto v0.24.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/time v0.5.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index af6515f..487f17a 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,15 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= -cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvuXY= -cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= +cloud.google.com/go v0.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= +cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= +cloud.google.com/go/compute v1.25.1 h1:ZRpHJedLtTpKgr3RV1Fx23NuaAEN1Zfx9hw1u4aJdjU= +cloud.google.com/go/compute v1.25.1/go.mod h1:oopOIR53ly6viBYxaDhBfJwzUAxf1zE//uf3IB011ls= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/iam v0.13.0 h1:+CmB+K0J/33d0zSQ9SlFWUeCCEn5XJA0ZMZ3pHE9u8k= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/kms v1.10.1 h1:7hm1bRqGCA1GBRQUrp831TwJ9TWhP+tvLuP497CQS2g= -cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= -cloud.google.com/go/pubsub v1.30.0 h1:vCge8m7aUKBJYOgrZp7EsNDf6QMd2CAlXZqWTn3yq6s= -cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4= +cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= +cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +cloud.google.com/go/kms v1.15.7 h1:7caV9K3yIxvlQPAcaFffhlT7d1qpxjB1wHBtjWa13SM= +cloud.google.com/go/pubsub v1.36.1 h1:dfEPuGCHGbWUhaMCTHUFjfroILEkx55iUmKBZTP5f+Y= +cloud.google.com/go/pubsub v1.36.1/go.mod h1:iYjCa9EzWOoBiTdd4ps7QoMtMln5NwaZQpK1hbRfBDE= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= @@ -23,6 +22,8 @@ github.com/beefsack/go-rate v0.0.0-20220214233405-116f4ca011a0 h1:0b2vaepXIfMsG+ github.com/beefsack/go-rate v0.0.0-20220214233405-116f4ca011a0/go.mod h1:6YNgTHLutezwnBvyneBbwvB8C82y3dcoOj5EQJIdGXA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/caio/go-tdigest/v4 v4.0.1 h1:sx4ZxjmIEcLROUPs2j1BGe2WhOtHD6VSe6NNbBdKYh4= github.com/caio/go-tdigest/v4 v4.0.1/go.mod h1:Wsa+f0EZnV2gShdj1adgl0tQSoXRxtM0QioTgukFw8U= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= @@ -40,6 +41,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= github.com/docker/docker v20.10.17+incompatible h1:JYCuMrWaVNophQTOrMMoSwudOVEfcegoZZrleKc1xwE= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= @@ -48,8 +51,17 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-redis/redismock/v9 v9.2.0 h1:ZrMYQeKPECZPjOj5u9eyOjg8Nnb0BS9lkVIZ6IpsKLw= +github.com/go-redis/redismock/v9 v9.2.0/go.mod h1:18KHfGDK4Y6c2R0H38EUGWAdc7ZQS9gfYxc94k7rWT0= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -57,7 +69,6 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -68,8 +79,9 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/flatbuffers v23.3.3+incompatible h1:5PJI/WbJkaMTvpGxsHVKG/LurN/KnWXNyGpwSCDgen0= github.com/google/flatbuffers v23.3.3+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -79,15 +91,17 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/gax-go/v2 v2.8.0 h1:UBtEZqx1bjXtOQ5BVTkuYghXrr3N4V123VKJK67vJZc= -github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/gax-go/v2 v2.12.2 h1:mhN09QQW1jEWeMF74zGR81R30z4VJzjZsfkUhuHF+DA= +github.com/googleapis/gax-go/v2 v2.12.2/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= @@ -111,10 +125,12 @@ github.com/moby/sys/mount v0.3.3 h1:fX1SVkXFJ47XWDoeFW4Sq7PdQJnV2QIDZAqjNqgEjUs= github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/onsi/ginkgo/v2 v2.4.0 h1:+Ig9nvqgS5OBSACXNk15PLdp0U9XPYROt9CFzVdFGIs= -github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= -github.com/onsi/gomega v1.24.0 h1:+0glovB9Jd6z3VR+ScSwQqXVTIfJcGA9UBM8yzQxhqg= -github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo/v2 v2.7.0 h1:/XxtEV3I3Eif/HobnVx9YmJgk8ENdRsuUmM+fLCFNow= +github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo= +github.com/onsi/gomega v1.25.0 h1:Vw7br2PCDYijJHSfBOWhov+8cAnUf8MfMaIOV323l6Y= +github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= @@ -134,6 +150,8 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/redis/go-redis/v9 v9.5.3 h1:fOAp1/uJG+ZtcITgZOfYFmTKPE7n4Vclj1wZFgRciUU= +github.com/redis/go-redis/v9 v9.5.3/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smira/go-statsd v1.3.2 h1:1EeuzxNZ/TD9apbTOFSM9nulqfcsQFmT4u1A2DREabI= @@ -145,16 +163,32 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/testcontainers/testcontainers-go v0.14.0 h1:h0D5GaYG9mhOWr2qHdEKDXpkce/VlvaYOCzTRi6UBi8= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.einride.tech/aip v0.66.0 h1:XfV+NQX6L7EOYK11yoHHFtndeaWh3KbD9/cN/6iWEt8= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.uber.org/automaxprocs v1.5.2 h1:2LxUOGiR3O6tw8ui5sZa2LAaHnsviZdVOUZw4fvbnME= go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -165,24 +199,23 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -194,18 +227,20 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -216,24 +251,28 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E= -google.golang.org/api v0.114.0 h1:1xQPji6cO2E2vLiI+C/XiFAnsn1WV3mjaEwGLhi3grE= -google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= +google.golang.org/api v0.169.0 h1:QwWPy71FgMWqJN/l6jVlFHUa29a7dcUy02I8o799nPY= +google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= +google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= +google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4= +google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= -google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -245,10 +284,11 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/protos/data_connector_service.pb.go b/protos/data_connector_service.pb.go new file mode 100644 index 0000000..dd5223a --- /dev/null +++ b/protos/data_connector_service.pb.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.25.1 +// source: protos/data_connector_service.proto + +package protos + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type VinAllowedRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Vin string `protobuf:"bytes,1,opt,name=Vin,proto3" json:"Vin,omitempty"` +} + +func (x *VinAllowedRequest) Reset() { + *x = VinAllowedRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_protos_data_connector_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VinAllowedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VinAllowedRequest) ProtoMessage() {} + +func (x *VinAllowedRequest) ProtoReflect() protoreflect.Message { + mi := &file_protos_data_connector_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VinAllowedRequest.ProtoReflect.Descriptor instead. +func (*VinAllowedRequest) Descriptor() ([]byte, []int) { + return file_protos_data_connector_service_proto_rawDescGZIP(), []int{0} +} + +func (x *VinAllowedRequest) GetVin() string { + if x != nil { + return x.Vin + } + return "" +} + +type VinAllowedResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Allowed bool `protobuf:"varint,1,opt,name=Allowed,proto3" json:"Allowed,omitempty"` +} + +func (x *VinAllowedResponse) Reset() { + *x = VinAllowedResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_protos_data_connector_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VinAllowedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VinAllowedResponse) ProtoMessage() {} + +func (x *VinAllowedResponse) ProtoReflect() protoreflect.Message { + mi := &file_protos_data_connector_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VinAllowedResponse.ProtoReflect.Descriptor instead. +func (*VinAllowedResponse) Descriptor() ([]byte, []int) { + return file_protos_data_connector_service_proto_rawDescGZIP(), []int{1} +} + +func (x *VinAllowedResponse) GetAllowed() bool { + if x != nil { + return x.Allowed + } + return false +} + +var File_protos_data_connector_service_proto protoreflect.FileDescriptor + +var file_protos_data_connector_service_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x22, 0x25, 0x0a, 0x11, 0x56, + 0x69, 0x6e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x10, 0x0a, 0x03, 0x56, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x56, + 0x69, 0x6e, 0x22, 0x2e, 0x0a, 0x12, 0x56, 0x69, 0x6e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x6c, 0x6c, 0x6f, + 0x77, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x41, 0x6c, 0x6c, 0x6f, 0x77, + 0x65, 0x64, 0x32, 0x71, 0x0a, 0x0e, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x0a, 0x56, 0x69, 0x6e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, + 0x65, 0x64, 0x12, 0x27, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x2e, 0x56, 0x69, 0x6e, 0x41, 0x6c, 0x6c, + 0x6f, 0x77, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x74, 0x65, + 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x73, 0x2e, 0x56, 0x69, 0x6e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x73, 0x6c, 0x61, 0x6d, 0x6f, 0x74, 0x6f, 0x72, 0x73, 0x2f, + 0x66, 0x6c, 0x65, 0x65, 0x74, 0x2d, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_protos_data_connector_service_proto_rawDescOnce sync.Once + file_protos_data_connector_service_proto_rawDescData = file_protos_data_connector_service_proto_rawDesc +) + +func file_protos_data_connector_service_proto_rawDescGZIP() []byte { + file_protos_data_connector_service_proto_rawDescOnce.Do(func() { + file_protos_data_connector_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_protos_data_connector_service_proto_rawDescData) + }) + return file_protos_data_connector_service_proto_rawDescData +} + +var file_protos_data_connector_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_protos_data_connector_service_proto_goTypes = []interface{}{ + (*VinAllowedRequest)(nil), // 0: telemetry.connectors.VinAllowedRequest + (*VinAllowedResponse)(nil), // 1: telemetry.connectors.VinAllowedResponse +} +var file_protos_data_connector_service_proto_depIdxs = []int32{ + 0, // 0: telemetry.connectors.VehicleService.VinAllowed:input_type -> telemetry.connectors.VinAllowedRequest + 1, // 1: telemetry.connectors.VehicleService.VinAllowed:output_type -> telemetry.connectors.VinAllowedResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_protos_data_connector_service_proto_init() } +func file_protos_data_connector_service_proto_init() { + if File_protos_data_connector_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_protos_data_connector_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VinAllowedRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_protos_data_connector_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VinAllowedResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_protos_data_connector_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_protos_data_connector_service_proto_goTypes, + DependencyIndexes: file_protos_data_connector_service_proto_depIdxs, + MessageInfos: file_protos_data_connector_service_proto_msgTypes, + }.Build() + File_protos_data_connector_service_proto = out.File + file_protos_data_connector_service_proto_rawDesc = nil + file_protos_data_connector_service_proto_goTypes = nil + file_protos_data_connector_service_proto_depIdxs = nil +} diff --git a/protos/data_connector_service.proto b/protos/data_connector_service.proto new file mode 100644 index 0000000..49da584 --- /dev/null +++ b/protos/data_connector_service.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package telemetry.connectors; + +option go_package = "github.com/teslamotors/fleet-telemetry/protos"; + +service VehicleService { + rpc VinAllowed(VinAllowedRequest) returns (VinAllowedResponse); +} + +message VinAllowedRequest { + string Vin = 1; +} + +message VinAllowedResponse { + bool Allowed = 1; +} diff --git a/protos/data_connector_service_grpc.pb.go b/protos/data_connector_service_grpc.pb.go new file mode 100644 index 0000000..f4813d1 --- /dev/null +++ b/protos/data_connector_service_grpc.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.25.1 +// source: protos/data_connector_service.proto + +package protos + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// VehicleServiceClient is the client API for VehicleService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type VehicleServiceClient interface { + VinAllowed(ctx context.Context, in *VinAllowedRequest, opts ...grpc.CallOption) (*VinAllowedResponse, error) +} + +type vehicleServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewVehicleServiceClient(cc grpc.ClientConnInterface) VehicleServiceClient { + return &vehicleServiceClient{cc} +} + +func (c *vehicleServiceClient) VinAllowed(ctx context.Context, in *VinAllowedRequest, opts ...grpc.CallOption) (*VinAllowedResponse, error) { + out := new(VinAllowedResponse) + err := c.cc.Invoke(ctx, "/telemetry.connectors.VehicleService/VinAllowed", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// VehicleServiceServer is the server API for VehicleService service. +// All implementations must embed UnimplementedVehicleServiceServer +// for forward compatibility +type VehicleServiceServer interface { + VinAllowed(context.Context, *VinAllowedRequest) (*VinAllowedResponse, error) + mustEmbedUnimplementedVehicleServiceServer() +} + +// UnimplementedVehicleServiceServer must be embedded to have forward compatible implementations. +type UnimplementedVehicleServiceServer struct { +} + +func (UnimplementedVehicleServiceServer) VinAllowed(context.Context, *VinAllowedRequest) (*VinAllowedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VinAllowed not implemented") +} +func (UnimplementedVehicleServiceServer) mustEmbedUnimplementedVehicleServiceServer() {} + +// UnsafeVehicleServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to VehicleServiceServer will +// result in compilation errors. +type UnsafeVehicleServiceServer interface { + mustEmbedUnimplementedVehicleServiceServer() +} + +func RegisterVehicleServiceServer(s grpc.ServiceRegistrar, srv VehicleServiceServer) { + s.RegisterService(&VehicleService_ServiceDesc, srv) +} + +func _VehicleService_VinAllowed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VinAllowedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VehicleServiceServer).VinAllowed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/telemetry.connectors.VehicleService/VinAllowed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VehicleServiceServer).VinAllowed(ctx, req.(*VinAllowedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// VehicleService_ServiceDesc is the grpc.ServiceDesc for VehicleService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var VehicleService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "telemetry.connectors.VehicleService", + HandlerType: (*VehicleServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "VinAllowed", + Handler: _VehicleService_VinAllowed_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "protos/data_connector_service.proto", +} diff --git a/protos/python/data_connector_service_pb2.py b/protos/python/data_connector_service_pb2.py new file mode 100644 index 0000000..f44fb7a --- /dev/null +++ b/protos/python/data_connector_service_pb2.py @@ -0,0 +1,134 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: data_connector_service.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='data_connector_service.proto', + package='telemetry.connectors', + syntax='proto3', + serialized_pb=_b('\n\x1c\x64\x61ta_connector_service.proto\x12\x14telemetry.connectors\" \n\x11VinAllowedRequest\x12\x0b\n\x03Vin\x18\x01 \x01(\t\"%\n\x12VinAllowedResponse\x12\x0f\n\x07\x41llowed\x18\x01 \x01(\x08\x32q\n\x0eVehicleService\x12_\n\nVinAllowed\x12\'.telemetry.connectors.VinAllowedRequest\x1a(.telemetry.connectors.VinAllowedResponseB/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3') +) + + + + +_VINALLOWEDREQUEST = _descriptor.Descriptor( + name='VinAllowedRequest', + full_name='telemetry.connectors.VinAllowedRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Vin', full_name='telemetry.connectors.VinAllowedRequest.Vin', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=54, + serialized_end=86, +) + + +_VINALLOWEDRESPONSE = _descriptor.Descriptor( + name='VinAllowedResponse', + full_name='telemetry.connectors.VinAllowedResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Allowed', full_name='telemetry.connectors.VinAllowedResponse.Allowed', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=88, + serialized_end=125, +) + +DESCRIPTOR.message_types_by_name['VinAllowedRequest'] = _VINALLOWEDREQUEST +DESCRIPTOR.message_types_by_name['VinAllowedResponse'] = _VINALLOWEDRESPONSE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +VinAllowedRequest = _reflection.GeneratedProtocolMessageType('VinAllowedRequest', (_message.Message,), dict( + DESCRIPTOR = _VINALLOWEDREQUEST, + __module__ = 'data_connector_service_pb2' + # @@protoc_insertion_point(class_scope:telemetry.connectors.VinAllowedRequest) + )) +_sym_db.RegisterMessage(VinAllowedRequest) + +VinAllowedResponse = _reflection.GeneratedProtocolMessageType('VinAllowedResponse', (_message.Message,), dict( + DESCRIPTOR = _VINALLOWEDRESPONSE, + __module__ = 'data_connector_service_pb2' + # @@protoc_insertion_point(class_scope:telemetry.connectors.VinAllowedResponse) + )) +_sym_db.RegisterMessage(VinAllowedResponse) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z-github.com/teslamotors/fleet-telemetry/protos')) + +_VEHICLESERVICE = _descriptor.ServiceDescriptor( + name='VehicleService', + full_name='telemetry.connectors.VehicleService', + file=DESCRIPTOR, + index=0, + options=None, + serialized_start=127, + serialized_end=240, + methods=[ + _descriptor.MethodDescriptor( + name='VinAllowed', + full_name='telemetry.connectors.VehicleService.VinAllowed', + index=0, + containing_service=None, + input_type=_VINALLOWEDREQUEST, + output_type=_VINALLOWEDRESPONSE, + options=None, + ), +]) +_sym_db.RegisterServiceDescriptor(_VEHICLESERVICE) + +DESCRIPTOR.services_by_name['VehicleService'] = _VEHICLESERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/protos/python/data_connector_service_pb2_grpc.py b/protos/python/data_connector_service_pb2_grpc.py new file mode 100644 index 0000000..3b30cc7 --- /dev/null +++ b/protos/python/data_connector_service_pb2_grpc.py @@ -0,0 +1,46 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + +import data_connector_service_pb2 as data__connector__service__pb2 + + +class VehicleServiceStub(object): + # missing associated documentation comment in .proto file + pass + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.VinAllowed = channel.unary_unary( + '/telemetry.connectors.VehicleService/VinAllowed', + request_serializer=data__connector__service__pb2.VinAllowedRequest.SerializeToString, + response_deserializer=data__connector__service__pb2.VinAllowedResponse.FromString, + ) + + +class VehicleServiceServicer(object): + # missing associated documentation comment in .proto file + pass + + def VinAllowed(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_VehicleServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'VinAllowed': grpc.unary_unary_rpc_method_handler( + servicer.VinAllowed, + request_deserializer=data__connector__service__pb2.VinAllowedRequest.FromString, + response_serializer=data__connector__service__pb2.VinAllowedResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'telemetry.connectors.VehicleService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/protos/python/vehicle_alert_pb2.py b/protos/python/vehicle_alert_pb2.py index 4d876e5..59717cf 100644 --- a/protos/python/vehicle_alert_pb2.py +++ b/protos/python/vehicle_alert_pb2.py @@ -1,12 +1,14 @@ -# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: vehicle_alert.proto -# Protobuf Python Version: 4.25.1 -"""Generated protocol buffer code.""" + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder +from google.protobuf import descriptor_pb2 # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -15,18 +17,173 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13vehicle_alert.proto\x12\x18telemetry.vehicle_alerts\x1a\x1fgoogle/protobuf/timestamp.proto\"\x84\x01\n\rVehicleAlerts\x12\x36\n\x06\x61lerts\x18\x01 \x03(\x0b\x32&.telemetry.vehicle_alerts.VehicleAlert\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\xb1\x01\n\x0cVehicleAlert\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x35\n\taudiences\x18\x02 \x03(\x0e\x32\".telemetry.vehicle_alerts.Audience\x12.\n\nstarted_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nded_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp*B\n\x08\x41udience\x12\x0b\n\x07Unknown\x10\x00\x12\x0c\n\x08\x43ustomer\x10\x01\x12\x0b\n\x07Service\x10\x02\x12\x0e\n\nServiceFix\x10\x03\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'vehicle_alert_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None - _globals['DESCRIPTOR']._serialized_options = b'Z-github.com/teslamotors/fleet-telemetry/protos' - _globals['_AUDIENCE']._serialized_start=397 - _globals['_AUDIENCE']._serialized_end=463 - _globals['_VEHICLEALERTS']._serialized_start=83 - _globals['_VEHICLEALERTS']._serialized_end=215 - _globals['_VEHICLEALERT']._serialized_start=218 - _globals['_VEHICLEALERT']._serialized_end=395 +DESCRIPTOR = _descriptor.FileDescriptor( + name='vehicle_alert.proto', + package='telemetry.vehicle_alerts', + syntax='proto3', + serialized_pb=_b('\n\x13vehicle_alert.proto\x12\x18telemetry.vehicle_alerts\x1a\x1fgoogle/protobuf/timestamp.proto\"\x84\x01\n\rVehicleAlerts\x12\x36\n\x06\x61lerts\x18\x01 \x03(\x0b\x32&.telemetry.vehicle_alerts.VehicleAlert\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\xb1\x01\n\x0cVehicleAlert\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x35\n\taudiences\x18\x02 \x03(\x0e\x32\".telemetry.vehicle_alerts.Audience\x12.\n\nstarted_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nded_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp*B\n\x08\x41udience\x12\x0b\n\x07Unknown\x10\x00\x12\x0c\n\x08\x43ustomer\x10\x01\x12\x0b\n\x07Service\x10\x02\x12\x0e\n\nServiceFix\x10\x03\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3') + , + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) + +_AUDIENCE = _descriptor.EnumDescriptor( + name='Audience', + full_name='telemetry.vehicle_alerts.Audience', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='Unknown', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Customer', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Service', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ServiceFix', index=3, number=3, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=397, + serialized_end=463, +) +_sym_db.RegisterEnumDescriptor(_AUDIENCE) + +Audience = enum_type_wrapper.EnumTypeWrapper(_AUDIENCE) +Unknown = 0 +Customer = 1 +Service = 2 +ServiceFix = 3 + + + +_VEHICLEALERTS = _descriptor.Descriptor( + name='VehicleAlerts', + full_name='telemetry.vehicle_alerts.VehicleAlerts', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='alerts', full_name='telemetry.vehicle_alerts.VehicleAlerts.alerts', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='created_at', full_name='telemetry.vehicle_alerts.VehicleAlerts.created_at', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='vin', full_name='telemetry.vehicle_alerts.VehicleAlerts.vin', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=83, + serialized_end=215, +) + + +_VEHICLEALERT = _descriptor.Descriptor( + name='VehicleAlert', + full_name='telemetry.vehicle_alerts.VehicleAlert', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='telemetry.vehicle_alerts.VehicleAlert.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='audiences', full_name='telemetry.vehicle_alerts.VehicleAlert.audiences', index=1, + number=2, type=14, cpp_type=8, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='started_at', full_name='telemetry.vehicle_alerts.VehicleAlert.started_at', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='ended_at', full_name='telemetry.vehicle_alerts.VehicleAlert.ended_at', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=218, + serialized_end=395, +) + +_VEHICLEALERTS.fields_by_name['alerts'].message_type = _VEHICLEALERT +_VEHICLEALERTS.fields_by_name['created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_VEHICLEALERT.fields_by_name['audiences'].enum_type = _AUDIENCE +_VEHICLEALERT.fields_by_name['started_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_VEHICLEALERT.fields_by_name['ended_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +DESCRIPTOR.message_types_by_name['VehicleAlerts'] = _VEHICLEALERTS +DESCRIPTOR.message_types_by_name['VehicleAlert'] = _VEHICLEALERT +DESCRIPTOR.enum_types_by_name['Audience'] = _AUDIENCE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +VehicleAlerts = _reflection.GeneratedProtocolMessageType('VehicleAlerts', (_message.Message,), dict( + DESCRIPTOR = _VEHICLEALERTS, + __module__ = 'vehicle_alert_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_alerts.VehicleAlerts) + )) +_sym_db.RegisterMessage(VehicleAlerts) + +VehicleAlert = _reflection.GeneratedProtocolMessageType('VehicleAlert', (_message.Message,), dict( + DESCRIPTOR = _VEHICLEALERT, + __module__ = 'vehicle_alert_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_alerts.VehicleAlert) + )) +_sym_db.RegisterMessage(VehicleAlert) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z-github.com/teslamotors/fleet-telemetry/protos')) # @@protoc_insertion_point(module_scope) diff --git a/protos/python/vehicle_data_pb2.py b/protos/python/vehicle_data_pb2.py index 16794fc..8eda89e 100644 --- a/protos/python/vehicle_data_pb2.py +++ b/protos/python/vehicle_data_pb2.py @@ -1,12 +1,14 @@ -# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: vehicle_data.proto -# Protobuf Python Version: 4.25.1 -"""Generated protocol buffer code.""" + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder +from google.protobuf import descriptor_pb2 # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -15,26 +17,1309 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12vehicle_data.proto\x12\x16telemetry.vehicle_data\x1a\x1fgoogle/protobuf/timestamp.proto\"4\n\rLocationValue\x12\x10\n\x08latitude\x18\x01 \x01(\x01\x12\x11\n\tlongitude\x18\x02 \x01(\x01\"\xde\x02\n\x05Value\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x13\n\tint_value\x18\x02 \x01(\x05H\x00\x12\x14\n\nlong_value\x18\x03 \x01(\x03H\x00\x12\x15\n\x0b\x66loat_value\x18\x04 \x01(\x02H\x00\x12\x16\n\x0c\x64ouble_value\x18\x05 \x01(\x01H\x00\x12\x17\n\rboolean_value\x18\x06 \x01(\x08H\x00\x12?\n\x0elocation_value\x18\x07 \x01(\x0b\x32%.telemetry.vehicle_data.LocationValueH\x00\x12?\n\x0e\x63harging_value\x18\x08 \x01(\x0e\x32%.telemetry.vehicle_data.ChargingStateH\x00\x12?\n\x11shift_state_value\x18\t \x01(\x0e\x32\".telemetry.vehicle_data.ShiftStateH\x00\x42\x07\n\x05value\"a\n\x05\x44\x61tum\x12*\n\x03key\x18\x01 \x01(\x0e\x32\x1d.telemetry.vehicle_data.Field\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.telemetry.vehicle_data.Value\"s\n\x07Payload\x12+\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32\x1d.telemetry.vehicle_data.Datum\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t*\xe7\x1e\n\x05\x46ield\x12\x0b\n\x07Unknown\x10\x00\x12\r\n\tDriveRail\x10\x01\x12\x0f\n\x0b\x43hargeState\x10\x02\x12\x19\n\x15\x42msFullchargecomplete\x10\x03\x12\x10\n\x0cVehicleSpeed\x10\x04\x12\x0c\n\x08Odometer\x10\x05\x12\x0f\n\x0bPackVoltage\x10\x06\x12\x0f\n\x0bPackCurrent\x10\x07\x12\x07\n\x03Soc\x10\x08\x12\x0e\n\nDCDCEnable\x10\t\x12\x08\n\x04Gear\x10\n\x12\x17\n\x13IsolationResistance\x10\x0b\x12\x11\n\rPedalPosition\x10\x0c\x12\x0e\n\nBrakePedal\x10\r\x12\x0c\n\x08\x44iStateR\x10\x0e\x12\x10\n\x0c\x44iHeatsinkTR\x10\x0f\x12\x10\n\x0c\x44iAxleSpeedR\x10\x10\x12\x11\n\rDiTorquemotor\x10\x11\x12\x11\n\rDiStatorTempR\x10\x12\x12\x0b\n\x07\x44iVBatR\x10\x13\x12\x13\n\x0f\x44iMotorCurrentR\x10\x14\x12\x0c\n\x08Location\x10\x15\x12\x0c\n\x08GpsState\x10\x16\x12\x0e\n\nGpsHeading\x10\x17\x12\x16\n\x12NumBrickVoltageMax\x10\x18\x12\x13\n\x0f\x42rickVoltageMax\x10\x19\x12\x16\n\x12NumBrickVoltageMin\x10\x1a\x12\x13\n\x0f\x42rickVoltageMin\x10\x1b\x12\x14\n\x10NumModuleTempMax\x10\x1c\x12\x11\n\rModuleTempMax\x10\x1d\x12\x14\n\x10NumModuleTempMin\x10\x1e\x12\x11\n\rModuleTempMin\x10\x1f\x12\x0e\n\nRatedRange\x10 \x12\x08\n\x04Hvil\x10!\x12\x16\n\x12\x44\x43\x43hargingEnergyIn\x10\"\x12\x13\n\x0f\x44\x43\x43hargingPower\x10#\x12\x16\n\x12\x41\x43\x43hargingEnergyIn\x10$\x12\x13\n\x0f\x41\x43\x43hargingPower\x10%\x12\x12\n\x0e\x43hargeLimitSoc\x10&\x12\x16\n\x12\x46\x61stChargerPresent\x10\'\x12\x13\n\x0f\x45stBatteryRange\x10(\x12\x15\n\x11IdealBatteryRange\x10)\x12\x10\n\x0c\x42\x61tteryLevel\x10*\x12\x14\n\x10TimeToFullCharge\x10+\x12\x1e\n\x1aScheduledChargingStartTime\x10,\x12\x1c\n\x18ScheduledChargingPending\x10-\x12\x1a\n\x16ScheduledDepartureTime\x10.\x12\x1a\n\x16PreconditioningEnabled\x10/\x12\x19\n\x15ScheduledChargingMode\x10\x30\x12\x0e\n\nChargeAmps\x10\x31\x12\x17\n\x13\x43hargeEnableRequest\x10\x32\x12\x11\n\rChargerPhases\x10\x33\x12\x1d\n\x19\x43hargePortColdWeatherMode\x10\x34\x12\x18\n\x14\x43hargeCurrentRequest\x10\x35\x12\x1b\n\x17\x43hargeCurrentRequestMax\x10\x36\x12\x13\n\x0f\x42\x61tteryHeaterOn\x10\x37\x12\x18\n\x14NotEnoughPowerToHeat\x10\x38\x12\"\n\x1eSuperchargerSessionTripPlanner\x10\x39\x12\r\n\tDoorState\x10:\x12\n\n\x06Locked\x10;\x12\x0c\n\x08\x46\x64Window\x10<\x12\x0c\n\x08\x46pWindow\x10=\x12\x0c\n\x08RdWindow\x10>\x12\x0c\n\x08RpWindow\x10?\x12\x0f\n\x0bVehicleName\x10@\x12\x0e\n\nSentryMode\x10\x41\x12\x12\n\x0eSpeedLimitMode\x10\x42\x12\x13\n\x0f\x43urrentLimitMph\x10\x43\x12\x0b\n\x07Version\x10\x44\x12\x12\n\x0eTpmsPressureFl\x10\x45\x12\x12\n\x0eTpmsPressureFr\x10\x46\x12\x12\n\x0eTpmsPressureRl\x10G\x12\x12\n\x0eTpmsPressureRr\x10H\x12\x1e\n\x1aSemitruckTpmsPressureRe1L0\x10I\x12\x1e\n\x1aSemitruckTpmsPressureRe1L1\x10J\x12\x1e\n\x1aSemitruckTpmsPressureRe1R0\x10K\x12\x1e\n\x1aSemitruckTpmsPressureRe1R1\x10L\x12\x1e\n\x1aSemitruckTpmsPressureRe2L0\x10M\x12\x1e\n\x1aSemitruckTpmsPressureRe2L1\x10N\x12\x1e\n\x1aSemitruckTpmsPressureRe2R0\x10O\x12\x1e\n\x1aSemitruckTpmsPressureRe2R1\x10P\x12\x1e\n\x1aTpmsLastSeenPressureTimeFl\x10Q\x12\x1e\n\x1aTpmsLastSeenPressureTimeFr\x10R\x12\x1e\n\x1aTpmsLastSeenPressureTimeRl\x10S\x12\x1e\n\x1aTpmsLastSeenPressureTimeRr\x10T\x12\x0e\n\nInsideTemp\x10U\x12\x0f\n\x0bOutsideTemp\x10V\x12\x12\n\x0eSeatHeaterLeft\x10W\x12\x13\n\x0fSeatHeaterRight\x10X\x12\x16\n\x12SeatHeaterRearLeft\x10Y\x12\x17\n\x13SeatHeaterRearRight\x10Z\x12\x18\n\x14SeatHeaterRearCenter\x10[\x12\x17\n\x13\x41utoSeatClimateLeft\x10\\\x12\x18\n\x14\x41utoSeatClimateRight\x10]\x12\x12\n\x0e\x44riverSeatBelt\x10^\x12\x15\n\x11PassengerSeatBelt\x10_\x12\x16\n\x12\x44riverSeatOccupied\x10`\x12&\n\"SemitruckPassengerSeatFoldPosition\x10\x61\x12\x17\n\x13LateralAcceleration\x10\x62\x12\x1c\n\x18LongitudinalAcceleration\x10\x63\x12\x0f\n\x0b\x43ruiseState\x10\x64\x12\x12\n\x0e\x43ruiseSetSpeed\x10\x65\x12\x16\n\x12LifetimeEnergyUsed\x10\x66\x12\x1b\n\x17LifetimeEnergyUsedDrive\x10g\x12#\n\x1fSemitruckTractorParkBrakeStatus\x10h\x12#\n\x1fSemitruckTrailerParkBrakeStatus\x10i\x12\x11\n\rBrakePedalPos\x10j\x12\x14\n\x10RouteLastUpdated\x10k\x12\r\n\tRouteLine\x10l\x12\x12\n\x0eMilesToArrival\x10m\x12\x14\n\x10MinutesToArrival\x10n\x12\x12\n\x0eOriginLocation\x10o\x12\x17\n\x13\x44\x65stinationLocation\x10p\x12\x0b\n\x07\x43\x61rType\x10q\x12\x08\n\x04Trim\x10r\x12\x11\n\rExteriorColor\x10s\x12\r\n\tRoofColor\x10t\x12\x0e\n\nChargePort\x10u\x12\x13\n\x0f\x43hargePortLatch\x10v\x12\x12\n\x0e\x45xperimental_1\x10w\x12\x12\n\x0e\x45xperimental_2\x10x\x12\x12\n\x0e\x45xperimental_3\x10y\x12\x12\n\x0e\x45xperimental_4\x10z\x12\x14\n\x10GuestModeEnabled\x10{\x12\x15\n\x11PinToDriveEnabled\x10|\x12\x1e\n\x1aPairedPhoneKeyAndKeyFobQty\x10}\x12\x18\n\x14\x43ruiseFollowDistance\x10~\x12\x1c\n\x18\x41utomaticBlindSpotCamera\x10\x7f\x12#\n\x1e\x42lindSpotCollisionWarningChime\x10\x80\x01\x12\x16\n\x11SpeedLimitWarning\x10\x81\x01\x12\x1c\n\x17\x46orwardCollisionWarning\x10\x82\x01\x12\x1b\n\x16LaneDepartureAvoidance\x10\x83\x01\x12$\n\x1f\x45mergencyLaneDepartureAvoidance\x10\x84\x01\x12!\n\x1c\x41utomaticEmergencyBrakingOff\x10\x85\x01\x12\x1e\n\x19LifetimeEnergyGainedRegen\x10\x86\x01\x12\r\n\x08\x44iStateF\x10\x87\x01\x12\x0f\n\nDiStateREL\x10\x88\x01\x12\x0f\n\nDiStateRER\x10\x89\x01\x12\x11\n\x0c\x44iHeatsinkTF\x10\x8a\x01\x12\x13\n\x0e\x44iHeatsinkTREL\x10\x8b\x01\x12\x13\n\x0e\x44iHeatsinkTRER\x10\x8c\x01\x12\x11\n\x0c\x44iAxleSpeedF\x10\x8d\x01\x12\x13\n\x0e\x44iAxleSpeedREL\x10\x8e\x01\x12\x13\n\x0e\x44iAxleSpeedRER\x10\x8f\x01\x12\x15\n\x10\x44iSlaveTorqueCmd\x10\x90\x01\x12\x14\n\x0f\x44iTorqueActualR\x10\x91\x01\x12\x14\n\x0f\x44iTorqueActualF\x10\x92\x01\x12\x16\n\x11\x44iTorqueActualREL\x10\x93\x01\x12\x16\n\x11\x44iTorqueActualRER\x10\x94\x01\x12\x12\n\rDiStatorTempF\x10\x95\x01\x12\x14\n\x0f\x44iStatorTempREL\x10\x96\x01\x12\x14\n\x0f\x44iStatorTempRER\x10\x97\x01\x12\x0c\n\x07\x44iVBatF\x10\x98\x01\x12\x0e\n\tDiVBatREL\x10\x99\x01\x12\x0e\n\tDiVBatRER\x10\x9a\x01\x12\x14\n\x0f\x44iMotorCurrentF\x10\x9b\x01\x12\x16\n\x11\x44iMotorCurrentREL\x10\x9c\x01\x12\x16\n\x11\x44iMotorCurrentRER\x10\x9d\x01\x12\x14\n\x0f\x45nergyRemaining\x10\x9e\x01\x12\x10\n\x0bServiceMode\x10\x9f\x01\x12\r\n\x08\x42MSState\x10\xa0\x01\x12\x1f\n\x1aGuestModeMobileAccessState\x10\xa1\x01\x12\x11\n\x0c\x44\x65precated_1\x10\xa2\x01\x12\x14\n\x0f\x44\x65stinationName\x10\xa3\x01\x12\x11\n\x0c\x44iInverterTR\x10\xa4\x01\x12\x11\n\x0c\x44iInverterTF\x10\xa5\x01\x12\x13\n\x0e\x44iInverterTREL\x10\xa6\x01\x12\x13\n\x0e\x44iInverterTRER\x10\xa7\x01\x12\x13\n\x0e\x45xperimental_5\x10\xa8\x01\x12\x13\n\x0e\x45xperimental_6\x10\xa9\x01\x12\x13\n\x0e\x45xperimental_7\x10\xaa\x01\x12\x13\n\x0e\x45xperimental_8\x10\xab\x01\x12\x13\n\x0e\x45xperimental_9\x10\xac\x01\x12\x14\n\x0f\x45xperimental_10\x10\xad\x01\x12\x14\n\x0f\x45xperimental_11\x10\xae\x01\x12\x14\n\x0f\x45xperimental_12\x10\xaf\x01\x12\x14\n\x0f\x45xperimental_13\x10\xb0\x01\x12\x14\n\x0f\x45xperimental_14\x10\xb1\x01\x12\x14\n\x0f\x45xperimental_15\x10\xb2\x01*\xbf\x01\n\rChargingState\x12\x16\n\x12\x43hargeStateUnknown\x10\x00\x12\x1b\n\x17\x43hargeStateDisconnected\x10\x01\x12\x16\n\x12\x43hargeStateNoPower\x10\x02\x12\x17\n\x13\x43hargeStateStarting\x10\x03\x12\x17\n\x13\x43hargeStateCharging\x10\x04\x12\x17\n\x13\x43hargeStateComplete\x10\x05\x12\x16\n\x12\x43hargeStateStopped\x10\x06*\x91\x01\n\nShiftState\x12\x15\n\x11ShiftStateUnknown\x10\x00\x12\x15\n\x11ShiftStateInvalid\x10\x01\x12\x0f\n\x0bShiftStateP\x10\x02\x12\x0f\n\x0bShiftStateR\x10\x03\x12\x0f\n\x0bShiftStateD\x10\x04\x12\x0f\n\x0bShiftStateN\x10\x05\x12\x11\n\rShiftStateSNA\x10\x06\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'vehicle_data_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None - _globals['DESCRIPTOR']._serialized_options = b'Z-github.com/teslamotors/fleet-telemetry/protos' - _globals['_FIELD']._serialized_start=703 - _globals['_FIELD']._serialized_end=4646 - _globals['_CHARGINGSTATE']._serialized_start=4649 - _globals['_CHARGINGSTATE']._serialized_end=4840 - _globals['_SHIFTSTATE']._serialized_start=4843 - _globals['_SHIFTSTATE']._serialized_end=4988 - _globals['_LOCATIONVALUE']._serialized_start=79 - _globals['_LOCATIONVALUE']._serialized_end=131 - _globals['_VALUE']._serialized_start=134 - _globals['_VALUE']._serialized_end=484 - _globals['_DATUM']._serialized_start=486 - _globals['_DATUM']._serialized_end=583 - _globals['_PAYLOAD']._serialized_start=585 - _globals['_PAYLOAD']._serialized_end=700 +DESCRIPTOR = _descriptor.FileDescriptor( + name='vehicle_data.proto', + package='telemetry.vehicle_data', + syntax='proto3', + serialized_pb=_b('\n\x12vehicle_data.proto\x12\x16telemetry.vehicle_data\x1a\x1fgoogle/protobuf/timestamp.proto\"4\n\rLocationValue\x12\x10\n\x08latitude\x18\x01 \x01(\x01\x12\x11\n\tlongitude\x18\x02 \x01(\x01\"\xde\x02\n\x05Value\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x13\n\tint_value\x18\x02 \x01(\x05H\x00\x12\x14\n\nlong_value\x18\x03 \x01(\x03H\x00\x12\x15\n\x0b\x66loat_value\x18\x04 \x01(\x02H\x00\x12\x16\n\x0c\x64ouble_value\x18\x05 \x01(\x01H\x00\x12\x17\n\rboolean_value\x18\x06 \x01(\x08H\x00\x12?\n\x0elocation_value\x18\x07 \x01(\x0b\x32%.telemetry.vehicle_data.LocationValueH\x00\x12?\n\x0e\x63harging_value\x18\x08 \x01(\x0e\x32%.telemetry.vehicle_data.ChargingStateH\x00\x12?\n\x11shift_state_value\x18\t \x01(\x0e\x32\".telemetry.vehicle_data.ShiftStateH\x00\x42\x07\n\x05value\"a\n\x05\x44\x61tum\x12*\n\x03key\x18\x01 \x01(\x0e\x32\x1d.telemetry.vehicle_data.Field\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.telemetry.vehicle_data.Value\"s\n\x07Payload\x12+\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32\x1d.telemetry.vehicle_data.Datum\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t*\xe7\x1e\n\x05\x46ield\x12\x0b\n\x07Unknown\x10\x00\x12\r\n\tDriveRail\x10\x01\x12\x0f\n\x0b\x43hargeState\x10\x02\x12\x19\n\x15\x42msFullchargecomplete\x10\x03\x12\x10\n\x0cVehicleSpeed\x10\x04\x12\x0c\n\x08Odometer\x10\x05\x12\x0f\n\x0bPackVoltage\x10\x06\x12\x0f\n\x0bPackCurrent\x10\x07\x12\x07\n\x03Soc\x10\x08\x12\x0e\n\nDCDCEnable\x10\t\x12\x08\n\x04Gear\x10\n\x12\x17\n\x13IsolationResistance\x10\x0b\x12\x11\n\rPedalPosition\x10\x0c\x12\x0e\n\nBrakePedal\x10\r\x12\x0c\n\x08\x44iStateR\x10\x0e\x12\x10\n\x0c\x44iHeatsinkTR\x10\x0f\x12\x10\n\x0c\x44iAxleSpeedR\x10\x10\x12\x11\n\rDiTorquemotor\x10\x11\x12\x11\n\rDiStatorTempR\x10\x12\x12\x0b\n\x07\x44iVBatR\x10\x13\x12\x13\n\x0f\x44iMotorCurrentR\x10\x14\x12\x0c\n\x08Location\x10\x15\x12\x0c\n\x08GpsState\x10\x16\x12\x0e\n\nGpsHeading\x10\x17\x12\x16\n\x12NumBrickVoltageMax\x10\x18\x12\x13\n\x0f\x42rickVoltageMax\x10\x19\x12\x16\n\x12NumBrickVoltageMin\x10\x1a\x12\x13\n\x0f\x42rickVoltageMin\x10\x1b\x12\x14\n\x10NumModuleTempMax\x10\x1c\x12\x11\n\rModuleTempMax\x10\x1d\x12\x14\n\x10NumModuleTempMin\x10\x1e\x12\x11\n\rModuleTempMin\x10\x1f\x12\x0e\n\nRatedRange\x10 \x12\x08\n\x04Hvil\x10!\x12\x16\n\x12\x44\x43\x43hargingEnergyIn\x10\"\x12\x13\n\x0f\x44\x43\x43hargingPower\x10#\x12\x16\n\x12\x41\x43\x43hargingEnergyIn\x10$\x12\x13\n\x0f\x41\x43\x43hargingPower\x10%\x12\x12\n\x0e\x43hargeLimitSoc\x10&\x12\x16\n\x12\x46\x61stChargerPresent\x10\'\x12\x13\n\x0f\x45stBatteryRange\x10(\x12\x15\n\x11IdealBatteryRange\x10)\x12\x10\n\x0c\x42\x61tteryLevel\x10*\x12\x14\n\x10TimeToFullCharge\x10+\x12\x1e\n\x1aScheduledChargingStartTime\x10,\x12\x1c\n\x18ScheduledChargingPending\x10-\x12\x1a\n\x16ScheduledDepartureTime\x10.\x12\x1a\n\x16PreconditioningEnabled\x10/\x12\x19\n\x15ScheduledChargingMode\x10\x30\x12\x0e\n\nChargeAmps\x10\x31\x12\x17\n\x13\x43hargeEnableRequest\x10\x32\x12\x11\n\rChargerPhases\x10\x33\x12\x1d\n\x19\x43hargePortColdWeatherMode\x10\x34\x12\x18\n\x14\x43hargeCurrentRequest\x10\x35\x12\x1b\n\x17\x43hargeCurrentRequestMax\x10\x36\x12\x13\n\x0f\x42\x61tteryHeaterOn\x10\x37\x12\x18\n\x14NotEnoughPowerToHeat\x10\x38\x12\"\n\x1eSuperchargerSessionTripPlanner\x10\x39\x12\r\n\tDoorState\x10:\x12\n\n\x06Locked\x10;\x12\x0c\n\x08\x46\x64Window\x10<\x12\x0c\n\x08\x46pWindow\x10=\x12\x0c\n\x08RdWindow\x10>\x12\x0c\n\x08RpWindow\x10?\x12\x0f\n\x0bVehicleName\x10@\x12\x0e\n\nSentryMode\x10\x41\x12\x12\n\x0eSpeedLimitMode\x10\x42\x12\x13\n\x0f\x43urrentLimitMph\x10\x43\x12\x0b\n\x07Version\x10\x44\x12\x12\n\x0eTpmsPressureFl\x10\x45\x12\x12\n\x0eTpmsPressureFr\x10\x46\x12\x12\n\x0eTpmsPressureRl\x10G\x12\x12\n\x0eTpmsPressureRr\x10H\x12\x1e\n\x1aSemitruckTpmsPressureRe1L0\x10I\x12\x1e\n\x1aSemitruckTpmsPressureRe1L1\x10J\x12\x1e\n\x1aSemitruckTpmsPressureRe1R0\x10K\x12\x1e\n\x1aSemitruckTpmsPressureRe1R1\x10L\x12\x1e\n\x1aSemitruckTpmsPressureRe2L0\x10M\x12\x1e\n\x1aSemitruckTpmsPressureRe2L1\x10N\x12\x1e\n\x1aSemitruckTpmsPressureRe2R0\x10O\x12\x1e\n\x1aSemitruckTpmsPressureRe2R1\x10P\x12\x1e\n\x1aTpmsLastSeenPressureTimeFl\x10Q\x12\x1e\n\x1aTpmsLastSeenPressureTimeFr\x10R\x12\x1e\n\x1aTpmsLastSeenPressureTimeRl\x10S\x12\x1e\n\x1aTpmsLastSeenPressureTimeRr\x10T\x12\x0e\n\nInsideTemp\x10U\x12\x0f\n\x0bOutsideTemp\x10V\x12\x12\n\x0eSeatHeaterLeft\x10W\x12\x13\n\x0fSeatHeaterRight\x10X\x12\x16\n\x12SeatHeaterRearLeft\x10Y\x12\x17\n\x13SeatHeaterRearRight\x10Z\x12\x18\n\x14SeatHeaterRearCenter\x10[\x12\x17\n\x13\x41utoSeatClimateLeft\x10\\\x12\x18\n\x14\x41utoSeatClimateRight\x10]\x12\x12\n\x0e\x44riverSeatBelt\x10^\x12\x15\n\x11PassengerSeatBelt\x10_\x12\x16\n\x12\x44riverSeatOccupied\x10`\x12&\n\"SemitruckPassengerSeatFoldPosition\x10\x61\x12\x17\n\x13LateralAcceleration\x10\x62\x12\x1c\n\x18LongitudinalAcceleration\x10\x63\x12\x0f\n\x0b\x43ruiseState\x10\x64\x12\x12\n\x0e\x43ruiseSetSpeed\x10\x65\x12\x16\n\x12LifetimeEnergyUsed\x10\x66\x12\x1b\n\x17LifetimeEnergyUsedDrive\x10g\x12#\n\x1fSemitruckTractorParkBrakeStatus\x10h\x12#\n\x1fSemitruckTrailerParkBrakeStatus\x10i\x12\x11\n\rBrakePedalPos\x10j\x12\x14\n\x10RouteLastUpdated\x10k\x12\r\n\tRouteLine\x10l\x12\x12\n\x0eMilesToArrival\x10m\x12\x14\n\x10MinutesToArrival\x10n\x12\x12\n\x0eOriginLocation\x10o\x12\x17\n\x13\x44\x65stinationLocation\x10p\x12\x0b\n\x07\x43\x61rType\x10q\x12\x08\n\x04Trim\x10r\x12\x11\n\rExteriorColor\x10s\x12\r\n\tRoofColor\x10t\x12\x0e\n\nChargePort\x10u\x12\x13\n\x0f\x43hargePortLatch\x10v\x12\x12\n\x0e\x45xperimental_1\x10w\x12\x12\n\x0e\x45xperimental_2\x10x\x12\x12\n\x0e\x45xperimental_3\x10y\x12\x12\n\x0e\x45xperimental_4\x10z\x12\x14\n\x10GuestModeEnabled\x10{\x12\x15\n\x11PinToDriveEnabled\x10|\x12\x1e\n\x1aPairedPhoneKeyAndKeyFobQty\x10}\x12\x18\n\x14\x43ruiseFollowDistance\x10~\x12\x1c\n\x18\x41utomaticBlindSpotCamera\x10\x7f\x12#\n\x1e\x42lindSpotCollisionWarningChime\x10\x80\x01\x12\x16\n\x11SpeedLimitWarning\x10\x81\x01\x12\x1c\n\x17\x46orwardCollisionWarning\x10\x82\x01\x12\x1b\n\x16LaneDepartureAvoidance\x10\x83\x01\x12$\n\x1f\x45mergencyLaneDepartureAvoidance\x10\x84\x01\x12!\n\x1c\x41utomaticEmergencyBrakingOff\x10\x85\x01\x12\x1e\n\x19LifetimeEnergyGainedRegen\x10\x86\x01\x12\r\n\x08\x44iStateF\x10\x87\x01\x12\x0f\n\nDiStateREL\x10\x88\x01\x12\x0f\n\nDiStateRER\x10\x89\x01\x12\x11\n\x0c\x44iHeatsinkTF\x10\x8a\x01\x12\x13\n\x0e\x44iHeatsinkTREL\x10\x8b\x01\x12\x13\n\x0e\x44iHeatsinkTRER\x10\x8c\x01\x12\x11\n\x0c\x44iAxleSpeedF\x10\x8d\x01\x12\x13\n\x0e\x44iAxleSpeedREL\x10\x8e\x01\x12\x13\n\x0e\x44iAxleSpeedRER\x10\x8f\x01\x12\x15\n\x10\x44iSlaveTorqueCmd\x10\x90\x01\x12\x14\n\x0f\x44iTorqueActualR\x10\x91\x01\x12\x14\n\x0f\x44iTorqueActualF\x10\x92\x01\x12\x16\n\x11\x44iTorqueActualREL\x10\x93\x01\x12\x16\n\x11\x44iTorqueActualRER\x10\x94\x01\x12\x12\n\rDiStatorTempF\x10\x95\x01\x12\x14\n\x0f\x44iStatorTempREL\x10\x96\x01\x12\x14\n\x0f\x44iStatorTempRER\x10\x97\x01\x12\x0c\n\x07\x44iVBatF\x10\x98\x01\x12\x0e\n\tDiVBatREL\x10\x99\x01\x12\x0e\n\tDiVBatRER\x10\x9a\x01\x12\x14\n\x0f\x44iMotorCurrentF\x10\x9b\x01\x12\x16\n\x11\x44iMotorCurrentREL\x10\x9c\x01\x12\x16\n\x11\x44iMotorCurrentRER\x10\x9d\x01\x12\x14\n\x0f\x45nergyRemaining\x10\x9e\x01\x12\x10\n\x0bServiceMode\x10\x9f\x01\x12\r\n\x08\x42MSState\x10\xa0\x01\x12\x1f\n\x1aGuestModeMobileAccessState\x10\xa1\x01\x12\x11\n\x0c\x44\x65precated_1\x10\xa2\x01\x12\x14\n\x0f\x44\x65stinationName\x10\xa3\x01\x12\x11\n\x0c\x44iInverterTR\x10\xa4\x01\x12\x11\n\x0c\x44iInverterTF\x10\xa5\x01\x12\x13\n\x0e\x44iInverterTREL\x10\xa6\x01\x12\x13\n\x0e\x44iInverterTRER\x10\xa7\x01\x12\x13\n\x0e\x45xperimental_5\x10\xa8\x01\x12\x13\n\x0e\x45xperimental_6\x10\xa9\x01\x12\x13\n\x0e\x45xperimental_7\x10\xaa\x01\x12\x13\n\x0e\x45xperimental_8\x10\xab\x01\x12\x13\n\x0e\x45xperimental_9\x10\xac\x01\x12\x14\n\x0f\x45xperimental_10\x10\xad\x01\x12\x14\n\x0f\x45xperimental_11\x10\xae\x01\x12\x14\n\x0f\x45xperimental_12\x10\xaf\x01\x12\x14\n\x0f\x45xperimental_13\x10\xb0\x01\x12\x14\n\x0f\x45xperimental_14\x10\xb1\x01\x12\x14\n\x0f\x45xperimental_15\x10\xb2\x01*\xbf\x01\n\rChargingState\x12\x16\n\x12\x43hargeStateUnknown\x10\x00\x12\x1b\n\x17\x43hargeStateDisconnected\x10\x01\x12\x16\n\x12\x43hargeStateNoPower\x10\x02\x12\x17\n\x13\x43hargeStateStarting\x10\x03\x12\x17\n\x13\x43hargeStateCharging\x10\x04\x12\x17\n\x13\x43hargeStateComplete\x10\x05\x12\x16\n\x12\x43hargeStateStopped\x10\x06*\x91\x01\n\nShiftState\x12\x15\n\x11ShiftStateUnknown\x10\x00\x12\x15\n\x11ShiftStateInvalid\x10\x01\x12\x0f\n\x0bShiftStateP\x10\x02\x12\x0f\n\x0bShiftStateR\x10\x03\x12\x0f\n\x0bShiftStateD\x10\x04\x12\x0f\n\x0bShiftStateN\x10\x05\x12\x11\n\rShiftStateSNA\x10\x06\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3') + , + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) + +_FIELD = _descriptor.EnumDescriptor( + name='Field', + full_name='telemetry.vehicle_data.Field', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='Unknown', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DriveRail', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeState', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BmsFullchargecomplete', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='VehicleSpeed', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Odometer', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PackVoltage', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PackCurrent', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Soc', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DCDCEnable', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Gear', index=10, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='IsolationResistance', index=11, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PedalPosition', index=12, number=12, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BrakePedal', index=13, number=13, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiStateR', index=14, number=14, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiHeatsinkTR', index=15, number=15, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiAxleSpeedR', index=16, number=16, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiTorquemotor', index=17, number=17, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiStatorTempR', index=18, number=18, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiVBatR', index=19, number=19, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiMotorCurrentR', index=20, number=20, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Location', index=21, number=21, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GpsState', index=22, number=22, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GpsHeading', index=23, number=23, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NumBrickVoltageMax', index=24, number=24, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BrickVoltageMax', index=25, number=25, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NumBrickVoltageMin', index=26, number=26, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BrickVoltageMin', index=27, number=27, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NumModuleTempMax', index=28, number=28, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ModuleTempMax', index=29, number=29, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NumModuleTempMin', index=30, number=30, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ModuleTempMin', index=31, number=31, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RatedRange', index=32, number=32, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Hvil', index=33, number=33, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DCChargingEnergyIn', index=34, number=34, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DCChargingPower', index=35, number=35, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ACChargingEnergyIn', index=36, number=36, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ACChargingPower', index=37, number=37, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeLimitSoc', index=38, number=38, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FastChargerPresent', index=39, number=39, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='EstBatteryRange', index=40, number=40, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='IdealBatteryRange', index=41, number=41, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BatteryLevel', index=42, number=42, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TimeToFullCharge', index=43, number=43, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ScheduledChargingStartTime', index=44, number=44, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ScheduledChargingPending', index=45, number=45, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ScheduledDepartureTime', index=46, number=46, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PreconditioningEnabled', index=47, number=47, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ScheduledChargingMode', index=48, number=48, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeAmps', index=49, number=49, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeEnableRequest', index=50, number=50, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargerPhases', index=51, number=51, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargePortColdWeatherMode', index=52, number=52, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeCurrentRequest', index=53, number=53, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeCurrentRequestMax', index=54, number=54, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BatteryHeaterOn', index=55, number=55, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NotEnoughPowerToHeat', index=56, number=56, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SuperchargerSessionTripPlanner', index=57, number=57, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DoorState', index=58, number=58, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Locked', index=59, number=59, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FdWindow', index=60, number=60, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FpWindow', index=61, number=61, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RdWindow', index=62, number=62, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RpWindow', index=63, number=63, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='VehicleName', index=64, number=64, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SentryMode', index=65, number=65, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SpeedLimitMode', index=66, number=66, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CurrentLimitMph', index=67, number=67, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Version', index=68, number=68, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TpmsPressureFl', index=69, number=69, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TpmsPressureFr', index=70, number=70, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TpmsPressureRl', index=71, number=71, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TpmsPressureRr', index=72, number=72, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTpmsPressureRe1L0', index=73, number=73, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTpmsPressureRe1L1', index=74, number=74, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTpmsPressureRe1R0', index=75, number=75, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTpmsPressureRe1R1', index=76, number=76, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTpmsPressureRe2L0', index=77, number=77, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTpmsPressureRe2L1', index=78, number=78, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTpmsPressureRe2R0', index=79, number=79, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTpmsPressureRe2R1', index=80, number=80, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TpmsLastSeenPressureTimeFl', index=81, number=81, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TpmsLastSeenPressureTimeFr', index=82, number=82, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TpmsLastSeenPressureTimeRl', index=83, number=83, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TpmsLastSeenPressureTimeRr', index=84, number=84, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='InsideTemp', index=85, number=85, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='OutsideTemp', index=86, number=86, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SeatHeaterLeft', index=87, number=87, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SeatHeaterRight', index=88, number=88, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SeatHeaterRearLeft', index=89, number=89, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SeatHeaterRearRight', index=90, number=90, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SeatHeaterRearCenter', index=91, number=91, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AutoSeatClimateLeft', index=92, number=92, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AutoSeatClimateRight', index=93, number=93, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DriverSeatBelt', index=94, number=94, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PassengerSeatBelt', index=95, number=95, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DriverSeatOccupied', index=96, number=96, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckPassengerSeatFoldPosition', index=97, number=97, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LateralAcceleration', index=98, number=98, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LongitudinalAcceleration', index=99, number=99, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CruiseState', index=100, number=100, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CruiseSetSpeed', index=101, number=101, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LifetimeEnergyUsed', index=102, number=102, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LifetimeEnergyUsedDrive', index=103, number=103, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTractorParkBrakeStatus', index=104, number=104, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SemitruckTrailerParkBrakeStatus', index=105, number=105, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BrakePedalPos', index=106, number=106, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RouteLastUpdated', index=107, number=107, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RouteLine', index=108, number=108, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MilesToArrival', index=109, number=109, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MinutesToArrival', index=110, number=110, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='OriginLocation', index=111, number=111, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DestinationLocation', index=112, number=112, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CarType', index=113, number=113, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Trim', index=114, number=114, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ExteriorColor', index=115, number=115, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RoofColor', index=116, number=116, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargePort', index=117, number=117, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargePortLatch', index=118, number=118, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_1', index=119, number=119, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_2', index=120, number=120, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_3', index=121, number=121, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_4', index=122, number=122, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GuestModeEnabled', index=123, number=123, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PinToDriveEnabled', index=124, number=124, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PairedPhoneKeyAndKeyFobQty', index=125, number=125, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CruiseFollowDistance', index=126, number=126, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AutomaticBlindSpotCamera', index=127, number=127, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BlindSpotCollisionWarningChime', index=128, number=128, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SpeedLimitWarning', index=129, number=129, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ForwardCollisionWarning', index=130, number=130, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LaneDepartureAvoidance', index=131, number=131, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='EmergencyLaneDepartureAvoidance', index=132, number=132, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AutomaticEmergencyBrakingOff', index=133, number=133, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LifetimeEnergyGainedRegen', index=134, number=134, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiStateF', index=135, number=135, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiStateREL', index=136, number=136, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiStateRER', index=137, number=137, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiHeatsinkTF', index=138, number=138, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiHeatsinkTREL', index=139, number=139, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiHeatsinkTRER', index=140, number=140, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiAxleSpeedF', index=141, number=141, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiAxleSpeedREL', index=142, number=142, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiAxleSpeedRER', index=143, number=143, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiSlaveTorqueCmd', index=144, number=144, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiTorqueActualR', index=145, number=145, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiTorqueActualF', index=146, number=146, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiTorqueActualREL', index=147, number=147, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiTorqueActualRER', index=148, number=148, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiStatorTempF', index=149, number=149, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiStatorTempREL', index=150, number=150, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiStatorTempRER', index=151, number=151, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiVBatF', index=152, number=152, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiVBatREL', index=153, number=153, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiVBatRER', index=154, number=154, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiMotorCurrentF', index=155, number=155, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiMotorCurrentREL', index=156, number=156, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiMotorCurrentRER', index=157, number=157, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='EnergyRemaining', index=158, number=158, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ServiceMode', index=159, number=159, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BMSState', index=160, number=160, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GuestModeMobileAccessState', index=161, number=161, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Deprecated_1', index=162, number=162, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DestinationName', index=163, number=163, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiInverterTR', index=164, number=164, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiInverterTF', index=165, number=165, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiInverterTREL', index=166, number=166, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DiInverterTRER', index=167, number=167, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_5', index=168, number=168, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_6', index=169, number=169, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_7', index=170, number=170, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_8', index=171, number=171, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_9', index=172, number=172, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_10', index=173, number=173, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_11', index=174, number=174, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_12', index=175, number=175, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_13', index=176, number=176, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_14', index=177, number=177, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Experimental_15', index=178, number=178, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=703, + serialized_end=4646, +) +_sym_db.RegisterEnumDescriptor(_FIELD) + +Field = enum_type_wrapper.EnumTypeWrapper(_FIELD) +_CHARGINGSTATE = _descriptor.EnumDescriptor( + name='ChargingState', + full_name='telemetry.vehicle_data.ChargingState', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='ChargeStateUnknown', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeStateDisconnected', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeStateNoPower', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeStateStarting', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeStateCharging', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeStateComplete', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ChargeStateStopped', index=6, number=6, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=4649, + serialized_end=4840, +) +_sym_db.RegisterEnumDescriptor(_CHARGINGSTATE) + +ChargingState = enum_type_wrapper.EnumTypeWrapper(_CHARGINGSTATE) +_SHIFTSTATE = _descriptor.EnumDescriptor( + name='ShiftState', + full_name='telemetry.vehicle_data.ShiftState', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='ShiftStateUnknown', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ShiftStateInvalid', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ShiftStateP', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ShiftStateR', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ShiftStateD', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ShiftStateN', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ShiftStateSNA', index=6, number=6, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=4843, + serialized_end=4988, +) +_sym_db.RegisterEnumDescriptor(_SHIFTSTATE) + +ShiftState = enum_type_wrapper.EnumTypeWrapper(_SHIFTSTATE) +Unknown = 0 +DriveRail = 1 +ChargeState = 2 +BmsFullchargecomplete = 3 +VehicleSpeed = 4 +Odometer = 5 +PackVoltage = 6 +PackCurrent = 7 +Soc = 8 +DCDCEnable = 9 +Gear = 10 +IsolationResistance = 11 +PedalPosition = 12 +BrakePedal = 13 +DiStateR = 14 +DiHeatsinkTR = 15 +DiAxleSpeedR = 16 +DiTorquemotor = 17 +DiStatorTempR = 18 +DiVBatR = 19 +DiMotorCurrentR = 20 +Location = 21 +GpsState = 22 +GpsHeading = 23 +NumBrickVoltageMax = 24 +BrickVoltageMax = 25 +NumBrickVoltageMin = 26 +BrickVoltageMin = 27 +NumModuleTempMax = 28 +ModuleTempMax = 29 +NumModuleTempMin = 30 +ModuleTempMin = 31 +RatedRange = 32 +Hvil = 33 +DCChargingEnergyIn = 34 +DCChargingPower = 35 +ACChargingEnergyIn = 36 +ACChargingPower = 37 +ChargeLimitSoc = 38 +FastChargerPresent = 39 +EstBatteryRange = 40 +IdealBatteryRange = 41 +BatteryLevel = 42 +TimeToFullCharge = 43 +ScheduledChargingStartTime = 44 +ScheduledChargingPending = 45 +ScheduledDepartureTime = 46 +PreconditioningEnabled = 47 +ScheduledChargingMode = 48 +ChargeAmps = 49 +ChargeEnableRequest = 50 +ChargerPhases = 51 +ChargePortColdWeatherMode = 52 +ChargeCurrentRequest = 53 +ChargeCurrentRequestMax = 54 +BatteryHeaterOn = 55 +NotEnoughPowerToHeat = 56 +SuperchargerSessionTripPlanner = 57 +DoorState = 58 +Locked = 59 +FdWindow = 60 +FpWindow = 61 +RdWindow = 62 +RpWindow = 63 +VehicleName = 64 +SentryMode = 65 +SpeedLimitMode = 66 +CurrentLimitMph = 67 +Version = 68 +TpmsPressureFl = 69 +TpmsPressureFr = 70 +TpmsPressureRl = 71 +TpmsPressureRr = 72 +SemitruckTpmsPressureRe1L0 = 73 +SemitruckTpmsPressureRe1L1 = 74 +SemitruckTpmsPressureRe1R0 = 75 +SemitruckTpmsPressureRe1R1 = 76 +SemitruckTpmsPressureRe2L0 = 77 +SemitruckTpmsPressureRe2L1 = 78 +SemitruckTpmsPressureRe2R0 = 79 +SemitruckTpmsPressureRe2R1 = 80 +TpmsLastSeenPressureTimeFl = 81 +TpmsLastSeenPressureTimeFr = 82 +TpmsLastSeenPressureTimeRl = 83 +TpmsLastSeenPressureTimeRr = 84 +InsideTemp = 85 +OutsideTemp = 86 +SeatHeaterLeft = 87 +SeatHeaterRight = 88 +SeatHeaterRearLeft = 89 +SeatHeaterRearRight = 90 +SeatHeaterRearCenter = 91 +AutoSeatClimateLeft = 92 +AutoSeatClimateRight = 93 +DriverSeatBelt = 94 +PassengerSeatBelt = 95 +DriverSeatOccupied = 96 +SemitruckPassengerSeatFoldPosition = 97 +LateralAcceleration = 98 +LongitudinalAcceleration = 99 +CruiseState = 100 +CruiseSetSpeed = 101 +LifetimeEnergyUsed = 102 +LifetimeEnergyUsedDrive = 103 +SemitruckTractorParkBrakeStatus = 104 +SemitruckTrailerParkBrakeStatus = 105 +BrakePedalPos = 106 +RouteLastUpdated = 107 +RouteLine = 108 +MilesToArrival = 109 +MinutesToArrival = 110 +OriginLocation = 111 +DestinationLocation = 112 +CarType = 113 +Trim = 114 +ExteriorColor = 115 +RoofColor = 116 +ChargePort = 117 +ChargePortLatch = 118 +Experimental_1 = 119 +Experimental_2 = 120 +Experimental_3 = 121 +Experimental_4 = 122 +GuestModeEnabled = 123 +PinToDriveEnabled = 124 +PairedPhoneKeyAndKeyFobQty = 125 +CruiseFollowDistance = 126 +AutomaticBlindSpotCamera = 127 +BlindSpotCollisionWarningChime = 128 +SpeedLimitWarning = 129 +ForwardCollisionWarning = 130 +LaneDepartureAvoidance = 131 +EmergencyLaneDepartureAvoidance = 132 +AutomaticEmergencyBrakingOff = 133 +LifetimeEnergyGainedRegen = 134 +DiStateF = 135 +DiStateREL = 136 +DiStateRER = 137 +DiHeatsinkTF = 138 +DiHeatsinkTREL = 139 +DiHeatsinkTRER = 140 +DiAxleSpeedF = 141 +DiAxleSpeedREL = 142 +DiAxleSpeedRER = 143 +DiSlaveTorqueCmd = 144 +DiTorqueActualR = 145 +DiTorqueActualF = 146 +DiTorqueActualREL = 147 +DiTorqueActualRER = 148 +DiStatorTempF = 149 +DiStatorTempREL = 150 +DiStatorTempRER = 151 +DiVBatF = 152 +DiVBatREL = 153 +DiVBatRER = 154 +DiMotorCurrentF = 155 +DiMotorCurrentREL = 156 +DiMotorCurrentRER = 157 +EnergyRemaining = 158 +ServiceMode = 159 +BMSState = 160 +GuestModeMobileAccessState = 161 +Deprecated_1 = 162 +DestinationName = 163 +DiInverterTR = 164 +DiInverterTF = 165 +DiInverterTREL = 166 +DiInverterTRER = 167 +Experimental_5 = 168 +Experimental_6 = 169 +Experimental_7 = 170 +Experimental_8 = 171 +Experimental_9 = 172 +Experimental_10 = 173 +Experimental_11 = 174 +Experimental_12 = 175 +Experimental_13 = 176 +Experimental_14 = 177 +Experimental_15 = 178 +ChargeStateUnknown = 0 +ChargeStateDisconnected = 1 +ChargeStateNoPower = 2 +ChargeStateStarting = 3 +ChargeStateCharging = 4 +ChargeStateComplete = 5 +ChargeStateStopped = 6 +ShiftStateUnknown = 0 +ShiftStateInvalid = 1 +ShiftStateP = 2 +ShiftStateR = 3 +ShiftStateD = 4 +ShiftStateN = 5 +ShiftStateSNA = 6 + + + +_LOCATIONVALUE = _descriptor.Descriptor( + name='LocationValue', + full_name='telemetry.vehicle_data.LocationValue', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='latitude', full_name='telemetry.vehicle_data.LocationValue.latitude', index=0, + number=1, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='longitude', full_name='telemetry.vehicle_data.LocationValue.longitude', index=1, + number=2, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=79, + serialized_end=131, +) + + +_VALUE = _descriptor.Descriptor( + name='Value', + full_name='telemetry.vehicle_data.Value', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='string_value', full_name='telemetry.vehicle_data.Value.string_value', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='int_value', full_name='telemetry.vehicle_data.Value.int_value', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='long_value', full_name='telemetry.vehicle_data.Value.long_value', index=2, + number=3, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='float_value', full_name='telemetry.vehicle_data.Value.float_value', index=3, + number=4, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='double_value', full_name='telemetry.vehicle_data.Value.double_value', index=4, + number=5, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='boolean_value', full_name='telemetry.vehicle_data.Value.boolean_value', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='location_value', full_name='telemetry.vehicle_data.Value.location_value', index=6, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='charging_value', full_name='telemetry.vehicle_data.Value.charging_value', index=7, + number=8, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='shift_state_value', full_name='telemetry.vehicle_data.Value.shift_state_value', index=8, + number=9, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='value', full_name='telemetry.vehicle_data.Value.value', + index=0, containing_type=None, fields=[]), + ], + serialized_start=134, + serialized_end=484, +) + + +_DATUM = _descriptor.Descriptor( + name='Datum', + full_name='telemetry.vehicle_data.Datum', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='telemetry.vehicle_data.Datum.key', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='value', full_name='telemetry.vehicle_data.Datum.value', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=486, + serialized_end=583, +) + + +_PAYLOAD = _descriptor.Descriptor( + name='Payload', + full_name='telemetry.vehicle_data.Payload', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='data', full_name='telemetry.vehicle_data.Payload.data', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='created_at', full_name='telemetry.vehicle_data.Payload.created_at', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='vin', full_name='telemetry.vehicle_data.Payload.vin', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=585, + serialized_end=700, +) + +_VALUE.fields_by_name['location_value'].message_type = _LOCATIONVALUE +_VALUE.fields_by_name['charging_value'].enum_type = _CHARGINGSTATE +_VALUE.fields_by_name['shift_state_value'].enum_type = _SHIFTSTATE +_VALUE.oneofs_by_name['value'].fields.append( + _VALUE.fields_by_name['string_value']) +_VALUE.fields_by_name['string_value'].containing_oneof = _VALUE.oneofs_by_name['value'] +_VALUE.oneofs_by_name['value'].fields.append( + _VALUE.fields_by_name['int_value']) +_VALUE.fields_by_name['int_value'].containing_oneof = _VALUE.oneofs_by_name['value'] +_VALUE.oneofs_by_name['value'].fields.append( + _VALUE.fields_by_name['long_value']) +_VALUE.fields_by_name['long_value'].containing_oneof = _VALUE.oneofs_by_name['value'] +_VALUE.oneofs_by_name['value'].fields.append( + _VALUE.fields_by_name['float_value']) +_VALUE.fields_by_name['float_value'].containing_oneof = _VALUE.oneofs_by_name['value'] +_VALUE.oneofs_by_name['value'].fields.append( + _VALUE.fields_by_name['double_value']) +_VALUE.fields_by_name['double_value'].containing_oneof = _VALUE.oneofs_by_name['value'] +_VALUE.oneofs_by_name['value'].fields.append( + _VALUE.fields_by_name['boolean_value']) +_VALUE.fields_by_name['boolean_value'].containing_oneof = _VALUE.oneofs_by_name['value'] +_VALUE.oneofs_by_name['value'].fields.append( + _VALUE.fields_by_name['location_value']) +_VALUE.fields_by_name['location_value'].containing_oneof = _VALUE.oneofs_by_name['value'] +_VALUE.oneofs_by_name['value'].fields.append( + _VALUE.fields_by_name['charging_value']) +_VALUE.fields_by_name['charging_value'].containing_oneof = _VALUE.oneofs_by_name['value'] +_VALUE.oneofs_by_name['value'].fields.append( + _VALUE.fields_by_name['shift_state_value']) +_VALUE.fields_by_name['shift_state_value'].containing_oneof = _VALUE.oneofs_by_name['value'] +_DATUM.fields_by_name['key'].enum_type = _FIELD +_DATUM.fields_by_name['value'].message_type = _VALUE +_PAYLOAD.fields_by_name['data'].message_type = _DATUM +_PAYLOAD.fields_by_name['created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +DESCRIPTOR.message_types_by_name['LocationValue'] = _LOCATIONVALUE +DESCRIPTOR.message_types_by_name['Value'] = _VALUE +DESCRIPTOR.message_types_by_name['Datum'] = _DATUM +DESCRIPTOR.message_types_by_name['Payload'] = _PAYLOAD +DESCRIPTOR.enum_types_by_name['Field'] = _FIELD +DESCRIPTOR.enum_types_by_name['ChargingState'] = _CHARGINGSTATE +DESCRIPTOR.enum_types_by_name['ShiftState'] = _SHIFTSTATE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +LocationValue = _reflection.GeneratedProtocolMessageType('LocationValue', (_message.Message,), dict( + DESCRIPTOR = _LOCATIONVALUE, + __module__ = 'vehicle_data_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_data.LocationValue) + )) +_sym_db.RegisterMessage(LocationValue) + +Value = _reflection.GeneratedProtocolMessageType('Value', (_message.Message,), dict( + DESCRIPTOR = _VALUE, + __module__ = 'vehicle_data_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_data.Value) + )) +_sym_db.RegisterMessage(Value) + +Datum = _reflection.GeneratedProtocolMessageType('Datum', (_message.Message,), dict( + DESCRIPTOR = _DATUM, + __module__ = 'vehicle_data_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_data.Datum) + )) +_sym_db.RegisterMessage(Datum) + +Payload = _reflection.GeneratedProtocolMessageType('Payload', (_message.Message,), dict( + DESCRIPTOR = _PAYLOAD, + __module__ = 'vehicle_data_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_data.Payload) + )) +_sym_db.RegisterMessage(Payload) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z-github.com/teslamotors/fleet-telemetry/protos')) # @@protoc_insertion_point(module_scope) diff --git a/protos/python/vehicle_error_pb2.py b/protos/python/vehicle_error_pb2.py index 5c6836b..0168d05 100644 --- a/protos/python/vehicle_error_pb2.py +++ b/protos/python/vehicle_error_pb2.py @@ -1,12 +1,13 @@ -# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: vehicle_error.proto -# Protobuf Python Version: 4.25.1 -"""Generated protocol buffer code.""" + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder +from google.protobuf import descriptor_pb2 # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -15,20 +16,184 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13vehicle_error.proto\x12\x17telemetry.vehicle_error\x1a\x1fgoogle/protobuf/timestamp.proto\"\x83\x01\n\rVehicleErrors\x12\x35\n\x06\x65rrors\x18\x01 \x03(\x0b\x32%.telemetry.vehicle_error.VehicleError\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\xc6\x01\n\x0cVehicleError\x12.\n\ncreated_at\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0c\n\x04name\x18\x02 \x01(\t\x12=\n\x04tags\x18\x03 \x03(\x0b\x32/.telemetry.vehicle_error.VehicleError.TagsEntry\x12\x0c\n\x04\x62ody\x18\x04 \x01(\t\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'vehicle_error_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None - _globals['DESCRIPTOR']._serialized_options = b'Z-github.com/teslamotors/fleet-telemetry/protos' - _globals['_VEHICLEERROR_TAGSENTRY']._options = None - _globals['_VEHICLEERROR_TAGSENTRY']._serialized_options = b'8\001' - _globals['_VEHICLEERRORS']._serialized_start=82 - _globals['_VEHICLEERRORS']._serialized_end=213 - _globals['_VEHICLEERROR']._serialized_start=216 - _globals['_VEHICLEERROR']._serialized_end=414 - _globals['_VEHICLEERROR_TAGSENTRY']._serialized_start=371 - _globals['_VEHICLEERROR_TAGSENTRY']._serialized_end=414 +DESCRIPTOR = _descriptor.FileDescriptor( + name='vehicle_error.proto', + package='telemetry.vehicle_error', + syntax='proto3', + serialized_pb=_b('\n\x13vehicle_error.proto\x12\x17telemetry.vehicle_error\x1a\x1fgoogle/protobuf/timestamp.proto\"\x83\x01\n\rVehicleErrors\x12\x35\n\x06\x65rrors\x18\x01 \x03(\x0b\x32%.telemetry.vehicle_error.VehicleError\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\xc6\x01\n\x0cVehicleError\x12.\n\ncreated_at\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0c\n\x04name\x18\x02 \x01(\t\x12=\n\x04tags\x18\x03 \x03(\x0b\x32/.telemetry.vehicle_error.VehicleError.TagsEntry\x12\x0c\n\x04\x62ody\x18\x04 \x01(\t\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3') + , + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) + + + + +_VEHICLEERRORS = _descriptor.Descriptor( + name='VehicleErrors', + full_name='telemetry.vehicle_error.VehicleErrors', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='errors', full_name='telemetry.vehicle_error.VehicleErrors.errors', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='created_at', full_name='telemetry.vehicle_error.VehicleErrors.created_at', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='vin', full_name='telemetry.vehicle_error.VehicleErrors.vin', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=82, + serialized_end=213, +) + + +_VEHICLEERROR_TAGSENTRY = _descriptor.Descriptor( + name='TagsEntry', + full_name='telemetry.vehicle_error.VehicleError.TagsEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='telemetry.vehicle_error.VehicleError.TagsEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='value', full_name='telemetry.vehicle_error.VehicleError.TagsEntry.value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=_descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')), + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=371, + serialized_end=414, +) + +_VEHICLEERROR = _descriptor.Descriptor( + name='VehicleError', + full_name='telemetry.vehicle_error.VehicleError', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='created_at', full_name='telemetry.vehicle_error.VehicleError.created_at', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='name', full_name='telemetry.vehicle_error.VehicleError.name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='tags', full_name='telemetry.vehicle_error.VehicleError.tags', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='body', full_name='telemetry.vehicle_error.VehicleError.body', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[_VEHICLEERROR_TAGSENTRY, ], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=216, + serialized_end=414, +) + +_VEHICLEERRORS.fields_by_name['errors'].message_type = _VEHICLEERROR +_VEHICLEERRORS.fields_by_name['created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_VEHICLEERROR_TAGSENTRY.containing_type = _VEHICLEERROR +_VEHICLEERROR.fields_by_name['created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_VEHICLEERROR.fields_by_name['tags'].message_type = _VEHICLEERROR_TAGSENTRY +DESCRIPTOR.message_types_by_name['VehicleErrors'] = _VEHICLEERRORS +DESCRIPTOR.message_types_by_name['VehicleError'] = _VEHICLEERROR +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +VehicleErrors = _reflection.GeneratedProtocolMessageType('VehicleErrors', (_message.Message,), dict( + DESCRIPTOR = _VEHICLEERRORS, + __module__ = 'vehicle_error_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_error.VehicleErrors) + )) +_sym_db.RegisterMessage(VehicleErrors) + +VehicleError = _reflection.GeneratedProtocolMessageType('VehicleError', (_message.Message,), dict( + + TagsEntry = _reflection.GeneratedProtocolMessageType('TagsEntry', (_message.Message,), dict( + DESCRIPTOR = _VEHICLEERROR_TAGSENTRY, + __module__ = 'vehicle_error_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_error.VehicleError.TagsEntry) + )) + , + DESCRIPTOR = _VEHICLEERROR, + __module__ = 'vehicle_error_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_error.VehicleError) + )) +_sym_db.RegisterMessage(VehicleError) +_sym_db.RegisterMessage(VehicleError.TagsEntry) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z-github.com/teslamotors/fleet-telemetry/protos')) +_VEHICLEERROR_TAGSENTRY.has_options = True +_VEHICLEERROR_TAGSENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')) # @@protoc_insertion_point(module_scope) diff --git a/protos/python/vehicle_metric_pb2.py b/protos/python/vehicle_metric_pb2.py index 139cad6..5e64fec 100644 --- a/protos/python/vehicle_metric_pb2.py +++ b/protos/python/vehicle_metric_pb2.py @@ -1,12 +1,13 @@ -# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: vehicle_metric.proto -# Protobuf Python Version: 4.25.1 -"""Generated protocol buffer code.""" + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder +from google.protobuf import descriptor_pb2 # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -15,20 +16,176 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14vehicle_metric.proto\x12\x19telemetry.vehicle_metrics\x1a\x1fgoogle/protobuf/timestamp.proto\"\x81\x01\n\x0eVehicleMetrics\x12\x32\n\x07metrics\x18\x01 \x03(\x0b\x32!.telemetry.vehicle_metrics.Metric\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\x8d\x01\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x39\n\x04tags\x18\x02 \x03(\x0b\x32+.telemetry.vehicle_metrics.Metric.TagsEntry\x12\r\n\x05value\x18\x03 \x01(\x01\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'vehicle_metric_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None - _globals['DESCRIPTOR']._serialized_options = b'Z-github.com/teslamotors/fleet-telemetry/protos' - _globals['_METRIC_TAGSENTRY']._options = None - _globals['_METRIC_TAGSENTRY']._serialized_options = b'8\001' - _globals['_VEHICLEMETRICS']._serialized_start=85 - _globals['_VEHICLEMETRICS']._serialized_end=214 - _globals['_METRIC']._serialized_start=217 - _globals['_METRIC']._serialized_end=358 - _globals['_METRIC_TAGSENTRY']._serialized_start=315 - _globals['_METRIC_TAGSENTRY']._serialized_end=358 +DESCRIPTOR = _descriptor.FileDescriptor( + name='vehicle_metric.proto', + package='telemetry.vehicle_metrics', + syntax='proto3', + serialized_pb=_b('\n\x14vehicle_metric.proto\x12\x19telemetry.vehicle_metrics\x1a\x1fgoogle/protobuf/timestamp.proto\"\x81\x01\n\x0eVehicleMetrics\x12\x32\n\x07metrics\x18\x01 \x03(\x0b\x32!.telemetry.vehicle_metrics.Metric\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\x8d\x01\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x39\n\x04tags\x18\x02 \x03(\x0b\x32+.telemetry.vehicle_metrics.Metric.TagsEntry\x12\r\n\x05value\x18\x03 \x01(\x01\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3') + , + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) + + + + +_VEHICLEMETRICS = _descriptor.Descriptor( + name='VehicleMetrics', + full_name='telemetry.vehicle_metrics.VehicleMetrics', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='metrics', full_name='telemetry.vehicle_metrics.VehicleMetrics.metrics', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='created_at', full_name='telemetry.vehicle_metrics.VehicleMetrics.created_at', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='vin', full_name='telemetry.vehicle_metrics.VehicleMetrics.vin', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=85, + serialized_end=214, +) + + +_METRIC_TAGSENTRY = _descriptor.Descriptor( + name='TagsEntry', + full_name='telemetry.vehicle_metrics.Metric.TagsEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='telemetry.vehicle_metrics.Metric.TagsEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='value', full_name='telemetry.vehicle_metrics.Metric.TagsEntry.value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=_descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')), + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=315, + serialized_end=358, +) + +_METRIC = _descriptor.Descriptor( + name='Metric', + full_name='telemetry.vehicle_metrics.Metric', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='telemetry.vehicle_metrics.Metric.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='tags', full_name='telemetry.vehicle_metrics.Metric.tags', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='value', full_name='telemetry.vehicle_metrics.Metric.value', index=2, + number=3, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[_METRIC_TAGSENTRY, ], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=217, + serialized_end=358, +) + +_VEHICLEMETRICS.fields_by_name['metrics'].message_type = _METRIC +_VEHICLEMETRICS.fields_by_name['created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_METRIC_TAGSENTRY.containing_type = _METRIC +_METRIC.fields_by_name['tags'].message_type = _METRIC_TAGSENTRY +DESCRIPTOR.message_types_by_name['VehicleMetrics'] = _VEHICLEMETRICS +DESCRIPTOR.message_types_by_name['Metric'] = _METRIC +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +VehicleMetrics = _reflection.GeneratedProtocolMessageType('VehicleMetrics', (_message.Message,), dict( + DESCRIPTOR = _VEHICLEMETRICS, + __module__ = 'vehicle_metric_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_metrics.VehicleMetrics) + )) +_sym_db.RegisterMessage(VehicleMetrics) + +Metric = _reflection.GeneratedProtocolMessageType('Metric', (_message.Message,), dict( + + TagsEntry = _reflection.GeneratedProtocolMessageType('TagsEntry', (_message.Message,), dict( + DESCRIPTOR = _METRIC_TAGSENTRY, + __module__ = 'vehicle_metric_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_metrics.Metric.TagsEntry) + )) + , + DESCRIPTOR = _METRIC, + __module__ = 'vehicle_metric_pb2' + # @@protoc_insertion_point(class_scope:telemetry.vehicle_metrics.Metric) + )) +_sym_db.RegisterMessage(Metric) +_sym_db.RegisterMessage(Metric.TagsEntry) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z-github.com/teslamotors/fleet-telemetry/protos')) +_METRIC_TAGSENTRY.has_options = True +_METRIC_TAGSENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')) # @@protoc_insertion_point(module_scope) diff --git a/protos/ruby/data_connector_service_pb.rb b/protos/ruby/data_connector_service_pb.rb new file mode 100644 index 0000000..f120d66 --- /dev/null +++ b/protos/ruby/data_connector_service_pb.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: data_connector_service.proto + +require 'google/protobuf' + + +descriptor_data = "\n\x1c\x64\x61ta_connector_service.proto\x12\x14telemetry.connectors\" \n\x11VinAllowedRequest\x12\x0b\n\x03Vin\x18\x01 \x01(\t\"%\n\x12VinAllowedResponse\x12\x0f\n\x07\x41llowed\x18\x01 \x01(\x08\x32q\n\x0eVehicleService\x12_\n\nVinAllowed\x12\'.telemetry.connectors.VinAllowedRequest\x1a(.telemetry.connectors.VinAllowedResponseB/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3" + +pool = Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Telemetry + module Connectors + VinAllowedRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("telemetry.connectors.VinAllowedRequest").msgclass + VinAllowedResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("telemetry.connectors.VinAllowedResponse").msgclass + end +end diff --git a/protos/ruby/data_connector_service_services_pb.rb b/protos/ruby/data_connector_service_services_pb.rb new file mode 100644 index 0000000..b9b5977 --- /dev/null +++ b/protos/ruby/data_connector_service_services_pb.rb @@ -0,0 +1,24 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: data_connector_service.proto for package 'telemetry.connectors' + +require 'grpc' +require 'data_connector_service_pb' + +module Telemetry + module Connectors + module VehicleService + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'telemetry.connectors.VehicleService' + + rpc :VinAllowed, ::Telemetry::Connectors::VinAllowedRequest, ::Telemetry::Connectors::VinAllowedResponse + end + + Stub = Service.rpc_stub_class + end + end +end diff --git a/protos/ruby/vehicle_alert_pb.rb b/protos/ruby/vehicle_alert_pb.rb index 83a0907..816b26a 100644 --- a/protos/ruby/vehicle_alert_pb.rb +++ b/protos/ruby/vehicle_alert_pb.rb @@ -10,29 +10,7 @@ descriptor_data = "\n\x13vehicle_alert.proto\x12\x18telemetry.vehicle_alerts\x1a\x1fgoogle/protobuf/timestamp.proto\"\x84\x01\n\rVehicleAlerts\x12\x36\n\x06\x61lerts\x18\x01 \x03(\x0b\x32&.telemetry.vehicle_alerts.VehicleAlert\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\xb1\x01\n\x0cVehicleAlert\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x35\n\taudiences\x18\x02 \x03(\x0e\x32\".telemetry.vehicle_alerts.Audience\x12.\n\nstarted_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nded_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp*B\n\x08\x41udience\x12\x0b\n\x07Unknown\x10\x00\x12\x0c\n\x08\x43ustomer\x10\x01\x12\x0b\n\x07Service\x10\x02\x12\x0e\n\nServiceFix\x10\x03\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool - -begin - pool.add_serialized_file(descriptor_data) -rescue TypeError - # Compatibility code: will be removed in the next major version. - require 'google/protobuf/descriptor_pb' - parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) - parsed.clear_dependency - serialized = parsed.class.encode(parsed) - file = pool.add_serialized_file(serialized) - warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" - imports = [ - ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], - ] - imports.each do |type_name, expected_filename| - import_file = pool.lookup(type_name).file_descriptor - if import_file.name != expected_filename - warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" - end - end - warn "Each proto file must use a consistent fully-qualified name." - warn "This will become an error in the next major version." -end +pool.add_serialized_file(descriptor_data) module Telemetry module VehicleAlerts diff --git a/protos/ruby/vehicle_data_pb.rb b/protos/ruby/vehicle_data_pb.rb index 3b8670c..fec864d 100644 --- a/protos/ruby/vehicle_data_pb.rb +++ b/protos/ruby/vehicle_data_pb.rb @@ -10,29 +10,7 @@ descriptor_data = "\n\x12vehicle_data.proto\x12\x16telemetry.vehicle_data\x1a\x1fgoogle/protobuf/timestamp.proto\"4\n\rLocationValue\x12\x10\n\x08latitude\x18\x01 \x01(\x01\x12\x11\n\tlongitude\x18\x02 \x01(\x01\"\xde\x02\n\x05Value\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x13\n\tint_value\x18\x02 \x01(\x05H\x00\x12\x14\n\nlong_value\x18\x03 \x01(\x03H\x00\x12\x15\n\x0b\x66loat_value\x18\x04 \x01(\x02H\x00\x12\x16\n\x0c\x64ouble_value\x18\x05 \x01(\x01H\x00\x12\x17\n\rboolean_value\x18\x06 \x01(\x08H\x00\x12?\n\x0elocation_value\x18\x07 \x01(\x0b\x32%.telemetry.vehicle_data.LocationValueH\x00\x12?\n\x0e\x63harging_value\x18\x08 \x01(\x0e\x32%.telemetry.vehicle_data.ChargingStateH\x00\x12?\n\x11shift_state_value\x18\t \x01(\x0e\x32\".telemetry.vehicle_data.ShiftStateH\x00\x42\x07\n\x05value\"a\n\x05\x44\x61tum\x12*\n\x03key\x18\x01 \x01(\x0e\x32\x1d.telemetry.vehicle_data.Field\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.telemetry.vehicle_data.Value\"s\n\x07Payload\x12+\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32\x1d.telemetry.vehicle_data.Datum\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t*\xe7\x1e\n\x05\x46ield\x12\x0b\n\x07Unknown\x10\x00\x12\r\n\tDriveRail\x10\x01\x12\x0f\n\x0b\x43hargeState\x10\x02\x12\x19\n\x15\x42msFullchargecomplete\x10\x03\x12\x10\n\x0cVehicleSpeed\x10\x04\x12\x0c\n\x08Odometer\x10\x05\x12\x0f\n\x0bPackVoltage\x10\x06\x12\x0f\n\x0bPackCurrent\x10\x07\x12\x07\n\x03Soc\x10\x08\x12\x0e\n\nDCDCEnable\x10\t\x12\x08\n\x04Gear\x10\n\x12\x17\n\x13IsolationResistance\x10\x0b\x12\x11\n\rPedalPosition\x10\x0c\x12\x0e\n\nBrakePedal\x10\r\x12\x0c\n\x08\x44iStateR\x10\x0e\x12\x10\n\x0c\x44iHeatsinkTR\x10\x0f\x12\x10\n\x0c\x44iAxleSpeedR\x10\x10\x12\x11\n\rDiTorquemotor\x10\x11\x12\x11\n\rDiStatorTempR\x10\x12\x12\x0b\n\x07\x44iVBatR\x10\x13\x12\x13\n\x0f\x44iMotorCurrentR\x10\x14\x12\x0c\n\x08Location\x10\x15\x12\x0c\n\x08GpsState\x10\x16\x12\x0e\n\nGpsHeading\x10\x17\x12\x16\n\x12NumBrickVoltageMax\x10\x18\x12\x13\n\x0f\x42rickVoltageMax\x10\x19\x12\x16\n\x12NumBrickVoltageMin\x10\x1a\x12\x13\n\x0f\x42rickVoltageMin\x10\x1b\x12\x14\n\x10NumModuleTempMax\x10\x1c\x12\x11\n\rModuleTempMax\x10\x1d\x12\x14\n\x10NumModuleTempMin\x10\x1e\x12\x11\n\rModuleTempMin\x10\x1f\x12\x0e\n\nRatedRange\x10 \x12\x08\n\x04Hvil\x10!\x12\x16\n\x12\x44\x43\x43hargingEnergyIn\x10\"\x12\x13\n\x0f\x44\x43\x43hargingPower\x10#\x12\x16\n\x12\x41\x43\x43hargingEnergyIn\x10$\x12\x13\n\x0f\x41\x43\x43hargingPower\x10%\x12\x12\n\x0e\x43hargeLimitSoc\x10&\x12\x16\n\x12\x46\x61stChargerPresent\x10\'\x12\x13\n\x0f\x45stBatteryRange\x10(\x12\x15\n\x11IdealBatteryRange\x10)\x12\x10\n\x0c\x42\x61tteryLevel\x10*\x12\x14\n\x10TimeToFullCharge\x10+\x12\x1e\n\x1aScheduledChargingStartTime\x10,\x12\x1c\n\x18ScheduledChargingPending\x10-\x12\x1a\n\x16ScheduledDepartureTime\x10.\x12\x1a\n\x16PreconditioningEnabled\x10/\x12\x19\n\x15ScheduledChargingMode\x10\x30\x12\x0e\n\nChargeAmps\x10\x31\x12\x17\n\x13\x43hargeEnableRequest\x10\x32\x12\x11\n\rChargerPhases\x10\x33\x12\x1d\n\x19\x43hargePortColdWeatherMode\x10\x34\x12\x18\n\x14\x43hargeCurrentRequest\x10\x35\x12\x1b\n\x17\x43hargeCurrentRequestMax\x10\x36\x12\x13\n\x0f\x42\x61tteryHeaterOn\x10\x37\x12\x18\n\x14NotEnoughPowerToHeat\x10\x38\x12\"\n\x1eSuperchargerSessionTripPlanner\x10\x39\x12\r\n\tDoorState\x10:\x12\n\n\x06Locked\x10;\x12\x0c\n\x08\x46\x64Window\x10<\x12\x0c\n\x08\x46pWindow\x10=\x12\x0c\n\x08RdWindow\x10>\x12\x0c\n\x08RpWindow\x10?\x12\x0f\n\x0bVehicleName\x10@\x12\x0e\n\nSentryMode\x10\x41\x12\x12\n\x0eSpeedLimitMode\x10\x42\x12\x13\n\x0f\x43urrentLimitMph\x10\x43\x12\x0b\n\x07Version\x10\x44\x12\x12\n\x0eTpmsPressureFl\x10\x45\x12\x12\n\x0eTpmsPressureFr\x10\x46\x12\x12\n\x0eTpmsPressureRl\x10G\x12\x12\n\x0eTpmsPressureRr\x10H\x12\x1e\n\x1aSemitruckTpmsPressureRe1L0\x10I\x12\x1e\n\x1aSemitruckTpmsPressureRe1L1\x10J\x12\x1e\n\x1aSemitruckTpmsPressureRe1R0\x10K\x12\x1e\n\x1aSemitruckTpmsPressureRe1R1\x10L\x12\x1e\n\x1aSemitruckTpmsPressureRe2L0\x10M\x12\x1e\n\x1aSemitruckTpmsPressureRe2L1\x10N\x12\x1e\n\x1aSemitruckTpmsPressureRe2R0\x10O\x12\x1e\n\x1aSemitruckTpmsPressureRe2R1\x10P\x12\x1e\n\x1aTpmsLastSeenPressureTimeFl\x10Q\x12\x1e\n\x1aTpmsLastSeenPressureTimeFr\x10R\x12\x1e\n\x1aTpmsLastSeenPressureTimeRl\x10S\x12\x1e\n\x1aTpmsLastSeenPressureTimeRr\x10T\x12\x0e\n\nInsideTemp\x10U\x12\x0f\n\x0bOutsideTemp\x10V\x12\x12\n\x0eSeatHeaterLeft\x10W\x12\x13\n\x0fSeatHeaterRight\x10X\x12\x16\n\x12SeatHeaterRearLeft\x10Y\x12\x17\n\x13SeatHeaterRearRight\x10Z\x12\x18\n\x14SeatHeaterRearCenter\x10[\x12\x17\n\x13\x41utoSeatClimateLeft\x10\\\x12\x18\n\x14\x41utoSeatClimateRight\x10]\x12\x12\n\x0e\x44riverSeatBelt\x10^\x12\x15\n\x11PassengerSeatBelt\x10_\x12\x16\n\x12\x44riverSeatOccupied\x10`\x12&\n\"SemitruckPassengerSeatFoldPosition\x10\x61\x12\x17\n\x13LateralAcceleration\x10\x62\x12\x1c\n\x18LongitudinalAcceleration\x10\x63\x12\x0f\n\x0b\x43ruiseState\x10\x64\x12\x12\n\x0e\x43ruiseSetSpeed\x10\x65\x12\x16\n\x12LifetimeEnergyUsed\x10\x66\x12\x1b\n\x17LifetimeEnergyUsedDrive\x10g\x12#\n\x1fSemitruckTractorParkBrakeStatus\x10h\x12#\n\x1fSemitruckTrailerParkBrakeStatus\x10i\x12\x11\n\rBrakePedalPos\x10j\x12\x14\n\x10RouteLastUpdated\x10k\x12\r\n\tRouteLine\x10l\x12\x12\n\x0eMilesToArrival\x10m\x12\x14\n\x10MinutesToArrival\x10n\x12\x12\n\x0eOriginLocation\x10o\x12\x17\n\x13\x44\x65stinationLocation\x10p\x12\x0b\n\x07\x43\x61rType\x10q\x12\x08\n\x04Trim\x10r\x12\x11\n\rExteriorColor\x10s\x12\r\n\tRoofColor\x10t\x12\x0e\n\nChargePort\x10u\x12\x13\n\x0f\x43hargePortLatch\x10v\x12\x12\n\x0e\x45xperimental_1\x10w\x12\x12\n\x0e\x45xperimental_2\x10x\x12\x12\n\x0e\x45xperimental_3\x10y\x12\x12\n\x0e\x45xperimental_4\x10z\x12\x14\n\x10GuestModeEnabled\x10{\x12\x15\n\x11PinToDriveEnabled\x10|\x12\x1e\n\x1aPairedPhoneKeyAndKeyFobQty\x10}\x12\x18\n\x14\x43ruiseFollowDistance\x10~\x12\x1c\n\x18\x41utomaticBlindSpotCamera\x10\x7f\x12#\n\x1e\x42lindSpotCollisionWarningChime\x10\x80\x01\x12\x16\n\x11SpeedLimitWarning\x10\x81\x01\x12\x1c\n\x17\x46orwardCollisionWarning\x10\x82\x01\x12\x1b\n\x16LaneDepartureAvoidance\x10\x83\x01\x12$\n\x1f\x45mergencyLaneDepartureAvoidance\x10\x84\x01\x12!\n\x1c\x41utomaticEmergencyBrakingOff\x10\x85\x01\x12\x1e\n\x19LifetimeEnergyGainedRegen\x10\x86\x01\x12\r\n\x08\x44iStateF\x10\x87\x01\x12\x0f\n\nDiStateREL\x10\x88\x01\x12\x0f\n\nDiStateRER\x10\x89\x01\x12\x11\n\x0c\x44iHeatsinkTF\x10\x8a\x01\x12\x13\n\x0e\x44iHeatsinkTREL\x10\x8b\x01\x12\x13\n\x0e\x44iHeatsinkTRER\x10\x8c\x01\x12\x11\n\x0c\x44iAxleSpeedF\x10\x8d\x01\x12\x13\n\x0e\x44iAxleSpeedREL\x10\x8e\x01\x12\x13\n\x0e\x44iAxleSpeedRER\x10\x8f\x01\x12\x15\n\x10\x44iSlaveTorqueCmd\x10\x90\x01\x12\x14\n\x0f\x44iTorqueActualR\x10\x91\x01\x12\x14\n\x0f\x44iTorqueActualF\x10\x92\x01\x12\x16\n\x11\x44iTorqueActualREL\x10\x93\x01\x12\x16\n\x11\x44iTorqueActualRER\x10\x94\x01\x12\x12\n\rDiStatorTempF\x10\x95\x01\x12\x14\n\x0f\x44iStatorTempREL\x10\x96\x01\x12\x14\n\x0f\x44iStatorTempRER\x10\x97\x01\x12\x0c\n\x07\x44iVBatF\x10\x98\x01\x12\x0e\n\tDiVBatREL\x10\x99\x01\x12\x0e\n\tDiVBatRER\x10\x9a\x01\x12\x14\n\x0f\x44iMotorCurrentF\x10\x9b\x01\x12\x16\n\x11\x44iMotorCurrentREL\x10\x9c\x01\x12\x16\n\x11\x44iMotorCurrentRER\x10\x9d\x01\x12\x14\n\x0f\x45nergyRemaining\x10\x9e\x01\x12\x10\n\x0bServiceMode\x10\x9f\x01\x12\r\n\x08\x42MSState\x10\xa0\x01\x12\x1f\n\x1aGuestModeMobileAccessState\x10\xa1\x01\x12\x11\n\x0c\x44\x65precated_1\x10\xa2\x01\x12\x14\n\x0f\x44\x65stinationName\x10\xa3\x01\x12\x11\n\x0c\x44iInverterTR\x10\xa4\x01\x12\x11\n\x0c\x44iInverterTF\x10\xa5\x01\x12\x13\n\x0e\x44iInverterTREL\x10\xa6\x01\x12\x13\n\x0e\x44iInverterTRER\x10\xa7\x01\x12\x13\n\x0e\x45xperimental_5\x10\xa8\x01\x12\x13\n\x0e\x45xperimental_6\x10\xa9\x01\x12\x13\n\x0e\x45xperimental_7\x10\xaa\x01\x12\x13\n\x0e\x45xperimental_8\x10\xab\x01\x12\x13\n\x0e\x45xperimental_9\x10\xac\x01\x12\x14\n\x0f\x45xperimental_10\x10\xad\x01\x12\x14\n\x0f\x45xperimental_11\x10\xae\x01\x12\x14\n\x0f\x45xperimental_12\x10\xaf\x01\x12\x14\n\x0f\x45xperimental_13\x10\xb0\x01\x12\x14\n\x0f\x45xperimental_14\x10\xb1\x01\x12\x14\n\x0f\x45xperimental_15\x10\xb2\x01*\xbf\x01\n\rChargingState\x12\x16\n\x12\x43hargeStateUnknown\x10\x00\x12\x1b\n\x17\x43hargeStateDisconnected\x10\x01\x12\x16\n\x12\x43hargeStateNoPower\x10\x02\x12\x17\n\x13\x43hargeStateStarting\x10\x03\x12\x17\n\x13\x43hargeStateCharging\x10\x04\x12\x17\n\x13\x43hargeStateComplete\x10\x05\x12\x16\n\x12\x43hargeStateStopped\x10\x06*\x91\x01\n\nShiftState\x12\x15\n\x11ShiftStateUnknown\x10\x00\x12\x15\n\x11ShiftStateInvalid\x10\x01\x12\x0f\n\x0bShiftStateP\x10\x02\x12\x0f\n\x0bShiftStateR\x10\x03\x12\x0f\n\x0bShiftStateD\x10\x04\x12\x0f\n\x0bShiftStateN\x10\x05\x12\x11\n\rShiftStateSNA\x10\x06\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool - -begin - pool.add_serialized_file(descriptor_data) -rescue TypeError - # Compatibility code: will be removed in the next major version. - require 'google/protobuf/descriptor_pb' - parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) - parsed.clear_dependency - serialized = parsed.class.encode(parsed) - file = pool.add_serialized_file(serialized) - warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" - imports = [ - ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], - ] - imports.each do |type_name, expected_filename| - import_file = pool.lookup(type_name).file_descriptor - if import_file.name != expected_filename - warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" - end - end - warn "Each proto file must use a consistent fully-qualified name." - warn "This will become an error in the next major version." -end +pool.add_serialized_file(descriptor_data) module Telemetry module VehicleData diff --git a/protos/ruby/vehicle_error_pb.rb b/protos/ruby/vehicle_error_pb.rb index d0e218e..61940ec 100644 --- a/protos/ruby/vehicle_error_pb.rb +++ b/protos/ruby/vehicle_error_pb.rb @@ -10,29 +10,7 @@ descriptor_data = "\n\x13vehicle_error.proto\x12\x17telemetry.vehicle_error\x1a\x1fgoogle/protobuf/timestamp.proto\"\x83\x01\n\rVehicleErrors\x12\x35\n\x06\x65rrors\x18\x01 \x03(\x0b\x32%.telemetry.vehicle_error.VehicleError\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\xc6\x01\n\x0cVehicleError\x12.\n\ncreated_at\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0c\n\x04name\x18\x02 \x01(\t\x12=\n\x04tags\x18\x03 \x03(\x0b\x32/.telemetry.vehicle_error.VehicleError.TagsEntry\x12\x0c\n\x04\x62ody\x18\x04 \x01(\t\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool - -begin - pool.add_serialized_file(descriptor_data) -rescue TypeError - # Compatibility code: will be removed in the next major version. - require 'google/protobuf/descriptor_pb' - parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) - parsed.clear_dependency - serialized = parsed.class.encode(parsed) - file = pool.add_serialized_file(serialized) - warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" - imports = [ - ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], - ] - imports.each do |type_name, expected_filename| - import_file = pool.lookup(type_name).file_descriptor - if import_file.name != expected_filename - warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" - end - end - warn "Each proto file must use a consistent fully-qualified name." - warn "This will become an error in the next major version." -end +pool.add_serialized_file(descriptor_data) module Telemetry module VehicleError diff --git a/protos/ruby/vehicle_metric_pb.rb b/protos/ruby/vehicle_metric_pb.rb index 37b80e7..9b6fd2b 100644 --- a/protos/ruby/vehicle_metric_pb.rb +++ b/protos/ruby/vehicle_metric_pb.rb @@ -10,29 +10,7 @@ descriptor_data = "\n\x14vehicle_metric.proto\x12\x19telemetry.vehicle_metrics\x1a\x1fgoogle/protobuf/timestamp.proto\"\x81\x01\n\x0eVehicleMetrics\x12\x32\n\x07metrics\x18\x01 \x03(\x0b\x32!.telemetry.vehicle_metrics.Metric\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0b\n\x03vin\x18\x03 \x01(\t\"\x8d\x01\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x39\n\x04tags\x18\x02 \x03(\x0b\x32+.telemetry.vehicle_metrics.Metric.TagsEntry\x12\r\n\x05value\x18\x03 \x01(\x01\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42/Z-github.com/teslamotors/fleet-telemetry/protosb\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool - -begin - pool.add_serialized_file(descriptor_data) -rescue TypeError - # Compatibility code: will be removed in the next major version. - require 'google/protobuf/descriptor_pb' - parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data) - parsed.clear_dependency - serialized = parsed.class.encode(parsed) - file = pool.add_serialized_file(serialized) - warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" - imports = [ - ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], - ] - imports.each do |type_name, expected_filename| - import_file = pool.lookup(type_name).file_descriptor - if import_file.name != expected_filename - warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}" - end - end - warn "Each proto file must use a consistent fully-qualified name." - warn "This will become an error in the next major version." -end +pool.add_serialized_file(descriptor_data) module Telemetry module VehicleMetrics diff --git a/server/streaming/server.go b/server/streaming/server.go index d4cad62..a2826fd 100644 --- a/server/streaming/server.go +++ b/server/streaming/server.go @@ -34,8 +34,10 @@ var ( // Metrics stores metrics reported from this package type ServerMetrics struct { - reliableAckCount adapter.Counter - reliableAckMissCount adapter.Counter + reliableAckCount adapter.Counter + reliableAckMissCount adapter.Counter + vinAllowedResultCount adapter.Counter + vinAllowedErrorCount adapter.Counter } // Server stores server resources @@ -127,6 +129,12 @@ func (s *Server) ServeBinaryWs(config *config.Config) func(w http.ResponseWriter s.logger.ErrorLog("extract_sender_id_err", err, nil) } + allowed := s.isConnectionAllowed(config, requestIdentity.DeviceID) + if !allowed { + ws.Close() + return + } + socketManager := NewSocketManager(ctx, requestIdentity, ws, config, s.logger) s.registry.RegisterSocket(socketManager) defer s.registry.DeregisterSocket(socketManager) @@ -150,6 +158,20 @@ func (s *Server) promoteToWebsocket(w http.ResponseWriter, r *http.Request) *web return ws } +func (s *Server) isConnectionAllowed(config *config.Config, deviceID string) bool { + allowed, err := config.DataConnector.VinAllowed(deviceID) + if err != nil { + serverMetricsRegistry.vinAllowedErrorCount.Inc(nil) + s.logger.ErrorLog("check_vin_allowed_error", err, logrus.LogInfo{"vin": deviceID}) + } + if !allowed { + s.logger.Log(logrus.INFO, "vin_rejected", logrus.LogInfo{"vin": deviceID}) + } + + serverMetricsRegistry.vinAllowedResultCount.Inc(adapter.Labels{"allowed": fmt.Sprintf("%t", allowed)}) + return allowed +} + func extractIdentityFromConnection(ctx context.Context, r *http.Request) (*telemetry.RequestIdentity, error) { cert, err := extractCertFromHeaders(ctx, r) if err != nil { @@ -192,4 +214,16 @@ func registerServerMetrics(metricsCollector metrics.MetricCollector) { Help: "The number of missing reliable acknowledgements.", Labels: []string{"record_type", "dispatcher"}, }) + + serverMetricsRegistry.vinAllowedResultCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "vin_allowed_result_count", + Help: "The number of vins checked from data connector.", + Labels: []string{"allowed"}, + }) + + serverMetricsRegistry.vinAllowedErrorCount = metricsCollector.RegisterCounter(adapter.CollectorOptions{ + Name: "vin_allowed_error_count", + Help: "The number of errors responses from data connector.", + Labels: []string{}, + }) } diff --git a/test/integration/config.json b/test/integration/config.json index d58f25b..57f2d16 100644 --- a/test/integration/config.json +++ b/test/integration/config.json @@ -56,5 +56,18 @@ "project_key": "test1", "environment": "integration", "host": "http://errbit:48088" + }, + "data_connector": { + "sources": { + "redis": { + "client": { + "Addr": "redis:6379" + }, + "vin_allowed_prefix": "vin_allowed:" + } + }, + "capabilities": { + "redis": ["vin_allowed"] + } } } diff --git a/test/integration/integration_suite_test.go b/test/integration/integration_suite_test.go index 172be95..c3064ed 100644 --- a/test/integration/integration_suite_test.go +++ b/test/integration/integration_suite_test.go @@ -2,15 +2,12 @@ package integration_test import ( "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - - types "github.com/onsi/ginkgo/v2/types" ) func TestTelemetry(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "Integration Suite Tests", types.ReporterConfig{SlowSpecThreshold: 10 * time.Second}) + RunSpecs(t, "Integration Suite Tests") } diff --git a/test/integration/integration_test.go b/test/integration/integration_test.go index ec79252..41f4787 100644 --- a/test/integration/integration_test.go +++ b/test/integration/integration_test.go @@ -1,6 +1,7 @@ package integration_test import ( + "context" "crypto/tls" "fmt" "io" @@ -16,6 +17,7 @@ import ( "github.com/aws/aws-sdk-go/service/kinesis" "github.com/confluentinc/confluent-kafka-go/v2/kafka" "github.com/gorilla/websocket" + "github.com/redis/go-redis/v9" "github.com/sirupsen/logrus" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" @@ -25,16 +27,17 @@ import ( ) const ( - vehicleName = "My Test Vehicle" - location = "(37.412374 S, 122.145867 E)" - projectID = "test-project-id" - subscriptionID = "sub-id-1" - kafkaGroup = "test-kafka-consumer" - kafkaBroker = "kafka:9092" - pubsubHost = "pubsub:8085" - zmqAddr = "tcp://app:5284" - kinesisHost = "http://kinesis:4567" - kinesisStreamName = "test_V" + vehicleName = "My Test Vehicle" + location = "(37.412374 S, 122.145867 E)" + projectID = "test-project-id" + subscriptionID = "sub-id-1" + kafkaGroup = "test-kafka-consumer" + kafkaBroker = "kafka:9092" + pubsubHost = "pubsub:8085" + zmqAddr = "tcp://app:5284" + kinesisHost = "http://kinesis:4567" + kinesisStreamName = "test_V" + redisVinAllowedPrefix = "vin_allowed:" ) var expectedLocation = &protos.LocationValue{Latitude: -37.412374, Longitude: 122.145867} @@ -56,6 +59,7 @@ var _ = Describe("Test messages", Ordered, func() { tlsConfig *tls.Config timestamp *timestamppb.Timestamp logger *logrus.Logger + redisClient *redis.Client ) BeforeAll(func() { @@ -65,6 +69,10 @@ var _ = Describe("Test messages", Ordered, func() { Expect(err).NotTo(HaveOccurred()) timestamp = timestamppb.Now() + redisClient = redis.NewClient(&redis.Options{ + Addr: "redis:6379", + }) + payload = GenerateVehicleMessage(vehicleName, location, timestamp) connection = CreateWebSocket(tlsConfig) @@ -94,6 +102,26 @@ var _ = Describe("Test messages", Ordered, func() { os.Clearenv() }) + It("enforces vin allowed on connection creation", func() { + connection = CreateWebSocket(tlsConfig) + terminated := false + connection.SetCloseHandler(func(code int, text string) error { + terminated = true + return nil + }) + + // vin not allowed, connection should be terminated + Eventually(func() { + Expect(terminated).To(BeTrue()) + }) + + // allow the vin so other tests may proceed + status := redisClient.Set(context.Background(), fmt.Sprintf("%s%s", redisVinAllowedPrefix, deviceID), "1", 0) + Expect(status.Err()).NotTo(HaveOccurred()) + + connection = CreateWebSocket(tlsConfig) + }) + It("reads vehicle data from kafka consumer", func() { defer GinkgoRecover() err := kafkaConsumer.Subscribe(vehicleTopic, nil) diff --git a/test/mocks/data_connector_service_grpc.go b/test/mocks/data_connector_service_grpc.go new file mode 100644 index 0000000..2db8479 --- /dev/null +++ b/test/mocks/data_connector_service_grpc.go @@ -0,0 +1,147 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: protos/data_connector_service_grpc.pb.go +// +// Generated by this command: +// +// mockgen -source protos/data_connector_service_grpc.pb.go -destination=test/mocks/data_connector_service_grpc.go -package mocks +// + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + reflect "reflect" + + protos "github.com/teslamotors/fleet-telemetry/protos" + gomock "go.uber.org/mock/gomock" + grpc "google.golang.org/grpc" +) + +// MockVehicleServiceClient is a mock of VehicleServiceClient interface. +type MockVehicleServiceClient struct { + ctrl *gomock.Controller + recorder *MockVehicleServiceClientMockRecorder +} + +// MockVehicleServiceClientMockRecorder is the mock recorder for MockVehicleServiceClient. +type MockVehicleServiceClientMockRecorder struct { + mock *MockVehicleServiceClient +} + +// NewMockVehicleServiceClient creates a new mock instance. +func NewMockVehicleServiceClient(ctrl *gomock.Controller) *MockVehicleServiceClient { + mock := &MockVehicleServiceClient{ctrl: ctrl} + mock.recorder = &MockVehicleServiceClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockVehicleServiceClient) EXPECT() *MockVehicleServiceClientMockRecorder { + return m.recorder +} + +// VinAllowed mocks base method. +func (m *MockVehicleServiceClient) VinAllowed(ctx context.Context, in *protos.VinAllowedRequest, opts ...grpc.CallOption) (*protos.VinAllowedResponse, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "VinAllowed", varargs...) + ret0, _ := ret[0].(*protos.VinAllowedResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VinAllowed indicates an expected call of VinAllowed. +func (mr *MockVehicleServiceClientMockRecorder) VinAllowed(ctx, in any, opts ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VinAllowed", reflect.TypeOf((*MockVehicleServiceClient)(nil).VinAllowed), varargs...) +} + +// MockVehicleServiceServer is a mock of VehicleServiceServer interface. +type MockVehicleServiceServer struct { + ctrl *gomock.Controller + recorder *MockVehicleServiceServerMockRecorder +} + +// MockVehicleServiceServerMockRecorder is the mock recorder for MockVehicleServiceServer. +type MockVehicleServiceServerMockRecorder struct { + mock *MockVehicleServiceServer +} + +// NewMockVehicleServiceServer creates a new mock instance. +func NewMockVehicleServiceServer(ctrl *gomock.Controller) *MockVehicleServiceServer { + mock := &MockVehicleServiceServer{ctrl: ctrl} + mock.recorder = &MockVehicleServiceServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockVehicleServiceServer) EXPECT() *MockVehicleServiceServerMockRecorder { + return m.recorder +} + +// VinAllowed mocks base method. +func (m *MockVehicleServiceServer) VinAllowed(arg0 context.Context, arg1 *protos.VinAllowedRequest) (*protos.VinAllowedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VinAllowed", arg0, arg1) + ret0, _ := ret[0].(*protos.VinAllowedResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VinAllowed indicates an expected call of VinAllowed. +func (mr *MockVehicleServiceServerMockRecorder) VinAllowed(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VinAllowed", reflect.TypeOf((*MockVehicleServiceServer)(nil).VinAllowed), arg0, arg1) +} + +// mustEmbedUnimplementedVehicleServiceServer mocks base method. +func (m *MockVehicleServiceServer) mustEmbedUnimplementedVehicleServiceServer() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "mustEmbedUnimplementedVehicleServiceServer") +} + +// mustEmbedUnimplementedVehicleServiceServer indicates an expected call of mustEmbedUnimplementedVehicleServiceServer. +func (mr *MockVehicleServiceServerMockRecorder) mustEmbedUnimplementedVehicleServiceServer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "mustEmbedUnimplementedVehicleServiceServer", reflect.TypeOf((*MockVehicleServiceServer)(nil).mustEmbedUnimplementedVehicleServiceServer)) +} + +// MockUnsafeVehicleServiceServer is a mock of UnsafeVehicleServiceServer interface. +type MockUnsafeVehicleServiceServer struct { + ctrl *gomock.Controller + recorder *MockUnsafeVehicleServiceServerMockRecorder +} + +// MockUnsafeVehicleServiceServerMockRecorder is the mock recorder for MockUnsafeVehicleServiceServer. +type MockUnsafeVehicleServiceServerMockRecorder struct { + mock *MockUnsafeVehicleServiceServer +} + +// NewMockUnsafeVehicleServiceServer creates a new mock instance. +func NewMockUnsafeVehicleServiceServer(ctrl *gomock.Controller) *MockUnsafeVehicleServiceServer { + mock := &MockUnsafeVehicleServiceServer{ctrl: ctrl} + mock.recorder = &MockUnsafeVehicleServiceServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockUnsafeVehicleServiceServer) EXPECT() *MockUnsafeVehicleServiceServerMockRecorder { + return m.recorder +} + +// mustEmbedUnimplementedVehicleServiceServer mocks base method. +func (m *MockUnsafeVehicleServiceServer) mustEmbedUnimplementedVehicleServiceServer() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "mustEmbedUnimplementedVehicleServiceServer") +} + +// mustEmbedUnimplementedVehicleServiceServer indicates an expected call of mustEmbedUnimplementedVehicleServiceServer. +func (mr *MockUnsafeVehicleServiceServerMockRecorder) mustEmbedUnimplementedVehicleServiceServer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "mustEmbedUnimplementedVehicleServiceServer", reflect.TypeOf((*MockUnsafeVehicleServiceServer)(nil).mustEmbedUnimplementedVehicleServiceServer)) +}