Skip to content

Commit

Permalink
Merge pull request #252 from USACE/v4
Browse files Browse the repository at this point in the history
Merge v4 to develop
  • Loading branch information
dennisgsmith authored Feb 19, 2025
2 parents 6c1a376 + 45dbd5e commit 50fc586
Show file tree
Hide file tree
Showing 200 changed files with 13,221 additions and 47,279 deletions.
26 changes: 0 additions & 26 deletions api/Dockerfile.openapi

This file was deleted.

4 changes: 2 additions & 2 deletions api/cmd/midas-alert/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"log"
"time"

"github.com/USACE/instrumentation-api/api/internal/config"
"github.com/USACE/instrumentation-api/api/internal/handler"
"github.com/USACE/instrumentation-api/api/v4/internal/config"
"github.com/USACE/instrumentation-api/api/v4/internal/handler"
)

func main() {
Expand Down
29 changes: 3 additions & 26 deletions api/cmd/midas-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,15 @@ package main
import (
"log"

"github.com/USACE/instrumentation-api/api/internal/config"
"github.com/USACE/instrumentation-api/api/internal/handler"
"github.com/USACE/instrumentation-api/api/internal/server"
"github.com/USACE/instrumentation-api/api/v4/internal/config"
"github.com/USACE/instrumentation-api/api/v4/internal/handler"
)

// @title MIDAS Web API
// @version 3.4.0
// @description Monitoring Instrumentation Data Acquisition Systems (MIDAS) Web API

// @license.name MIT
// @license.url https://github.com/USACE/instrumentation-api/blob/555ea51191ff1245fe5910a295862be7514aaec6/LICENSE.md

// @securityDefinitions.apikey Bearer
// @in header
// @name Authorization
// @description Type "Bearer" followed by a space and access token.

// @securityDefinitions.apikey ClaimsOnly
// @in header
// @name Authorization
// @description CAC-Only routes

// @scope.admin Grants read and write access to administrative information
// @scope.project_admin Grants project members read and write access to projects
// @scope.project_member Read and write permissions per-project granted by project admin
func main() {
cfg := config.NewApiConfig()

h := handler.NewApi(cfg)

s := server.NewApiServer(cfg, h)

log.Print("starting server...")
log.Fatal(s.Start())
log.Fatal(h.Router.Start())
}
4 changes: 2 additions & 2 deletions api/cmd/midas-dcs-loader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"log"

"github.com/USACE/instrumentation-api/api/internal/config"
"github.com/USACE/instrumentation-api/api/internal/handler"
"github.com/USACE/instrumentation-api/api/v4/internal/config"
"github.com/USACE/instrumentation-api/api/v4/internal/handler"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions api/cmd/midas-sql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"strconv"
"strings"

"github.com/USACE/instrumentation-api/api/internal/config"
"github.com/USACE/instrumentation-api/api/internal/migrate"
"github.com/USACE/instrumentation-api/api/migrations"
"github.com/USACE/instrumentation-api/api/v4/internal/config"
"github.com/USACE/instrumentation-api/api/v4/internal/migrate"
"github.com/USACE/instrumentation-api/api/v4/migrations"
)

func main() {
Expand Down
9 changes: 3 additions & 6 deletions api/cmd/midas-telemetry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@ package main
import (
"log"

"github.com/USACE/instrumentation-api/api/internal/config"
"github.com/USACE/instrumentation-api/api/internal/handler"
"github.com/USACE/instrumentation-api/api/internal/server"
"github.com/USACE/instrumentation-api/api/v4/internal/config"
"github.com/USACE/instrumentation-api/api/v4/internal/handler"
)

func main() {
cfg := config.NewTelemetryConfig()

h := handler.NewTelemetry(cfg)

s := server.NewTelemetryServer(cfg, h)

log.Print("starting server...")
log.Fatal(s.Start())
log.Fatal(h.Router.Start())
}
10 changes: 6 additions & 4 deletions api/go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module github.com/USACE/instrumentation-api/api
module github.com/USACE/instrumentation-api/api/v4

go 1.23

toolchain go1.23.0

require (
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible
github.com/USACE/instrumentation-api/api v0.0.0-20250128053738-f5dcec98f2b4
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/aws/aws-lambda-go v1.47.0
github.com/aws/aws-sdk-go-v2 v1.32.6
Expand All @@ -15,14 +16,15 @@ require (
github.com/aws/aws-sdk-go-v2/service/sqs v1.37.2
github.com/btcsuite/btcutil v1.0.2
github.com/caarlos0/env/v11 v11.3.0
github.com/danielgtaylor/huma/v2 v2.27.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/uuid v1.6.0
github.com/hashicorp/go-version v1.7.0
github.com/jackc/pgx/v5 v5.7.1
github.com/labstack/echo-jwt/v4 v4.3.0
github.com/labstack/echo/v4 v4.13.2
github.com/stretchr/testify v1.10.0
github.com/tidwall/btree v1.7.0
github.com/twpayne/go-geom v1.5.7
github.com/xeipuuv/gojsonschema v1.2.0
github.com/xuri/excelize/v2 v2.9.0
golang.org/x/crypto v0.31.0
Expand Down Expand Up @@ -50,15 +52,15 @@ require (
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/labstack/echo-jwt/v4 v4.3.0 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/richardlehane/mscfb v1.0.4 // indirect
github.com/richardlehane/msoleps v1.0.4 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
Expand Down
18 changes: 16 additions & 2 deletions api/go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/USACE/instrumentation-api/api v0.0.0-20250128040947-b3e6fea9cc91 h1:KpJKOXgCvM73R3g9f8kv/u2+QRUZYsMoqAs8G0xQ+4M=
github.com/USACE/instrumentation-api/api v0.0.0-20250128040947-b3e6fea9cc91/go.mod h1:j5bSeEjURqIXv6W1/RZjbcvabAcuZwmkQFsBXjnu3Wc=
github.com/USACE/instrumentation-api/api v0.0.0-20250128052712-094a1dafb44c h1:CxCw3D4/6sbBltrQNnk9UrcU7OtAU9hw0SDAscs0t+U=
github.com/USACE/instrumentation-api/api v0.0.0-20250128052712-094a1dafb44c/go.mod h1:j5bSeEjURqIXv6W1/RZjbcvabAcuZwmkQFsBXjnu3Wc=
github.com/USACE/instrumentation-api/api v0.0.0-20250128053738-f5dcec98f2b4 h1:+V8qMbEmvpCUTBalr9TfejD6cPWugHLWKkU8E57WTM8=
github.com/USACE/instrumentation-api/api v0.0.0-20250128053738-f5dcec98f2b4/go.mod h1:j5bSeEjURqIXv6W1/RZjbcvabAcuZwmkQFsBXjnu3Wc=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/alecthomas/assert/v2 v2.10.0 h1:jjRCHsj6hBJhkmhznrCzoNpbA3zqy0fYiUcYZP/GkPY=
github.com/alecthomas/assert/v2 v2.10.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPwqqXc4/vE0f7GvRjuAsbW+HOIe8KnA=
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw=
github.com/aws/aws-lambda-go v1.47.0 h1:0H8s0vumYx/YKs4sE7YM0ktwL2eWse+kfopsRI1sXVI=
Expand Down Expand Up @@ -58,6 +68,8 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f
github.com/caarlos0/env/v11 v11.3.0 h1:CVTN6W6+twFC1jHKUwsw9eOTEiFpzyJOSA2AyHa8uvw=
github.com/caarlos0/env/v11 v11.3.0/go.mod h1:Q5lYHeOsgY20CCV/R+b50Jwg2MnjySid7+3FUBz2BJw=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/danielgtaylor/huma/v2 v2.27.0 h1:yxgJ8GqYqKeXw/EnQ4ZNc2NBpmn49AlhxL2+ksSXjUI=
github.com/danielgtaylor/huma/v2 v2.27.0/go.mod h1:NbSFXRoOMh3BVmiLJQ9EbUpnPas7D9BeOxF/pZBAGa0=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -70,6 +82,8 @@ 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/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
Expand Down Expand Up @@ -103,7 +117,6 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwd
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM=
Expand All @@ -112,7 +125,6 @@ github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTK
github.com/richardlehane/msoleps v1.0.4 h1:WuESlvhX3gH2IHcd8UqyCuFY5yiq/GR/yqaSM/9/g00=
github.com/richardlehane/msoleps v1.0.4/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg=
Expand All @@ -123,6 +135,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI=
github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
github.com/twpayne/go-geom v1.5.7 h1:7fdceDUr03/MP7rAKOaTV6x9njMiQdxB/D0PDzMTCDc=
github.com/twpayne/go-geom v1.5.7/go.mod h1:y4fTAQtLedXW8eG2Yo4tYrIGN1yIwwKkmA+K3iSHKBA=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
Expand Down
2 changes: 1 addition & 1 deletion api/internal/cloud/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"

"github.com/USACE/instrumentation-api/api/internal/config"
"github.com/USACE/instrumentation-api/api/v4/internal/config"
"github.com/aws/aws-sdk-go-v2/aws"
s3manager "github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/service/s3"
Expand Down
2 changes: 1 addition & 1 deletion api/internal/cloud/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"log"
"net/http"

"github.com/USACE/instrumentation-api/api/internal/config"
"github.com/USACE/instrumentation-api/api/v4/internal/config"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-sdk-go-v2/service/sqs"
sqsTypes "github.com/aws/aws-sdk-go-v2/service/sqs/types"
Expand Down
5 changes: 3 additions & 2 deletions api/internal/config/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"log"
"os"

"github.com/USACE/instrumentation-api/api/internal/tz"
"github.com/USACE/instrumentation-api/api/v4/internal/tz"
)

// Config stores configuration information stored in environment variables
type ApiConfig struct {
BuildTag string
BuildTag string
AuthOidcUrl string `env:"AUTH_OIDC_URL"`
DBConfig
AWSS3Config
AWSSQSConfig
Expand Down
1 change: 1 addition & 0 deletions api/internal/config/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ type ServerConfig struct {
RequestLoggerEnabled bool `env:"REQUEST_LOGGER_ENABLED"`
RoutePrefix string `env:"ROUTE_PREFIX"`
ServerBaseUrl string `env:"SERVER_BASE_URL"`
StackSizeKB int `env:"STACK_SIZE_KB" envDefault:"1"`
AvailableTimezones []string
}
12 changes: 12 additions & 0 deletions api/internal/ctxkey/ctxkey.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package ctxkey

type ContextKey string

const (
Profile ContextKey = "Profile"
ProfileClaims ContextKey = "ProfileClaims"
UserJWT ContextKey = "UserJWT"
AppKeyAuthSuccess ContextKey = "AppKeyAuthSuccess"
KeyAuthSuccess ContextKey = "KeyAuthSuccess"
KeyAuthKeyID ContextKey = "KeyAuthKeyID"
)
2 changes: 1 addition & 1 deletion api/internal/db/alert.sql_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions api/internal/db/plot_config.manual.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package db

import (
"time"

"github.com/google/uuid"
)

type PlotConfigBullseyePlot struct {
VPlotConfiguration
Display PlotConfigBullseyePlotDisplay `json:"display"`
}

type PlotConfigBullseyePlotDisplay struct {
XAxisTimeseriesID uuid.UUID `json:"x_axis_timeseries_id"`
YAxisTimeseriesID uuid.UUID `json:"y_axis_timeseries_id"`
}

type PlotConfigContourPlot struct {
VPlotConfiguration
Display PlotConfigContourPlotDisplay `json:"display"`
}

type PlotConfigContourPlotDisplay struct {
TimeseriesIDs []uuid.UUID `json:"timeseries_ids"`
Time *time.Time `json:"time"`
LocfBackfill string `json:"locf_backfill"`
GradientSmoothing bool `json:"gradient_smoothing"`
ContourSmoothing bool `json:"contour_smoothing"`
ShowLabels bool `json:"show_labels"`
}

type PlotConfigProfilePlot struct {
VPlotConfiguration
Display PlotConfigProfilePlotDisplay `json:"display"`
}

type PlotConfigProfilePlotDisplay struct {
InstrumentID uuid.UUID `json:"instrument_id"`
InstrumentType string `json:"instrument_type,omitempty"`
}

type PlotConfigScatterLinePlot struct {
VPlotConfiguration
Display PlotConfigScatterLineDisplay `json:"display"`
}

type PlotConfigScatterLineDisplay struct {
Traces []PlotConfigScatterLineTimeseriesTrace `json:"traces"`
Layout PlotConfigScatterLineLayout `json:"layout"`
}

type PlotConfigScatterLineTimeseriesTrace struct {
PlotConfigurationID uuid.UUID `json:"plot_configuration_id"`
TimeseriesID uuid.UUID `json:"timeseries_id"`
Name string `json:"name"` // read-only
Parameter string `json:"parameter"` // read-only
TraceOrder int `json:"trace_order"`
TraceType string `json:"trace_type"`
Color string `json:"color"`
LineStyle string `json:"line_style"`
Width float32 `json:"width"`
ShowMarkers bool `json:"show_markers"`
YAxis string `json:"y_axis"` // y1 or y2, default y1
}

type PlotConfigScatterLineLayout struct {
CustomShapes []PlotConfigScatterLineCustomShape `json:"custom_shapes"`
YAxisTitle *string `json:"y_axis_title"`
Y2AxisTitle *string `json:"y2_axis_title"`
}

type PlotConfigScatterLineCustomShape struct {
PlotConfigurationID uuid.UUID `json:"plot_configuration_id"`
Enabled bool `json:"enabled"`
Name string `json:"name"`
DataPoint float32 `json:"data_point"`
Color string `json:"color"`
}
Loading

0 comments on commit 50fc586

Please sign in to comment.