Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new API endpoints for AIX, EOL Microsoft, and Virtuozzo security advisories #10

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions index_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,45 @@ func (c *Client) GetIndexAdobe(queryParameters ...IndexQueryParameters) (respons
return responseJSON, nil
}

type IndexAixResponse struct {
Benchmark float64 `json:"_benchmark"`
Meta IndexMeta `json:"_meta"`
Data []client.AdvisoryAIX `json:"data"`
}

// GetIndexAix - AIX security advisories are official notifications released by IBM to address security vulnerabilities and updates in the AIX operating system. These advisories provide important information about the vulnerabilities, their potential impact, and recommendations for users to apply necessary patches or updates to ensure the security of their systems.
func (c *Client) GetIndexAix(queryParameters ...IndexQueryParameters) (responseJSON *IndexAixResponse, err error) {

httpClient := &http.Client{}
req, err := http.NewRequest("GET", c.GetUrl()+"/v3/index/"+url.QueryEscape("aix"), nil)
if err != nil {
panic(err)
}

c.SetAuthHeader(req)

query := req.URL.Query()
setIndexQueryParameters(query, queryParameters...)
req.URL.RawQuery = query.Encode()

resp, err := httpClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()

if resp.StatusCode != 200 {
var metaError MetaError
_ = json.NewDecoder(resp.Body).Decode(&metaError)

return nil, fmt.Errorf("error: %v", metaError.Errors)
}

_ = json.NewDecoder(resp.Body).Decode(&responseJSON)

return responseJSON, nil
}

type IndexAlephResearchResponse struct {
Benchmark float64 `json:"_benchmark"`
Meta IndexMeta `json:"_meta"`
Expand Down Expand Up @@ -5130,6 +5169,45 @@ func (c *Client) GetIndexEol(queryParameters ...IndexQueryParameters) (responseJ
return responseJSON, nil
}

type IndexEolMicrosoftResponse struct {
Benchmark float64 `json:"_benchmark"`
Meta IndexMeta `json:"_meta"`
Data []client.AdvisoryEOLMicrosoft `json:"data"`
}

// GetIndexEolMicrosoft - The Microsoft EOL data feed contains Microsoft product lifecycle data including release, retirement dates and support policies.
func (c *Client) GetIndexEolMicrosoft(queryParameters ...IndexQueryParameters) (responseJSON *IndexEolMicrosoftResponse, err error) {

httpClient := &http.Client{}
req, err := http.NewRequest("GET", c.GetUrl()+"/v3/index/"+url.QueryEscape("eol-microsoft"), nil)
if err != nil {
panic(err)
}

c.SetAuthHeader(req)

query := req.URL.Query()
setIndexQueryParameters(query, queryParameters...)
req.URL.RawQuery = query.Encode()

resp, err := httpClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()

if resp.StatusCode != 200 {
var metaError MetaError
_ = json.NewDecoder(resp.Body).Decode(&metaError)

return nil, fmt.Errorf("error: %v", metaError.Errors)
}

_ = json.NewDecoder(resp.Body).Decode(&responseJSON)

return responseJSON, nil
}

type IndexEpssResponse struct {
Benchmark float64 `json:"_benchmark"`
Meta IndexMeta `json:"_meta"`
Expand Down Expand Up @@ -14558,6 +14636,45 @@ func (c *Client) GetIndexVeritas(queryParameters ...IndexQueryParameters) (respo
return responseJSON, nil
}

type IndexVirtuozzoResponse struct {
Benchmark float64 `json:"_benchmark"`
Meta IndexMeta `json:"_meta"`
Data []client.AdvisoryVirtuozzo `json:"data"`
}

// GetIndexVirtuozzo - Virtuozzo security advisories are official notifications released by Virtuozzo to address security vulnerabilities and updates for the Virtuozzo ReadyKernel patch service. These advisories provide important information about the vulnerabilities, their potential impact, and recommendations for users to apply necessary patches or updates to ensure the security of their systems.
func (c *Client) GetIndexVirtuozzo(queryParameters ...IndexQueryParameters) (responseJSON *IndexVirtuozzoResponse, err error) {

httpClient := &http.Client{}
req, err := http.NewRequest("GET", c.GetUrl()+"/v3/index/"+url.QueryEscape("virtuozzo"), nil)
if err != nil {
panic(err)
}

c.SetAuthHeader(req)

query := req.URL.Query()
setIndexQueryParameters(query, queryParameters...)
req.URL.RawQuery = query.Encode()

resp, err := httpClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()

if resp.StatusCode != 200 {
var metaError MetaError
_ = json.NewDecoder(resp.Body).Decode(&metaError)

return nil, fmt.Errorf("error: %v", metaError.Errors)
}

_ = json.NewDecoder(resp.Body).Decode(&responseJSON)

return responseJSON, nil
}

type IndexVmwareResponse struct {
Benchmark float64 `json:"_benchmark"`
Meta IndexMeta `json:"_meta"`
Expand Down
Loading
Loading