forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
useridentitymappings.go
59 lines (50 loc) · 2.32 KB
/
useridentitymappings.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
package client
import (
userapi "github.com/openshift/origin/pkg/user/apis/user"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kapi "k8s.io/kubernetes/pkg/api"
)
// UserIdentityMappingsInterface has methods to work with UserIdentityMapping resources in a namespace
type UserIdentityMappingsInterface interface {
UserIdentityMappings() UserIdentityMappingInterface
}
// UserIdentityMappingInterface exposes methods on UserIdentityMapping resources.
type UserIdentityMappingInterface interface {
Get(string, metav1.GetOptions) (*userapi.UserIdentityMapping, error)
Create(*userapi.UserIdentityMapping) (*userapi.UserIdentityMapping, error)
Update(*userapi.UserIdentityMapping) (*userapi.UserIdentityMapping, error)
Delete(string) error
}
// userIdentityMappings implements UserIdentityMappingsNamespacer interface
type userIdentityMappings struct {
r *Client
}
// newUserIdentityMappings returns a userIdentityMappings
func newUserIdentityMappings(c *Client) *userIdentityMappings {
return &userIdentityMappings{
r: c,
}
}
// Get returns information about a particular mapping or an error
func (c *userIdentityMappings) Get(name string, options metav1.GetOptions) (result *userapi.UserIdentityMapping, err error) {
result = &userapi.UserIdentityMapping{}
err = c.r.Get().Resource("userIdentityMappings").Name(name).VersionedParams(&options, kapi.ParameterCodec).Do().Into(result)
return
}
// Create creates a new mapping. Returns the server's representation of the mapping and error if one occurs.
func (c *userIdentityMappings) Create(mapping *userapi.UserIdentityMapping) (result *userapi.UserIdentityMapping, err error) {
result = &userapi.UserIdentityMapping{}
err = c.r.Post().Resource("userIdentityMappings").Body(mapping).Do().Into(result)
return
}
// Update updates the mapping on server. Returns the server's representation of the mapping and error if one occurs.
func (c *userIdentityMappings) Update(mapping *userapi.UserIdentityMapping) (result *userapi.UserIdentityMapping, err error) {
result = &userapi.UserIdentityMapping{}
err = c.r.Put().Resource("userIdentityMappings").Name(mapping.Name).Body(mapping).Do().Into(result)
return
}
// Delete deletes the mapping on server.
func (c *userIdentityMappings) Delete(name string) (err error) {
err = c.r.Delete().Resource("userIdentityMappings").Name(name).Do().Error()
return
}