girishk | e7ca43b | 2019-10-10 12:30:03 +0000 | [diff] [blame] | 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 v1beta1 |
| 20 | |
| 21 | import ( |
| 22 | "time" |
| 23 | |
| 24 | v1beta1 "k8s.io/api/extensions/v1beta1" |
| 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 26 | types "k8s.io/apimachinery/pkg/types" |
| 27 | watch "k8s.io/apimachinery/pkg/watch" |
| 28 | scheme "k8s.io/client-go/kubernetes/scheme" |
| 29 | rest "k8s.io/client-go/rest" |
| 30 | ) |
| 31 | |
| 32 | // NetworkPoliciesGetter has a method to return a NetworkPolicyInterface. |
| 33 | // A group's client should implement this interface. |
| 34 | type NetworkPoliciesGetter interface { |
| 35 | NetworkPolicies(namespace string) NetworkPolicyInterface |
| 36 | } |
| 37 | |
| 38 | // NetworkPolicyInterface has methods to work with NetworkPolicy resources. |
| 39 | type NetworkPolicyInterface interface { |
| 40 | Create(*v1beta1.NetworkPolicy) (*v1beta1.NetworkPolicy, error) |
| 41 | Update(*v1beta1.NetworkPolicy) (*v1beta1.NetworkPolicy, error) |
| 42 | Delete(name string, options *v1.DeleteOptions) error |
| 43 | DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error |
| 44 | Get(name string, options v1.GetOptions) (*v1beta1.NetworkPolicy, error) |
| 45 | List(opts v1.ListOptions) (*v1beta1.NetworkPolicyList, error) |
| 46 | Watch(opts v1.ListOptions) (watch.Interface, error) |
| 47 | Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.NetworkPolicy, err error) |
| 48 | NetworkPolicyExpansion |
| 49 | } |
| 50 | |
| 51 | // networkPolicies implements NetworkPolicyInterface |
| 52 | type networkPolicies struct { |
| 53 | client rest.Interface |
| 54 | ns string |
| 55 | } |
| 56 | |
| 57 | // newNetworkPolicies returns a NetworkPolicies |
| 58 | func newNetworkPolicies(c *ExtensionsV1beta1Client, namespace string) *networkPolicies { |
| 59 | return &networkPolicies{ |
| 60 | client: c.RESTClient(), |
| 61 | ns: namespace, |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | // Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any. |
| 66 | func (c *networkPolicies) Get(name string, options v1.GetOptions) (result *v1beta1.NetworkPolicy, err error) { |
| 67 | result = &v1beta1.NetworkPolicy{} |
| 68 | err = c.client.Get(). |
| 69 | Namespace(c.ns). |
| 70 | Resource("networkpolicies"). |
| 71 | Name(name). |
| 72 | VersionedParams(&options, scheme.ParameterCodec). |
| 73 | Do(). |
| 74 | Into(result) |
| 75 | return |
| 76 | } |
| 77 | |
| 78 | // List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors. |
| 79 | func (c *networkPolicies) List(opts v1.ListOptions) (result *v1beta1.NetworkPolicyList, err error) { |
| 80 | var timeout time.Duration |
| 81 | if opts.TimeoutSeconds != nil { |
| 82 | timeout = time.Duration(*opts.TimeoutSeconds) * time.Second |
| 83 | } |
| 84 | result = &v1beta1.NetworkPolicyList{} |
| 85 | err = c.client.Get(). |
| 86 | Namespace(c.ns). |
| 87 | Resource("networkpolicies"). |
| 88 | VersionedParams(&opts, scheme.ParameterCodec). |
| 89 | Timeout(timeout). |
| 90 | Do(). |
| 91 | Into(result) |
| 92 | return |
| 93 | } |
| 94 | |
| 95 | // Watch returns a watch.Interface that watches the requested networkPolicies. |
| 96 | func (c *networkPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) { |
| 97 | var timeout time.Duration |
| 98 | if opts.TimeoutSeconds != nil { |
| 99 | timeout = time.Duration(*opts.TimeoutSeconds) * time.Second |
| 100 | } |
| 101 | opts.Watch = true |
| 102 | return c.client.Get(). |
| 103 | Namespace(c.ns). |
| 104 | Resource("networkpolicies"). |
| 105 | VersionedParams(&opts, scheme.ParameterCodec). |
| 106 | Timeout(timeout). |
| 107 | Watch() |
| 108 | } |
| 109 | |
| 110 | // Create takes the representation of a networkPolicy and creates it. Returns the server's representation of the networkPolicy, and an error, if there is any. |
| 111 | func (c *networkPolicies) Create(networkPolicy *v1beta1.NetworkPolicy) (result *v1beta1.NetworkPolicy, err error) { |
| 112 | result = &v1beta1.NetworkPolicy{} |
| 113 | err = c.client.Post(). |
| 114 | Namespace(c.ns). |
| 115 | Resource("networkpolicies"). |
| 116 | Body(networkPolicy). |
| 117 | Do(). |
| 118 | Into(result) |
| 119 | return |
| 120 | } |
| 121 | |
| 122 | // Update takes the representation of a networkPolicy and updates it. Returns the server's representation of the networkPolicy, and an error, if there is any. |
| 123 | func (c *networkPolicies) Update(networkPolicy *v1beta1.NetworkPolicy) (result *v1beta1.NetworkPolicy, err error) { |
| 124 | result = &v1beta1.NetworkPolicy{} |
| 125 | err = c.client.Put(). |
| 126 | Namespace(c.ns). |
| 127 | Resource("networkpolicies"). |
| 128 | Name(networkPolicy.Name). |
| 129 | Body(networkPolicy). |
| 130 | Do(). |
| 131 | Into(result) |
| 132 | return |
| 133 | } |
| 134 | |
| 135 | // Delete takes name of the networkPolicy and deletes it. Returns an error if one occurs. |
| 136 | func (c *networkPolicies) Delete(name string, options *v1.DeleteOptions) error { |
| 137 | return c.client.Delete(). |
| 138 | Namespace(c.ns). |
| 139 | Resource("networkpolicies"). |
| 140 | Name(name). |
| 141 | Body(options). |
| 142 | Do(). |
| 143 | Error() |
| 144 | } |
| 145 | |
| 146 | // DeleteCollection deletes a collection of objects. |
| 147 | func (c *networkPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { |
| 148 | var timeout time.Duration |
| 149 | if listOptions.TimeoutSeconds != nil { |
| 150 | timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second |
| 151 | } |
| 152 | return c.client.Delete(). |
| 153 | Namespace(c.ns). |
| 154 | Resource("networkpolicies"). |
| 155 | VersionedParams(&listOptions, scheme.ParameterCodec). |
| 156 | Timeout(timeout). |
| 157 | Body(options). |
| 158 | Do(). |
| 159 | Error() |
| 160 | } |
| 161 | |
| 162 | // Patch applies the patch and returns the patched networkPolicy. |
| 163 | func (c *networkPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.NetworkPolicy, err error) { |
| 164 | result = &v1beta1.NetworkPolicy{} |
| 165 | err = c.client.Patch(pt). |
| 166 | Namespace(c.ns). |
| 167 | Resource("networkpolicies"). |
| 168 | SubResource(subresources...). |
| 169 | Name(name). |
| 170 | Body(data). |
| 171 | Do(). |
| 172 | Into(result) |
| 173 | return |
| 174 | } |