repo_secrets.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. Copyright © 2025 ESO Maintainer Team
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. https://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // /*
  14. // Licensed under the Apache License, Version 2.0 (the "License");
  15. // you may not use this file except in compliance with the License.
  16. // You may obtain a copy of the License at
  17. //
  18. // https://www.apache.org/licenses/LICENSE-2.0
  19. //
  20. // Unless required by applicable law or agreed to in writing, software
  21. // distributed under the License is distributed on an "AS IS" BASIS,
  22. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. // See the License for the specific language governing permissions and
  24. // limitations under the License.
  25. // */
  26. package github
  27. import (
  28. "context"
  29. github "github.com/google/go-github/v56/github"
  30. esv1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1"
  31. )
  32. func (g *Client) repoGetSecretFn(ctx context.Context, ref esv1.PushSecretRemoteRef) (*github.Secret, *github.Response, error) {
  33. return g.baseClient.GetRepoSecret(ctx, g.provider.Organization, g.provider.Repository, ref.GetRemoteKey())
  34. }
  35. func (g *Client) repoGetPublicKeyFn(ctx context.Context) (*github.PublicKey, *github.Response, error) {
  36. return g.baseClient.GetRepoPublicKey(ctx, g.provider.Organization, g.provider.Repository)
  37. }
  38. func (g *Client) repoCreateOrUpdateSecret(ctx context.Context, encryptedSecret *github.EncryptedSecret) (*github.Response, error) {
  39. return g.baseClient.CreateOrUpdateRepoSecret(ctx, g.provider.Organization, g.provider.Repository, encryptedSecret)
  40. }
  41. func (g *Client) repoListSecretsFn(ctx context.Context) (*github.Secrets, *github.Response, error) {
  42. return g.baseClient.ListRepoSecrets(ctx, g.provider.Organization, g.provider.Repository, &github.ListOptions{})
  43. }
  44. func (g *Client) repoDeleteSecretsFn(ctx context.Context, remoteRef esv1.PushSecretRemoteRef) (*github.Response, error) {
  45. return g.baseClient.DeleteRepoSecret(ctx, g.provider.Organization, g.provider.Repository, remoteRef.GetRemoteKey())
  46. }