horizontalpodautoscalerspec.go 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. Copyright The Kubernetes Authors.
  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. http://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. // Code generated by applyconfiguration-gen. DO NOT EDIT.
  14. package v2beta2
  15. // HorizontalPodAutoscalerSpecApplyConfiguration represents an declarative configuration of the HorizontalPodAutoscalerSpec type for use
  16. // with apply.
  17. type HorizontalPodAutoscalerSpecApplyConfiguration struct {
  18. ScaleTargetRef *CrossVersionObjectReferenceApplyConfiguration `json:"scaleTargetRef,omitempty"`
  19. MinReplicas *int32 `json:"minReplicas,omitempty"`
  20. MaxReplicas *int32 `json:"maxReplicas,omitempty"`
  21. Metrics []MetricSpecApplyConfiguration `json:"metrics,omitempty"`
  22. Behavior *HorizontalPodAutoscalerBehaviorApplyConfiguration `json:"behavior,omitempty"`
  23. }
  24. // HorizontalPodAutoscalerSpecApplyConfiguration constructs an declarative configuration of the HorizontalPodAutoscalerSpec type for use with
  25. // apply.
  26. func HorizontalPodAutoscalerSpec() *HorizontalPodAutoscalerSpecApplyConfiguration {
  27. return &HorizontalPodAutoscalerSpecApplyConfiguration{}
  28. }
  29. // WithScaleTargetRef sets the ScaleTargetRef field in the declarative configuration to the given value
  30. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  31. // If called multiple times, the ScaleTargetRef field is set to the value of the last call.
  32. func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithScaleTargetRef(value *CrossVersionObjectReferenceApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration {
  33. b.ScaleTargetRef = value
  34. return b
  35. }
  36. // WithMinReplicas sets the MinReplicas field in the declarative configuration to the given value
  37. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  38. // If called multiple times, the MinReplicas field is set to the value of the last call.
  39. func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMinReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration {
  40. b.MinReplicas = &value
  41. return b
  42. }
  43. // WithMaxReplicas sets the MaxReplicas field in the declarative configuration to the given value
  44. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  45. // If called multiple times, the MaxReplicas field is set to the value of the last call.
  46. func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMaxReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration {
  47. b.MaxReplicas = &value
  48. return b
  49. }
  50. // WithMetrics adds the given value to the Metrics field in the declarative configuration
  51. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  52. // If called multiple times, values provided by each call will be appended to the Metrics field.
  53. func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMetrics(values ...*MetricSpecApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration {
  54. for i := range values {
  55. if values[i] == nil {
  56. panic("nil value passed to WithMetrics")
  57. }
  58. b.Metrics = append(b.Metrics, *values[i])
  59. }
  60. return b
  61. }
  62. // WithBehavior sets the Behavior field in the declarative configuration to the given value
  63. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  64. // If called multiple times, the Behavior field is set to the value of the last call.
  65. func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithBehavior(value *HorizontalPodAutoscalerBehaviorApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration {
  66. b.Behavior = value
  67. return b
  68. }