| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package v1 |
| 20 |
|
| 21 |
import ( |
| 22 |
context "context" |
| 23 |
|
| 24 |
rbacv1 "k8s.io/api/rbac/v1" |
| 25 |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 26 |
types "k8s.io/apimachinery/pkg/types" |
| 27 |
watch "k8s.io/apimachinery/pkg/watch" |
| 28 |
applyconfigurationsrbacv1 "k8s.io/client-go/applyconfigurations/rbac/v1" |
| 29 |
gentype "k8s.io/client-go/gentype" |
| 30 |
scheme "k8s.io/client-go/kubernetes/scheme" |
| 31 |
) |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
type RolesGetter interface { |
| 36 |
Roles(namespace string) RoleInterface |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
type RoleInterface interface { |
| 41 |
Create(ctx context.Context, role *rbacv1.Role, opts metav1.CreateOptions) (*rbacv1.Role, error) |
| 42 |
Update(ctx context.Context, role *rbacv1.Role, opts metav1.UpdateOptions) (*rbacv1.Role, error) |
| 43 |
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error |
| 44 |
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error |
| 45 |
Get(ctx context.Context, name string, opts metav1.GetOptions) (*rbacv1.Role, error) |
| 46 |
List(ctx context.Context, opts metav1.ListOptions) (*rbacv1.RoleList, error) |
| 47 |
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) |
| 48 |
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *rbacv1.Role, err error) |
| 49 |
Apply(ctx context.Context, role *applyconfigurationsrbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *rbacv1.Role, err error) |
| 50 |
RoleExpansion |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
type roles struct { |
| 55 |
*gentype.ClientWithListAndApply[*rbacv1.Role, *rbacv1.RoleList, *applyconfigurationsrbacv1.RoleApplyConfiguration] |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
func newRoles(c *RbacV1Client, namespace string) *roles { |
| 60 |
return &roles{ |
| 61 |
gentype.NewClientWithListAndApply[*rbacv1.Role, *rbacv1.RoleList, *applyconfigurationsrbacv1.RoleApplyConfiguration]( |
| 62 |
"roles", |
| 63 |
c.RESTClient(), |
| 64 |
scheme.ParameterCodec, |
| 65 |
namespace, |
| 66 |
func() *rbacv1.Role { return &rbacv1.Role{} }, |
| 67 |
func() *rbacv1.RoleList { return &rbacv1.RoleList{} }, |
| 68 |
gentype.PrefersProtobuf[*rbacv1.Role](), |
| 69 |
), |
| 70 |
} |
| 71 |
} |