Skip to content

Instantly share code, notes, and snippets.

@shino
Created October 31, 2023 04:19
Show Gist options
  • Save shino/bec82bbe622ccb162c5c12ef7594cb89 to your computer and use it in GitHub Desktop.
Save shino/bec82bbe622ccb162c5c12ef7594cb89 to your computer and use it in GitHub Desktop.
// This file was generated from JSON Schema using quicktype, do not modify it directly.
// To parse and unparse this JSON data, add this code to your project and do:
//
// cpeAPIJSON20, err := UnmarshalCpeAPIJSON20(bytes)
// bytes, err = cpeAPIJSON20.Marshal()
package main
import "encoding/json"
func UnmarshalCpeAPIJSON20(data []byte) (CpeAPIJSON20, error) {
var r CpeAPIJSON20
err := json.Unmarshal(data, &r)
return r, err
}
func (r *CpeAPIJSON20) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type CpeAPIJSON20 struct {
Format string `json:"format"`
// NVD feed array of CPE
Products []DefCpe `json:"products"`
ResultsPerPage int64 `json:"resultsPerPage"`
StartIndex int64 `json:"startIndex"`
Timestamp string `json:"timestamp"`
TotalResults int64 `json:"totalResults"`
Version string `json:"version"`
}
type DefCpe struct {
Cpe Cpe `json:"cpe"`
}
type Cpe struct {
CpeName string `json:"cpeName"`
CpeNameID string `json:"cpeNameId"`
Created string `json:"created"`
Deprecated bool `json:"deprecated"`
DeprecatedBy []DeprecatedBy `json:"deprecatedBy,omitempty"`
Deprecates []Deprecate `json:"deprecates,omitempty"`
LastModified string `json:"lastModified"`
Refs []DefReference `json:"refs,omitempty"`
Titles []DefTitle `json:"titles,omitempty"`
}
type DeprecatedBy struct {
CpeName *string `json:"cpeName,omitempty"`
CpeNameID *string `json:"cpeNameId,omitempty"`
}
type Deprecate struct {
CpeName *string `json:"cpeName,omitempty"`
CpeNameID *string `json:"cpeNameId,omitempty"`
}
// Internet resource for CPE
type DefReference struct {
Ref string `json:"ref"`
Type *Type `json:"type,omitempty"`
}
// Human readable title for CPE
type DefTitle struct {
Lang string `json:"lang"`
Title string `json:"title"`
}
type Type string
const (
Advisory Type = "Advisory"
ChangeLog Type = "Change Log"
Product Type = "Product"
Project Type = "Project"
Vendor Type = "Vendor"
Version Type = "Version"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment