Debian Codegraph @

kubernetes/typed/apps/v1beta2/statefulset.go

raw symbols SCIP
1 /*
2 Copyright The Kubernetes Authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 // Code generated by client-gen. DO NOT EDIT.
18
19 package v1beta2
20
21 import (
22 context "context"
23 fmt "fmt"
24
25 appsv1beta2 "k8s.io/api/apps/v1beta2"
26 v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27 types "k8s.io/apimachinery/pkg/types"
28 watch "k8s.io/apimachinery/pkg/watch"
29 applyconfigurationsappsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2"
30 gentype "k8s.io/client-go/gentype"
31 scheme "k8s.io/client-go/kubernetes/scheme"
32 apply "k8s.io/client-go/util/apply"
33 )
34
35 // StatefulSetsGetter has a method to return a StatefulSetInterface.
36 // A group's client should implement this interface.
37 type StatefulSetsGetter interface {
38 StatefulSets(namespace string) StatefulSetInterface
39 }
40
41 // StatefulSetInterface has methods to work with StatefulSet resources.
42 type StatefulSetInterface interface {
43 Create(ctx context.Context, statefulSet *appsv1beta2.StatefulSet, opts v1.CreateOptions) (*appsv1beta2.StatefulSet, error)
44 Update(ctx context.Context, statefulSet *appsv1beta2.StatefulSet, opts v1.UpdateOptions) (*appsv1beta2.StatefulSet, error)
45 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
46 UpdateStatus(ctx context.Context, statefulSet *appsv1beta2.StatefulSet, opts v1.UpdateOptions) (*appsv1beta2.StatefulSet, error)
47 Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
48 DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
49 Get(ctx context.Context, name string, opts v1.GetOptions) (*appsv1beta2.StatefulSet, error)
50 List(ctx context.Context, opts v1.ListOptions) (*appsv1beta2.StatefulSetList, error)
51 Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
52 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *appsv1beta2.StatefulSet, err error)
53 Apply(ctx context.Context, statefulSet *applyconfigurationsappsv1beta2.StatefulSetApplyConfiguration, opts v1.ApplyOptions) (result *appsv1beta2.StatefulSet, err error)
54 // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
55 ApplyStatus(ctx context.Context, statefulSet *applyconfigurationsappsv1beta2.StatefulSetApplyConfiguration, opts v1.ApplyOptions) (result *appsv1beta2.StatefulSet, err error)
56 GetScale(ctx context.Context, statefulSetName string, options v1.GetOptions) (*appsv1beta2.Scale, error)
57 UpdateScale(ctx context.Context, statefulSetName string, scale *appsv1beta2.Scale, opts v1.UpdateOptions) (*appsv1beta2.Scale, error)
58 ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationsappsv1beta2.ScaleApplyConfiguration, opts v1.ApplyOptions) (*appsv1beta2.Scale, error)
59
60 StatefulSetExpansion
61 }
62
63 // statefulSets implements StatefulSetInterface
64 type statefulSets struct {
65 *gentype.ClientWithListAndApply[*appsv1beta2.StatefulSet, *appsv1beta2.StatefulSetList, *applyconfigurationsappsv1beta2.StatefulSetApplyConfiguration]
66 }
67
68 // newStatefulSets returns a StatefulSets
69 func newStatefulSets(c *AppsV1beta2Client, namespace string) *statefulSets {
70 return &statefulSets{
71 gentype.NewClientWithListAndApply[*appsv1beta2.StatefulSet, *appsv1beta2.StatefulSetList, *applyconfigurationsappsv1beta2.StatefulSetApplyConfiguration](
72 "statefulsets",
73 c.RESTClient(),
74 scheme.ParameterCodec,
75 namespace,
76 func() *appsv1beta2.StatefulSet { return &appsv1beta2.StatefulSet{} },
77 func() *appsv1beta2.StatefulSetList { return &appsv1beta2.StatefulSetList{} },
78 gentype.PrefersProtobuf[*appsv1beta2.StatefulSet](),
79 ),
80 }
81 }
82
83 // GetScale takes name of the statefulSet, and returns the corresponding appsv1beta2.Scale object, and an error if there is any.
84 func (c *statefulSets) GetScale(ctx context.Context, statefulSetName string, options v1.GetOptions) (result *appsv1beta2.Scale, err error) {
85 result = &appsv1beta2.Scale{}
86 err = c.GetClient().Get().
87 UseProtobufAsDefault().
88 Namespace(c.GetNamespace()).
89 Resource("statefulsets").
90 Name(statefulSetName).
91 SubResource("scale").
92 VersionedParams(&options, scheme.ParameterCodec).
93 Do(ctx).
94 Into(result)
95 return
96 }
97
98 // UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
99 func (c *statefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *appsv1beta2.Scale, opts v1.UpdateOptions) (result *appsv1beta2.Scale, err error) {
100 result = &appsv1beta2.Scale{}
101 err = c.GetClient().Put().
102 UseProtobufAsDefault().
103 Namespace(c.GetNamespace()).
104 Resource("statefulsets").
105 Name(statefulSetName).
106 SubResource("scale").
107 VersionedParams(&opts, scheme.ParameterCodec).
108 Body(scale).
109 Do(ctx).
110 Into(result)
111 return
112 }
113
114 // ApplyScale takes top resource name and the apply declarative configuration for scale,
115 // applies it and returns the applied scale, and an error, if there is any.
116 func (c *statefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationsappsv1beta2.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *appsv1beta2.Scale, err error) {
117 if scale == nil {
118 return nil, fmt.Errorf("scale provided to ApplyScale must not be nil")
119 }
120 patchOpts := opts.ToPatchOptions()
121 request, err := apply.NewRequest(c.GetClient(), scale)
122 if err != nil {
123 return nil, err
124 }
125
126 result = &appsv1beta2.Scale{}
127 err = request.
128 UseProtobufAsDefault().
129 Namespace(c.GetNamespace()).
130 Resource("statefulsets").
131 Name(statefulSetName).
132 SubResource("scale").
133 VersionedParams(&patchOpts, scheme.ParameterCodec).
134 Do(ctx).
135 Into(result)
136 return
137 }