Ai
1 Star 0 Fork 0

ryancartoon/sensu-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
clusterrolebinding.go 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
package client
import (
corev2 "github.com/sensu/sensu-go/api/core/v2"
"github.com/sensu/sensu-go/types"
)
var clusterRoleBindingsPath = CreateBasePath(coreAPIGroup, coreAPIVersion, "clusterrolebindings")
// CreateClusterRoleBinding with the given cluster role binding
func (client *RestClient) CreateClusterRoleBinding(clusterRoleBinding *types.ClusterRoleBinding) error {
return client.Post(clusterRoleBindingsPath(), clusterRoleBinding)
}
// DeleteClusterRoleBinding with the given name
func (client *RestClient) DeleteClusterRoleBinding(name string) error {
return client.Delete(clusterRoleBindingsPath(name))
}
// FetchClusterRoleBinding with the given name
func (client *RestClient) FetchClusterRoleBinding(name string) (*types.ClusterRoleBinding, error) {
clusterRoleBinding := &types.ClusterRoleBinding{}
if err := client.Get(clusterRoleBindingsPath(name), clusterRoleBinding); err != nil {
return nil, err
}
return clusterRoleBinding, nil
}
// ListClusterRoleBinding in the cluster
func (client *RestClient) ListClusterRoleBindings(options *ListOptions) ([]corev2.ClusterRoleBinding, error) {
clusterRoleBindings := []corev2.ClusterRoleBinding{}
if err := client.List(clusterRoleBindingsPath(), &clusterRoleBindings, options); err != nil {
return clusterRoleBindings, err
}
return clusterRoleBindings, nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ryancartoon/sensu-go.git
git@gitee.com:ryancartoon/sensu-go.git
ryancartoon
sensu-go
sensu-go
v5.10.1

搜索帮助