models.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 webhook
  13. import (
  14. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  15. esv1beta1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1"
  16. )
  17. type Spec struct {
  18. // Webhook Method
  19. // +optional, default GET
  20. Method string `json:"method,omitempty"`
  21. // Webhook url to call
  22. URL string `json:"url"`
  23. // Headers
  24. // +optional
  25. Headers map[string]string `json:"headers,omitempty"`
  26. // Body
  27. // +optional
  28. Body string `json:"body,omitempty"`
  29. // Timeout
  30. // +optional
  31. Timeout *metav1.Duration `json:"timeout,omitempty"`
  32. // Result formatting
  33. Result Result `json:"result"`
  34. // Secrets to fill in templates
  35. // These secrets will be passed to the templating function as key value pairs under the given name
  36. // +optional
  37. Secrets []Secret `json:"secrets,omitempty"`
  38. // PEM encoded CA bundle used to validate webhook server certificate. Only used
  39. // if the Server URL is using HTTPS protocol. This parameter is ignored for
  40. // plain HTTP protocol connection. If not set the system root certificates
  41. // are used to validate the TLS connection.
  42. // +optional
  43. CABundle []byte `json:"caBundle,omitempty"`
  44. // The provider for the CA bundle to use to validate webhook server certificate.
  45. // +optional
  46. CAProvider *esv1beta1.CAProvider `json:"caProvider,omitempty"`
  47. }
  48. type Result struct {
  49. // Json path of return value
  50. // +optional
  51. JSONPath string `json:"jsonPath,omitempty"`
  52. }
  53. type Secret struct {
  54. // Name of this secret in templates
  55. Name string `json:"name"`
  56. // Secret ref to fill in credentials
  57. SecretRef SecretKeySelector `json:"secretRef"`
  58. }
  59. type SecretKeySelector struct {
  60. // The name of the Secret resource being referred to.
  61. Name string `json:"name,omitempty"`
  62. // The key where the token is found.
  63. Key string `json:"key,omitempty"`
  64. Namespace *string `json:"namespace,omitempty"`
  65. }