// 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 ()func ( *DependabotService) ( context.Context, string) (*PublicKey, *Response, error) { , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, } := new(PublicKey) , := .client.Do(, , )if != nil {returnnil, , }return , , nil}// GetRepoPublicKey gets a public key that should be used for Dependabot secret encryption.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key////meta:operation GET /repos/{owner}/{repo}/dependabot/secrets/public-keyfunc ( *DependabotService) ( context.Context, , string) (*PublicKey, *Response, error) { := fmt.Sprintf("repos/%v/%v/dependabot/secrets/public-key", , )return .getPublicKey(, )}// GetOrgPublicKey gets a public key that should be used for Dependabot secret encryption.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-an-organization-public-key////meta:operation GET /orgs/{org}/dependabot/secrets/public-keyfunc ( *DependabotService) ( context.Context, string) (*PublicKey, *Response, error) { := fmt.Sprintf("orgs/%v/dependabot/secrets/public-key", )return .getPublicKey(, )}func ( *DependabotService) ( context.Context, string, *ListOptions) (*Secrets, *Response, error) { , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, } := new(Secrets) , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// ListRepoSecrets lists all Dependabot secrets available in a repository// without revealing their encrypted values.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-repository-secrets////meta:operation GET /repos/{owner}/{repo}/dependabot/secretsfunc ( *DependabotService) ( context.Context, , string, *ListOptions) (*Secrets, *Response, error) { := fmt.Sprintf("repos/%v/%v/dependabot/secrets", , )return .listSecrets(, , )}// ListOrgSecrets lists all Dependabot secrets available in an organization// without revealing their encrypted values.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-organization-secrets////meta:operation GET /orgs/{org}/dependabot/secretsfunc ( *DependabotService) ( context.Context, string, *ListOptions) (*Secrets, *Response, error) { := fmt.Sprintf("orgs/%v/dependabot/secrets", )return .listSecrets(, , )}func ( *DependabotService) ( context.Context, string) (*Secret, *Response, error) { , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, } := new(Secret) , := .client.Do(, , )if != nil {returnnil, , }return , , nil}// GetRepoSecret gets a single repository Dependabot secret without revealing its encrypted value.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-a-repository-secret////meta:operation GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name}func ( *DependabotService) ( context.Context, , , string) (*Secret, *Response, error) { := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", , , )return .getSecret(, )}// GetOrgSecret gets a single organization Dependabot secret without revealing its encrypted value.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-an-organization-secret////meta:operation GET /orgs/{org}/dependabot/secrets/{secret_name}func ( *DependabotService) ( context.Context, , string) (*Secret, *Response, error) { := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", , )return .getSecret(, )}// DependabotEncryptedSecret represents a secret that is encrypted using a public key for Dependabot.//// The value of EncryptedValue must be your secret, encrypted with// LibSodium (see documentation here: https://libsodium.gitbook.io/doc/bindings_for_other_languages)// using the public key retrieved using the GetPublicKey method.typeDependabotEncryptedSecretstruct { Name string`json:"-"` KeyID string`json:"key_id"` EncryptedValue string`json:"encrypted_value"` Visibility string`json:"visibility,omitempty"` SelectedRepositoryIDs DependabotSecretsSelectedRepoIDs`json:"selected_repository_ids,omitempty"`}func ( *DependabotService) ( context.Context, string, *DependabotEncryptedSecret) (*Response, error) { , := .client.NewRequest("PUT", , )if != nil {returnnil, }return .client.Do(, , nil)}// CreateOrUpdateRepoSecret creates or updates a repository Dependabot secret with an encrypted value.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#create-or-update-a-repository-secret////meta:operation PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name}func ( *DependabotService) ( context.Context, , string, *DependabotEncryptedSecret) (*Response, error) { := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", , , .Name)return .putSecret(, , )}// CreateOrUpdateOrgSecret creates or updates an organization Dependabot secret with an encrypted value.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret////meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name}func ( *DependabotService) ( context.Context, string, *DependabotEncryptedSecret) (*Response, error) { := make([]string, len(.SelectedRepositoryIDs))for , := range .SelectedRepositoryIDs { [] = fmt.Sprintf("%v", ) } := struct { *DependabotEncryptedSecret []string`json:"selected_repository_ids,omitempty"` }{ : , : , } := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", , .Name) , := .client.NewRequest("PUT", , )if != nil {returnnil, }return .client.Do(, , nil)}func ( *DependabotService) ( context.Context, string) (*Response, error) { , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, }return .client.Do(, , nil)}// DeleteRepoSecret deletes a Dependabot secret in a repository using the secret name.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#delete-a-repository-secret////meta:operation DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name}func ( *DependabotService) ( context.Context, , , string) (*Response, error) { := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", , , )return .deleteSecret(, )}// DeleteOrgSecret deletes a Dependabot secret in an organization using the secret name.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#delete-an-organization-secret////meta:operation DELETE /orgs/{org}/dependabot/secrets/{secret_name}func ( *DependabotService) ( context.Context, , string) (*Response, error) { := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", , )return .deleteSecret(, )}// ListSelectedReposForOrgSecret lists all repositories that have access to a Dependabot secret.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret////meta:operation GET /orgs/{org}/dependabot/secrets/{secret_name}/repositoriesfunc ( *DependabotService) ( context.Context, , string, *ListOptions) (*SelectedReposList, *Response, error) { := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", , ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, } := new(SelectedReposList) , := .client.Do(, , )if != nil {returnnil, , }return , , nil}// DependabotSecretsSelectedRepoIDs are the repository IDs that have access to the dependabot secrets.typeDependabotSecretsSelectedRepoIDs []int64// SetSelectedReposForOrgSecret sets the repositories that have access to a Dependabot secret.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret////meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositoriesfunc ( *DependabotService) ( context.Context, , string, DependabotSecretsSelectedRepoIDs) (*Response, error) { := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", , )typestruct {DependabotSecretsSelectedRepoIDs`json:"selected_repository_ids"` } , := .client.NewRequest("PUT", , {: })if != nil {returnnil, }return .client.Do(, , nil)}// AddSelectedRepoToOrgSecret adds a repository to an organization Dependabot secret.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret////meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}func ( *DependabotService) ( context.Context, , string, *Repository) (*Response, error) { := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", , , *.ID) , := .client.NewRequest("PUT", , nil)if != nil {returnnil, }return .client.Do(, , nil)}// RemoveSelectedRepoFromOrgSecret removes a repository from an organization Dependabot secret.//// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret////meta:operation DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}func ( *DependabotService) ( context.Context, , string, *Repository) (*Response, error) { := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", , , *.ID) , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, }return .client.Do(, , 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.