-
Notifications
You must be signed in to change notification settings - Fork 143
/
imagetag.go
111 lines (99 loc) · 3.5 KB
/
imagetag.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Code generated by client-gen. DO NOT EDIT.
package v1
import (
"context"
"time"
v1 "github.com/openshift/api/image/v1"
scheme "github.com/openshift/client-go/image/clientset/versioned/scheme"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
rest "k8s.io/client-go/rest"
)
// ImageTagsGetter has a method to return a ImageTagInterface.
// A group's client should implement this interface.
type ImageTagsGetter interface {
ImageTags(namespace string) ImageTagInterface
}
// ImageTagInterface has methods to work with ImageTag resources.
type ImageTagInterface interface {
Create(ctx context.Context, imageTag *v1.ImageTag, opts metav1.CreateOptions) (*v1.ImageTag, error)
Update(ctx context.Context, imageTag *v1.ImageTag, opts metav1.UpdateOptions) (*v1.ImageTag, error)
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ImageTag, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ImageTagList, error)
ImageTagExpansion
}
// imageTags implements ImageTagInterface
type imageTags struct {
client rest.Interface
ns string
}
// newImageTags returns a ImageTags
func newImageTags(c *ImageV1Client, namespace string) *imageTags {
return &imageTags{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the imageTag, and returns the corresponding imageTag object, and an error if there is any.
func (c *imageTags) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ImageTag, err error) {
result = &v1.ImageTag{}
err = c.client.Get().
Namespace(c.ns).
Resource("imagetags").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ImageTags that match those selectors.
func (c *imageTags) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ImageTagList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1.ImageTagList{}
err = c.client.Get().
Namespace(c.ns).
Resource("imagetags").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Create takes the representation of a imageTag and creates it. Returns the server's representation of the imageTag, and an error, if there is any.
func (c *imageTags) Create(ctx context.Context, imageTag *v1.ImageTag, opts metav1.CreateOptions) (result *v1.ImageTag, err error) {
result = &v1.ImageTag{}
err = c.client.Post().
Namespace(c.ns).
Resource("imagetags").
VersionedParams(&opts, scheme.ParameterCodec).
Body(imageTag).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a imageTag and updates it. Returns the server's representation of the imageTag, and an error, if there is any.
func (c *imageTags) Update(ctx context.Context, imageTag *v1.ImageTag, opts metav1.UpdateOptions) (result *v1.ImageTag, err error) {
result = &v1.ImageTag{}
err = c.client.Put().
Namespace(c.ns).
Resource("imagetags").
Name(imageTag.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(imageTag).
Do(ctx).
Into(result)
return
}
// Delete takes name of the imageTag and deletes it. Returns an error if one occurs.
func (c *imageTags) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("imagetags").
Name(name).
Body(&opts).
Do(ctx).
Error()
}