blob: 76e67dedb85c6929cf4d1ffe95d5102eda7f9454 [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17// Code generated by client-gen. DO NOT EDIT.
18
19package v1beta1
20
21import (
22 "context"
23 "time"
24
25 v1beta1 "k8s.io/api/extensions/v1beta1"
26 v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27 types "k8s.io/apimachinery/pkg/types"
28 watch "k8s.io/apimachinery/pkg/watch"
29 scheme "k8s.io/client-go/kubernetes/scheme"
30 rest "k8s.io/client-go/rest"
31)
32
33// PodSecurityPoliciesGetter has a method to return a PodSecurityPolicyInterface.
34// A group's client should implement this interface.
35type PodSecurityPoliciesGetter interface {
36 PodSecurityPolicies() PodSecurityPolicyInterface
37}
38
39// PodSecurityPolicyInterface has methods to work with PodSecurityPolicy resources.
40type PodSecurityPolicyInterface interface {
41 Create(ctx context.Context, podSecurityPolicy *v1beta1.PodSecurityPolicy, opts v1.CreateOptions) (*v1beta1.PodSecurityPolicy, error)
42 Update(ctx context.Context, podSecurityPolicy *v1beta1.PodSecurityPolicy, opts v1.UpdateOptions) (*v1beta1.PodSecurityPolicy, error)
43 Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
44 DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
45 Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.PodSecurityPolicy, error)
46 List(ctx context.Context, opts v1.ListOptions) (*v1beta1.PodSecurityPolicyList, error)
47 Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
48 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.PodSecurityPolicy, err error)
49 PodSecurityPolicyExpansion
50}
51
52// podSecurityPolicies implements PodSecurityPolicyInterface
53type podSecurityPolicies struct {
54 client rest.Interface
55}
56
57// newPodSecurityPolicies returns a PodSecurityPolicies
58func newPodSecurityPolicies(c *ExtensionsV1beta1Client) *podSecurityPolicies {
59 return &podSecurityPolicies{
60 client: c.RESTClient(),
61 }
62}
63
64// Get takes name of the podSecurityPolicy, and returns the corresponding podSecurityPolicy object, and an error if there is any.
65func (c *podSecurityPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.PodSecurityPolicy, err error) {
66 result = &v1beta1.PodSecurityPolicy{}
67 err = c.client.Get().
68 Resource("podsecuritypolicies").
69 Name(name).
70 VersionedParams(&options, scheme.ParameterCodec).
71 Do(ctx).
72 Into(result)
73 return
74}
75
76// List takes label and field selectors, and returns the list of PodSecurityPolicies that match those selectors.
77func (c *podSecurityPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.PodSecurityPolicyList, err error) {
78 var timeout time.Duration
79 if opts.TimeoutSeconds != nil {
80 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
81 }
82 result = &v1beta1.PodSecurityPolicyList{}
83 err = c.client.Get().
84 Resource("podsecuritypolicies").
85 VersionedParams(&opts, scheme.ParameterCodec).
86 Timeout(timeout).
87 Do(ctx).
88 Into(result)
89 return
90}
91
92// Watch returns a watch.Interface that watches the requested podSecurityPolicies.
93func (c *podSecurityPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
94 var timeout time.Duration
95 if opts.TimeoutSeconds != nil {
96 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
97 }
98 opts.Watch = true
99 return c.client.Get().
100 Resource("podsecuritypolicies").
101 VersionedParams(&opts, scheme.ParameterCodec).
102 Timeout(timeout).
103 Watch(ctx)
104}
105
106// Create takes the representation of a podSecurityPolicy and creates it. Returns the server's representation of the podSecurityPolicy, and an error, if there is any.
107func (c *podSecurityPolicies) Create(ctx context.Context, podSecurityPolicy *v1beta1.PodSecurityPolicy, opts v1.CreateOptions) (result *v1beta1.PodSecurityPolicy, err error) {
108 result = &v1beta1.PodSecurityPolicy{}
109 err = c.client.Post().
110 Resource("podsecuritypolicies").
111 VersionedParams(&opts, scheme.ParameterCodec).
112 Body(podSecurityPolicy).
113 Do(ctx).
114 Into(result)
115 return
116}
117
118// Update takes the representation of a podSecurityPolicy and updates it. Returns the server's representation of the podSecurityPolicy, and an error, if there is any.
119func (c *podSecurityPolicies) Update(ctx context.Context, podSecurityPolicy *v1beta1.PodSecurityPolicy, opts v1.UpdateOptions) (result *v1beta1.PodSecurityPolicy, err error) {
120 result = &v1beta1.PodSecurityPolicy{}
121 err = c.client.Put().
122 Resource("podsecuritypolicies").
123 Name(podSecurityPolicy.Name).
124 VersionedParams(&opts, scheme.ParameterCodec).
125 Body(podSecurityPolicy).
126 Do(ctx).
127 Into(result)
128 return
129}
130
131// Delete takes name of the podSecurityPolicy and deletes it. Returns an error if one occurs.
132func (c *podSecurityPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
133 return c.client.Delete().
134 Resource("podsecuritypolicies").
135 Name(name).
136 Body(&opts).
137 Do(ctx).
138 Error()
139}
140
141// DeleteCollection deletes a collection of objects.
142func (c *podSecurityPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
143 var timeout time.Duration
144 if listOpts.TimeoutSeconds != nil {
145 timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
146 }
147 return c.client.Delete().
148 Resource("podsecuritypolicies").
149 VersionedParams(&listOpts, scheme.ParameterCodec).
150 Timeout(timeout).
151 Body(&opts).
152 Do(ctx).
153 Error()
154}
155
156// Patch applies the patch and returns the patched podSecurityPolicy.
157func (c *podSecurityPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.PodSecurityPolicy, err error) {
158 result = &v1beta1.PodSecurityPolicy{}
159 err = c.client.Patch(pt).
160 Resource("podsecuritypolicies").
161 Name(name).
162 SubResource(subresources...).
163 VersionedParams(&opts, scheme.ParameterCodec).
164 Body(data).
165 Do(ctx).
166 Into(result)
167 return
168}