generator_github.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. package v1alpha1
  13. import (
  14. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  15. esmeta "github.com/external-secrets/external-secrets/apis/meta/v1"
  16. )
  17. type GithubAccessTokenSpec struct {
  18. // URL configures the Github instance URL. Defaults to https://github.com/.
  19. URL string `json:"url,omitempty"`
  20. AppID string `json:"appID"`
  21. InstallID string `json:"installID"`
  22. // List of repositories the token will have access to. If omitted, defaults to all repositories the GitHub App
  23. // is installed to.
  24. Repositories []string `json:"repositories,omitempty"`
  25. // Map of permissions the token will have. If omitted, defaults to all permissions the GitHub App has.
  26. Permissions map[string]string `json:"permissions,omitempty"`
  27. // Auth configures how ESO authenticates with a Github instance.
  28. Auth GithubAuth `json:"auth"`
  29. }
  30. type GithubAuth struct {
  31. PrivateKey GithubSecretRef `json:"privateKey"`
  32. }
  33. type GithubSecretRef struct {
  34. SecretRef esmeta.SecretKeySelector `json:"secretRef"`
  35. }
  36. // GithubAccessToken generates ghs_ accessToken
  37. // +kubebuilder:object:root=true
  38. // +kubebuilder:storageversion
  39. // +kubebuilder:subresource:status
  40. // +kubebuilder:metadata:labels="external-secrets.io/component=controller"
  41. // +kubebuilder:resource:scope=Namespaced,categories={external-secrets, external-secrets-generators},shortName=githubaccesstoken
  42. type GithubAccessToken struct {
  43. metav1.TypeMeta `json:",inline"`
  44. metav1.ObjectMeta `json:"metadata,omitempty"`
  45. Spec GithubAccessTokenSpec `json:"spec,omitempty"`
  46. }
  47. // +kubebuilder:object:root=true
  48. // GithubAccessToken contains a list of ExternalSecret resources.
  49. type GithubAccessTokenList struct {
  50. metav1.TypeMeta `json:",inline"`
  51. metav1.ListMeta `json:"metadata,omitempty"`
  52. Items []GithubAccessToken `json:"items"`
  53. }