github.com/verrazzano/verrazzano@v1.7.1/application-operator/clientset/versioned/typed/app/v1alpha1/metricsbinding.go (about) 1 // Copyright (c) 2021, 2023, Oracle and/or its affiliates. 2 // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 3 4 // Code generated by client-gen. DO NOT EDIT. 5 6 package v1alpha1 7 8 import ( 9 "context" 10 "time" 11 12 v1alpha1 "github.com/verrazzano/verrazzano/application-operator/apis/app/v1alpha1" 13 scheme "github.com/verrazzano/verrazzano/application-operator/clientset/versioned/scheme" 14 v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 15 types "k8s.io/apimachinery/pkg/types" 16 watch "k8s.io/apimachinery/pkg/watch" 17 rest "k8s.io/client-go/rest" 18 ) 19 20 // MetricsBindingsGetter has a method to return a MetricsBindingInterface. 21 // A group's client should implement this interface. 22 type MetricsBindingsGetter interface { 23 MetricsBindings(namespace string) MetricsBindingInterface 24 } 25 26 // MetricsBindingInterface has methods to work with MetricsBinding resources. 27 type MetricsBindingInterface interface { 28 Create(ctx context.Context, metricsBinding *v1alpha1.MetricsBinding, opts v1.CreateOptions) (*v1alpha1.MetricsBinding, error) 29 Update(ctx context.Context, metricsBinding *v1alpha1.MetricsBinding, opts v1.UpdateOptions) (*v1alpha1.MetricsBinding, error) 30 Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 31 DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 32 Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.MetricsBinding, error) 33 List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MetricsBindingList, error) 34 Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 35 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MetricsBinding, err error) 36 MetricsBindingExpansion 37 } 38 39 // metricsBindings implements MetricsBindingInterface 40 type metricsBindings struct { 41 client rest.Interface 42 ns string 43 } 44 45 // newMetricsBindings returns a MetricsBindings 46 func newMetricsBindings(c *AppV1alpha1Client, namespace string) *metricsBindings { 47 return &metricsBindings{ 48 client: c.RESTClient(), 49 ns: namespace, 50 } 51 } 52 53 // Get takes name of the metricsBinding, and returns the corresponding metricsBinding object, and an error if there is any. 54 func (c *metricsBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MetricsBinding, err error) { 55 result = &v1alpha1.MetricsBinding{} 56 err = c.client.Get(). 57 Namespace(c.ns). 58 Resource("metricsbindings"). 59 Name(name). 60 VersionedParams(&options, scheme.ParameterCodec). 61 Do(ctx). 62 Into(result) 63 return 64 } 65 66 // List takes label and field selectors, and returns the list of MetricsBindings that match those selectors. 67 func (c *metricsBindings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MetricsBindingList, err error) { 68 var timeout time.Duration 69 if opts.TimeoutSeconds != nil { 70 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second 71 } 72 result = &v1alpha1.MetricsBindingList{} 73 err = c.client.Get(). 74 Namespace(c.ns). 75 Resource("metricsbindings"). 76 VersionedParams(&opts, scheme.ParameterCodec). 77 Timeout(timeout). 78 Do(ctx). 79 Into(result) 80 return 81 } 82 83 // Watch returns a watch.Interface that watches the requested metricsBindings. 84 func (c *metricsBindings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { 85 var timeout time.Duration 86 if opts.TimeoutSeconds != nil { 87 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second 88 } 89 opts.Watch = true 90 return c.client.Get(). 91 Namespace(c.ns). 92 Resource("metricsbindings"). 93 VersionedParams(&opts, scheme.ParameterCodec). 94 Timeout(timeout). 95 Watch(ctx) 96 } 97 98 // Create takes the representation of a metricsBinding and creates it. Returns the server's representation of the metricsBinding, and an error, if there is any. 99 func (c *metricsBindings) Create(ctx context.Context, metricsBinding *v1alpha1.MetricsBinding, opts v1.CreateOptions) (result *v1alpha1.MetricsBinding, err error) { 100 result = &v1alpha1.MetricsBinding{} 101 err = c.client.Post(). 102 Namespace(c.ns). 103 Resource("metricsbindings"). 104 VersionedParams(&opts, scheme.ParameterCodec). 105 Body(metricsBinding). 106 Do(ctx). 107 Into(result) 108 return 109 } 110 111 // Update takes the representation of a metricsBinding and updates it. Returns the server's representation of the metricsBinding, and an error, if there is any. 112 func (c *metricsBindings) Update(ctx context.Context, metricsBinding *v1alpha1.MetricsBinding, opts v1.UpdateOptions) (result *v1alpha1.MetricsBinding, err error) { 113 result = &v1alpha1.MetricsBinding{} 114 err = c.client.Put(). 115 Namespace(c.ns). 116 Resource("metricsbindings"). 117 Name(metricsBinding.Name). 118 VersionedParams(&opts, scheme.ParameterCodec). 119 Body(metricsBinding). 120 Do(ctx). 121 Into(result) 122 return 123 } 124 125 // Delete takes name of the metricsBinding and deletes it. Returns an error if one occurs. 126 func (c *metricsBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { 127 return c.client.Delete(). 128 Namespace(c.ns). 129 Resource("metricsbindings"). 130 Name(name). 131 Body(&opts). 132 Do(ctx). 133 Error() 134 } 135 136 // DeleteCollection deletes a collection of objects. 137 func (c *metricsBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { 138 var timeout time.Duration 139 if listOpts.TimeoutSeconds != nil { 140 timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second 141 } 142 return c.client.Delete(). 143 Namespace(c.ns). 144 Resource("metricsbindings"). 145 VersionedParams(&listOpts, scheme.ParameterCodec). 146 Timeout(timeout). 147 Body(&opts). 148 Do(ctx). 149 Error() 150 } 151 152 // Patch applies the patch and returns the patched metricsBinding. 153 func (c *metricsBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MetricsBinding, err error) { 154 result = &v1alpha1.MetricsBinding{} 155 err = c.client.Patch(pt). 156 Namespace(c.ns). 157 Resource("metricsbindings"). 158 Name(name). 159 SubResource(subresources...). 160 VersionedParams(&opts, scheme.ParameterCodec). 161 Body(data). 162 Do(ctx). 163 Into(result) 164 return 165 }