diff --git a/pkg/github/kiota-lock.json b/pkg/github/kiota-lock.json index ce6c2db6..bebeb5bc 100644 --- a/pkg/github/kiota-lock.json +++ b/pkg/github/kiota-lock.json @@ -1,5 +1,5 @@ { - "descriptionHash": "7F0740EB8A3E332A77B750DA0E30F52D23DA5545436E104CA82F726B5F496D768A3B9648963ECA5F1707CC55238A59AD4B3ED861C5D15C1593BAC554E330DFCC", + "descriptionHash": "AFCF9A80EB9B6AD1E3E33F4BF67BB542AB82568208F8A07BB3252145EC220B5F14540B367B6AB51C9FAF7317E5BBCB8A8DB58322D548646F65C5AEF396C68683", "descriptionLocation": "../../../source-generator/schemas/downloaded.json", "lockFileVersion": "1.0.0", "kiotaVersion": "1.14.0-preview.202404180001", diff --git a/pkg/github/models/global_advisory.go b/pkg/github/models/global_advisory.go index 24f8d1d2..931d0b40 100644 --- a/pkg/github/models/global_advisory.go +++ b/pkg/github/models/global_advisory.go @@ -46,7 +46,7 @@ type GlobalAdvisory struct { // The API URL for the advisory. url *string // The products and respective version ranges affected by the advisory. - vulnerabilities []GlobalAdvisory_vulnerabilitiesable + vulnerabilities []Vulnerabilityable // The date and time of when the advisory was withdrawn, in ISO 8601 format. withdrawn_at *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time } @@ -305,15 +305,15 @@ func (m *GlobalAdvisory) GetFieldDeserializers()(map[string]func(i878a80d2330e89 return nil } res["vulnerabilities"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { - val, err := n.GetCollectionOfObjectValues(CreateGlobalAdvisory_vulnerabilitiesFromDiscriminatorValue) + val, err := n.GetCollectionOfObjectValues(CreateVulnerabilityFromDiscriminatorValue) if err != nil { return err } if val != nil { - res := make([]GlobalAdvisory_vulnerabilitiesable, len(val)) + res := make([]Vulnerabilityable, len(val)) for i, v := range val { if v != nil { - res[i] = v.(GlobalAdvisory_vulnerabilitiesable) + res[i] = v.(Vulnerabilityable) } } m.SetVulnerabilities(res) @@ -403,8 +403,8 @@ func (m *GlobalAdvisory) GetUrl()(*string) { return m.url } // GetVulnerabilities gets the vulnerabilities property value. The products and respective version ranges affected by the advisory. -// returns a []GlobalAdvisory_vulnerabilitiesable when successful -func (m *GlobalAdvisory) GetVulnerabilities()([]GlobalAdvisory_vulnerabilitiesable) { +// returns a []Vulnerabilityable when successful +func (m *GlobalAdvisory) GetVulnerabilities()([]Vulnerabilityable) { return m.vulnerabilities } // GetWithdrawnAt gets the withdrawn_at property value. The date and time of when the advisory was withdrawn, in ISO 8601 format. @@ -554,7 +554,7 @@ func (m *GlobalAdvisory) SetUrl(value *string)() { m.url = value } // SetVulnerabilities sets the vulnerabilities property value. The products and respective version ranges affected by the advisory. -func (m *GlobalAdvisory) SetVulnerabilities(value []GlobalAdvisory_vulnerabilitiesable)() { +func (m *GlobalAdvisory) SetVulnerabilities(value []Vulnerabilityable)() { m.vulnerabilities = value } // SetWithdrawnAt sets the withdrawn_at property value. The date and time of when the advisory was withdrawn, in ISO 8601 format. @@ -582,7 +582,7 @@ type GlobalAdvisoryable interface { GetTypeEscaped()(*GlobalAdvisory_type) GetUpdatedAt()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) GetUrl()(*string) - GetVulnerabilities()([]GlobalAdvisory_vulnerabilitiesable) + GetVulnerabilities()([]Vulnerabilityable) GetWithdrawnAt()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) SetCredits(value []GlobalAdvisory_creditsable)() SetCveId(value *string)() @@ -603,6 +603,6 @@ type GlobalAdvisoryable interface { SetTypeEscaped(value *GlobalAdvisory_type)() SetUpdatedAt(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() SetUrl(value *string)() - SetVulnerabilities(value []GlobalAdvisory_vulnerabilitiesable)() + SetVulnerabilities(value []Vulnerabilityable)() SetWithdrawnAt(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() } diff --git a/pkg/github/models/vulnerability.go b/pkg/github/models/vulnerability.go new file mode 100644 index 00000000..5d1c49be --- /dev/null +++ b/pkg/github/models/vulnerability.go @@ -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)() +} diff --git a/pkg/github/models/vulnerability_package.go b/pkg/github/models/vulnerability_package.go new file mode 100644 index 00000000..e111b4c2 --- /dev/null +++ b/pkg/github/models/vulnerability_package.go @@ -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)() +}