代码拉取完成,页面将自动刷新
package client
import (
corev2 "github.com/sensu/sensu-go/api/core/v2"
"github.com/sensu/sensu-go/types"
)
var clusterRolesPath = CreateBasePath(coreAPIGroup, coreAPIVersion, "clusterroles")
// CreateClusterRole with the given cluster role
func (client *RestClient) CreateClusterRole(clusterRole *types.ClusterRole) error {
return client.Post(clusterRolesPath(), clusterRole)
}
// DeleteClusterRole with the given name
func (client *RestClient) DeleteClusterRole(name string) error {
return client.Delete(clusterRolesPath(name))
}
// FetchClusterRole with the given name
func (client *RestClient) FetchClusterRole(name string) (*types.ClusterRole, error) {
clusterRole := &types.ClusterRole{}
if err := client.Get(clusterRolesPath(name), clusterRole); err != nil {
return nil, err
}
return clusterRole, nil
}
// ListClusterRoles within the namespace
func (client *RestClient) ListClusterRoles(options *ListOptions) ([]corev2.ClusterRole, error) {
clusterRoles := []corev2.ClusterRole{}
if err := client.List(clusterRolesPath(), &clusterRoles, options); err != nil {
return clusterRoles, err
}
return clusterRoles, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。