// Copyright 2022 The go-github AUTHORS. All rights reserved.//// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package githubimport ()// SecretScanningService handles communication with the secret scanning related// methods of the GitHub API.typeSecretScanningServiceservice// SecretScanningAlert represents a GitHub secret scanning alert.typeSecretScanningAlertstruct { Number *int`json:"number,omitempty"` CreatedAt *Timestamp`json:"created_at,omitempty"` URL *string`json:"url,omitempty"` HTMLURL *string`json:"html_url,omitempty"` LocationsURL *string`json:"locations_url,omitempty"` State *string`json:"state,omitempty"` Resolution *string`json:"resolution,omitempty"` ResolvedAt *Timestamp`json:"resolved_at,omitempty"` ResolvedBy *User`json:"resolved_by,omitempty"` SecretType *string`json:"secret_type,omitempty"` SecretTypeDisplayName *string`json:"secret_type_display_name,omitempty"` Secret *string`json:"secret,omitempty"` Repository *Repository`json:"repository,omitempty"` UpdatedAt *Timestamp`json:"updated_at,omitempty"` PushProtectionBypassed *bool`json:"push_protection_bypassed,omitempty"` PushProtectionBypassedBy *User`json:"push_protection_bypassed_by,omitempty"` PushProtectionBypassedAt *Timestamp`json:"push_protection_bypassed_at,omitempty"` ResolutionComment *string`json:"resolution_comment,omitempty"`}// SecretScanningAlertLocation represents the location for a secret scanning alert.typeSecretScanningAlertLocationstruct { Type *string`json:"type,omitempty"` Details *SecretScanningAlertLocationDetails`json:"details,omitempty"`}// SecretScanningAlertLocationDetails represents the location details for a secret scanning alert.typeSecretScanningAlertLocationDetailsstruct { Path *string`json:"path,omitempty"` Startline *int`json:"start_line,omitempty"` EndLine *int`json:"end_line,omitempty"` StartColumn *int`json:"start_column,omitempty"` EndColumn *int`json:"end_column,omitempty"` BlobSHA *string`json:"blob_sha,omitempty"` BlobURL *string`json:"blob_url,omitempty"` CommitSHA *string`json:"commit_sha,omitempty"` CommitURL *string`json:"commit_url,omitempty"`}// SecretScanningAlertListOptions specifies optional parameters to the SecretScanningService.ListAlertsForEnterprise method.typeSecretScanningAlertListOptionsstruct {// State of the secret scanning alerts to list. Set to open or resolved to only list secret scanning alerts in a specific state. State string`url:"state,omitempty"`// A comma-separated list of secret types to return. By default all secret types are returned. SecretType string`url:"secret_type,omitempty"`// A comma-separated list of resolutions. Only secret scanning alerts with one of these resolutions are listed. // Valid resolutions are false_positive, wont_fix, revoked, pattern_edited, pattern_deleted or used_in_tests. Resolution string`url:"resolution,omitempty"`ListCursorOptions// List options can vary on the Enterprise type. // On Enterprise Cloud, Secret Scan alerts support requesting by page number // along with providing a cursor for an "after" param. // See: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization // Whereas on Enterprise Server, pagination is by index. // See: https://docs.github.com/enterprise-server@3.6/rest/secret-scanning#list-secret-scanning-alerts-for-an-organizationListOptions}// SecretScanningAlertUpdateOptions specifies optional parameters to the SecretScanningService.UpdateAlert method.typeSecretScanningAlertUpdateOptionsstruct {// State is required and sets the state of the secret scanning alert. // Can be either "open" or "resolved". // You must provide resolution when you set the state to "resolved". State string`json:"state"`// Required when the state is "resolved" and represents the reason for resolving the alert. // Can be one of: "false_positive", "wont_fix", "revoked", or "used_in_tests". Resolution *string`json:"resolution,omitempty"`}// ListAlertsForEnterprise lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest.//// To use this endpoint, you must be a member of the enterprise, and you must use an access token with the repo scope or// security_events scope. Alerts are only returned for organizations in the enterprise for which you are an organization owner or a security manager.//// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise////meta:operation GET /enterprises/{enterprise}/secret-scanning/alertsfunc ( *SecretScanningService) ( context.Context, string, *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { := fmt.Sprintf("enterprises/%v/secret-scanning/alerts", ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*SecretScanningAlert , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// ListAlertsForOrg lists secret scanning alerts for eligible repositories in an organization, from newest to oldest.//// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with// the repo scope or security_events scope.//// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-organization////meta:operation GET /orgs/{org}/secret-scanning/alertsfunc ( *SecretScanningService) ( context.Context, string, *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { := fmt.Sprintf("orgs/%v/secret-scanning/alerts", ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*SecretScanningAlert , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// ListAlertsForRepo lists secret scanning alerts for a private repository, from newest to oldest.//// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with// the repo scope or security_events scope.//// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-a-repository////meta:operation GET /repos/{owner}/{repo}/secret-scanning/alertsfunc ( *SecretScanningService) ( context.Context, , string, *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts", , ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*SecretScanningAlert , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// GetAlert gets a single secret scanning alert detected in a private repository.//// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with// the repo scope or security_events scope.//// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#get-a-secret-scanning-alert////meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}func ( *SecretScanningService) ( context.Context, , string, int64) (*SecretScanningAlert, *Response, error) { := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", , , ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var *SecretScanningAlert , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// UpdateAlert updates the status of a secret scanning alert in a private repository.//// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with// the repo scope or security_events scope.//// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#update-a-secret-scanning-alert////meta:operation PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}func ( *SecretScanningService) ( context.Context, , string, int64, *SecretScanningAlertUpdateOptions) (*SecretScanningAlert, *Response, error) { := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", , , ) , := .client.NewRequest("PATCH", , )if != nil {returnnil, nil, }var *SecretScanningAlert , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// ListLocationsForAlert lists all locations for a given secret scanning alert for a private repository.//// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with// the repo scope or security_events scope.//// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-locations-for-a-secret-scanning-alert////meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locationsfunc ( *SecretScanningService) ( context.Context, , string, int64, *ListOptions) ([]*SecretScanningAlertLocation, *Response, error) { := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v/locations", , , ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*SecretScanningAlertLocation , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.