-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: renames GlobalAdvisory_vulnerabilities > Vulnerability, adds [V…
…ulnerability_package] Co-authored-by: Octokit Bot <octokitbot@martynus.net>
- Loading branch information
1 parent
468fd05
commit be9cd72
Showing
4 changed files
with
289 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
package models | ||
|
||
import ( | ||
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" | ||
) | ||
|
||
// Vulnerability a vulnerability describing the product and its affected versions within a GitHub Security Advisory. | ||
type Vulnerability struct { | ||
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. | ||
additionalData map[string]any | ||
// The package version that resolves the vulnerability. | ||
first_patched_version *string | ||
// The name of the package affected by the vulnerability. | ||
packageEscaped Vulnerability_packageable | ||
// The functions in the package that are affected by the vulnerability. | ||
vulnerable_functions []string | ||
// The range of the package versions affected by the vulnerability. | ||
vulnerable_version_range *string | ||
} | ||
// NewVulnerability instantiates a new Vulnerability and sets the default values. | ||
func NewVulnerability()(*Vulnerability) { | ||
m := &Vulnerability{ | ||
} | ||
m.SetAdditionalData(make(map[string]any)) | ||
return m | ||
} | ||
// CreateVulnerabilityFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value | ||
// returns a Parsable when successful | ||
func CreateVulnerabilityFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { | ||
return NewVulnerability(), nil | ||
} | ||
// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. | ||
// returns a map[string]any when successful | ||
func (m *Vulnerability) GetAdditionalData()(map[string]any) { | ||
return m.additionalData | ||
} | ||
// GetFieldDeserializers the deserialization information for the current model | ||
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful | ||
func (m *Vulnerability) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { | ||
res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) | ||
res["first_patched_version"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { | ||
val, err := n.GetStringValue() | ||
if err != nil { | ||
return err | ||
} | ||
if val != nil { | ||
m.SetFirstPatchedVersion(val) | ||
} | ||
return nil | ||
} | ||
res["package"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { | ||
val, err := n.GetObjectValue(CreateVulnerability_packageFromDiscriminatorValue) | ||
if err != nil { | ||
return err | ||
} | ||
if val != nil { | ||
m.SetPackageEscaped(val.(Vulnerability_packageable)) | ||
} | ||
return nil | ||
} | ||
res["vulnerable_functions"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { | ||
val, err := n.GetCollectionOfPrimitiveValues("string") | ||
if err != nil { | ||
return err | ||
} | ||
if val != nil { | ||
res := make([]string, len(val)) | ||
for i, v := range val { | ||
if v != nil { | ||
res[i] = *(v.(*string)) | ||
} | ||
} | ||
m.SetVulnerableFunctions(res) | ||
} | ||
return nil | ||
} | ||
res["vulnerable_version_range"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { | ||
val, err := n.GetStringValue() | ||
if err != nil { | ||
return err | ||
} | ||
if val != nil { | ||
m.SetVulnerableVersionRange(val) | ||
} | ||
return nil | ||
} | ||
return res | ||
} | ||
// GetFirstPatchedVersion gets the first_patched_version property value. The package version that resolves the vulnerability. | ||
// returns a *string when successful | ||
func (m *Vulnerability) GetFirstPatchedVersion()(*string) { | ||
return m.first_patched_version | ||
} | ||
// GetPackageEscaped gets the package property value. The name of the package affected by the vulnerability. | ||
// returns a Vulnerability_packageable when successful | ||
func (m *Vulnerability) GetPackageEscaped()(Vulnerability_packageable) { | ||
return m.packageEscaped | ||
} | ||
// GetVulnerableFunctions gets the vulnerable_functions property value. The functions in the package that are affected by the vulnerability. | ||
// returns a []string when successful | ||
func (m *Vulnerability) GetVulnerableFunctions()([]string) { | ||
return m.vulnerable_functions | ||
} | ||
// GetVulnerableVersionRange gets the vulnerable_version_range property value. The range of the package versions affected by the vulnerability. | ||
// returns a *string when successful | ||
func (m *Vulnerability) GetVulnerableVersionRange()(*string) { | ||
return m.vulnerable_version_range | ||
} | ||
// Serialize serializes information the current object | ||
func (m *Vulnerability) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { | ||
{ | ||
err := writer.WriteStringValue("first_patched_version", m.GetFirstPatchedVersion()) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
{ | ||
err := writer.WriteObjectValue("package", m.GetPackageEscaped()) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
{ | ||
err := writer.WriteStringValue("vulnerable_version_range", m.GetVulnerableVersionRange()) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
{ | ||
err := writer.WriteAdditionalData(m.GetAdditionalData()) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} | ||
// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. | ||
func (m *Vulnerability) SetAdditionalData(value map[string]any)() { | ||
m.additionalData = value | ||
} | ||
// SetFirstPatchedVersion sets the first_patched_version property value. The package version that resolves the vulnerability. | ||
func (m *Vulnerability) SetFirstPatchedVersion(value *string)() { | ||
m.first_patched_version = value | ||
} | ||
// SetPackageEscaped sets the package property value. The name of the package affected by the vulnerability. | ||
func (m *Vulnerability) SetPackageEscaped(value Vulnerability_packageable)() { | ||
m.packageEscaped = value | ||
} | ||
// SetVulnerableFunctions sets the vulnerable_functions property value. The functions in the package that are affected by the vulnerability. | ||
func (m *Vulnerability) SetVulnerableFunctions(value []string)() { | ||
m.vulnerable_functions = value | ||
} | ||
// SetVulnerableVersionRange sets the vulnerable_version_range property value. The range of the package versions affected by the vulnerability. | ||
func (m *Vulnerability) SetVulnerableVersionRange(value *string)() { | ||
m.vulnerable_version_range = value | ||
} | ||
type Vulnerabilityable interface { | ||
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder | ||
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable | ||
GetFirstPatchedVersion()(*string) | ||
GetPackageEscaped()(Vulnerability_packageable) | ||
GetVulnerableFunctions()([]string) | ||
GetVulnerableVersionRange()(*string) | ||
SetFirstPatchedVersion(value *string)() | ||
SetPackageEscaped(value Vulnerability_packageable)() | ||
SetVulnerableFunctions(value []string)() | ||
SetVulnerableVersionRange(value *string)() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package models | ||
|
||
import ( | ||
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" | ||
) | ||
|
||
// Vulnerability_package the name of the package affected by the vulnerability. | ||
type Vulnerability_package struct { | ||
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. | ||
additionalData map[string]any | ||
// The package's language or package management ecosystem. | ||
ecosystem *SecurityAdvisoryEcosystems | ||
// The unique package name within its ecosystem. | ||
name *string | ||
} | ||
// NewVulnerability_package instantiates a new Vulnerability_package and sets the default values. | ||
func NewVulnerability_package()(*Vulnerability_package) { | ||
m := &Vulnerability_package{ | ||
} | ||
m.SetAdditionalData(make(map[string]any)) | ||
return m | ||
} | ||
// CreateVulnerability_packageFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value | ||
// returns a Parsable when successful | ||
func CreateVulnerability_packageFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { | ||
return NewVulnerability_package(), nil | ||
} | ||
// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. | ||
// returns a map[string]any when successful | ||
func (m *Vulnerability_package) GetAdditionalData()(map[string]any) { | ||
return m.additionalData | ||
} | ||
// GetEcosystem gets the ecosystem property value. The package's language or package management ecosystem. | ||
// returns a *SecurityAdvisoryEcosystems when successful | ||
func (m *Vulnerability_package) GetEcosystem()(*SecurityAdvisoryEcosystems) { | ||
return m.ecosystem | ||
} | ||
// GetFieldDeserializers the deserialization information for the current model | ||
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful | ||
func (m *Vulnerability_package) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { | ||
res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) | ||
res["ecosystem"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { | ||
val, err := n.GetEnumValue(ParseSecurityAdvisoryEcosystems) | ||
if err != nil { | ||
return err | ||
} | ||
if val != nil { | ||
m.SetEcosystem(val.(*SecurityAdvisoryEcosystems)) | ||
} | ||
return nil | ||
} | ||
res["name"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { | ||
val, err := n.GetStringValue() | ||
if err != nil { | ||
return err | ||
} | ||
if val != nil { | ||
m.SetName(val) | ||
} | ||
return nil | ||
} | ||
return res | ||
} | ||
// GetName gets the name property value. The unique package name within its ecosystem. | ||
// returns a *string when successful | ||
func (m *Vulnerability_package) GetName()(*string) { | ||
return m.name | ||
} | ||
// Serialize serializes information the current object | ||
func (m *Vulnerability_package) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { | ||
if m.GetEcosystem() != nil { | ||
cast := (*m.GetEcosystem()).String() | ||
err := writer.WriteStringValue("ecosystem", &cast) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
{ | ||
err := writer.WriteStringValue("name", m.GetName()) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
{ | ||
err := writer.WriteAdditionalData(m.GetAdditionalData()) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} | ||
// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. | ||
func (m *Vulnerability_package) SetAdditionalData(value map[string]any)() { | ||
m.additionalData = value | ||
} | ||
// SetEcosystem sets the ecosystem property value. The package's language or package management ecosystem. | ||
func (m *Vulnerability_package) SetEcosystem(value *SecurityAdvisoryEcosystems)() { | ||
m.ecosystem = value | ||
} | ||
// SetName sets the name property value. The unique package name within its ecosystem. | ||
func (m *Vulnerability_package) SetName(value *string)() { | ||
m.name = value | ||
} | ||
type Vulnerability_packageable interface { | ||
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder | ||
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable | ||
GetEcosystem()(*SecurityAdvisoryEcosystems) | ||
GetName()(*string) | ||
SetEcosystem(value *SecurityAdvisoryEcosystems)() | ||
SetName(value *string)() | ||
} |