tagger/internal/models/resource.go
Matthew Rich 14fda44c41
Some checks failed
Lint / golangci-lint (push) Failing after 10m25s
Declarative Tests / test (push) Failing after 1m59s
add artifacts
2024-04-04 13:37:54 -07:00

29 lines
532 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package models
import (
"io"
"encoding/json"
_ "fmt"
)
type Resource struct {
Id string `json:"id",omitempty`
Resource string `json:"resource",omitempty`
Tags []string `json:"tags"`
}
func NewResource() *Resource {
return &Resource{}
}
func NewResourceFromJson(jsonReader io.Reader) (*Resource, error) {
r := NewResource()
err := json.NewDecoder(jsonReader).Decode(r)
if err != nil {
return nil, err
}
return r, nil
}