k8s/io/kubernetes/pkg/api/errors.IsForbidden 示例代码

2022-03-03

以下示例是关于golang中包含errors.IsForbidden用法的示例代码,想了解errors.IsForbidden的具体用法?errors.IsForbidden怎么用?errors.IsForbidden使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。

示例1:
discovery_client.go开发语言: Go项目名称: bparees代码行数: 516
163	}
164	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
165		return nil, err
170	err = d.restClient.Get().AbsPath("/apis").Do(context.TODO()).Into(apiGroupList)
171	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
172		return nil, err
174	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
175	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
176		apiGroupList = &metav1.APIGroupList{}
202		// ignore 403 or 404 error to be compatible with an v1.0 server.
203		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
204			return resources, nil
424	if err != nil {
425		if errors.IsForbidden(err) || errors.IsNotFound(err) || errors.IsNotAcceptable(err) {
426			// single endpoint not found/registered in old server, try to fetch old endpoint
示例2:
discovery_client.go开发语言: Go项目名称: byxorna代码行数: 516
163	}
164	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
165		return nil, err
170	err = d.restClient.Get().AbsPath("/apis").Do(context.TODO()).Into(apiGroupList)
171	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
172		return nil, err
174	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
175	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
176		apiGroupList = &metav1.APIGroupList{}
202		// ignore 403 or 404 error to be compatible with an v1.0 server.
203		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
204			return resources, nil
424	if err != nil {
425		if errors.IsForbidden(err) || errors.IsNotFound(err) || errors.IsNotAcceptable(err) {
426			// single endpoint not found/registered in old server, try to fetch old endpoint
示例3:
discovery_client.go开发语言: Go项目名称: ComplianceAsCode代码行数: 508
162	}
163	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
164		return nil, err
169	err = d.restClient.Get().AbsPath("/apis").Do().Into(apiGroupList)
170	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
171		return nil, err
173	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
174	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
175		apiGroupList = &metav1.APIGroupList{}
201		// ignore 403 or 404 error to be compatible with an v1.0 server.
202		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
203			return resources, nil
423	if err != nil {
424		if errors.IsForbidden(err) || errors.IsNotFound(err) || errors.IsNotAcceptable(err) {
425			// single endpoint not found/registered in old server, try to fetch old endpoint
示例4:
discovery_client.go开发语言: Go项目名称: csrwng代码行数: 508
162	}
163	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
164		return nil, err
169	err = d.restClient.Get().AbsPath("/apis").Do().Into(apiGroupList)
170	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
171		return nil, err
173	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
174	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
175		apiGroupList = &metav1.APIGroupList{}
201		// ignore 403 or 404 error to be compatible with an v1.0 server.
202		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
203			return resources, nil
423	if err != nil {
424		if errors.IsForbidden(err) || errors.IsNotFound(err) || errors.IsNotAcceptable(err) {
425			// single endpoint not found/registered in old server, try to fetch old endpoint
示例5:
discovery_client.go开发语言: Go项目名称: abhgupta代码行数: 405
132	}
133	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
134		return nil, err
139	err = d.restClient.Get().AbsPath("/apis").Do().Into(apiGroupList)
140	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
141		return nil, err
143	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
144	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
145		apiGroupList = &metav1.APIGroupList{}
171		// ignore 403 or 404 error to be compatible with an v1.0 server.
172		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
173			return resources, nil
示例6:
discovery_client.go开发语言: Go项目名称: amygdala代码行数: 252
103	}
104	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
105		return nil, err
110	err = d.Get().AbsPath("/apis").Do().Into(apiGroupList)
111	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
112		return nil, err
114	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
115	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
116		apiGroupList = &unversioned.APIGroupList{}
135		// ignore 403 or 404 error to be compatible with an v1.0 server.
136		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
137			return resources, nil
示例7:
discovery_client.go开发语言: Go项目名称: cloud-zuiwanyuan代码行数: 317
114	}
115	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
116		return nil, err
121	err = d.Get().AbsPath("/apis").Do().Into(apiGroupList)
122	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
123		return nil, err
125	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
126	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
127		apiGroupList = &unversioned.APIGroupList{}
149		// ignore 403 or 404 error to be compatible with an v1.0 server.
150		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
151			return resources, nil
示例8:
discovery_client.go开发语言: Go项目名称: cloud-zuiwanyuan代码行数: 317
114	}
115	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
116		return nil, err
121	err = d.Get().AbsPath("/apis").Do().Into(apiGroupList)
122	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
123		return nil, err
125	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
126	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
127		apiGroupList = &unversioned.APIGroupList{}
149		// ignore 403 or 404 error to be compatible with an v1.0 server.
150		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
151			return resources, nil
示例9:
discovery_client.go开发语言: Go项目名称: coreos代码行数: 439
128	}
129	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
130		return nil, err
135	err = d.restClient.Get().AbsPath("/apis").Do().Into(apiGroupList)
136	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
137		return nil, err
139	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
140	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
141		apiGroupList = &metav1.APIGroupList{}
167		// ignore 403 or 404 error to be compatible with an v1.0 server.
168		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
169			return resources, nil
示例10:
discovery_client.go开发语言: Go项目名称: cjcullen代码行数: 368
124	}
125	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
126		return nil, err
131	err = d.restClient.Get().AbsPath("/apis").Do().Into(apiGroupList)
132	if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
133		return nil, err
135	// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
136	if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
137		apiGroupList = &unversioned.APIGroupList{}
159		// ignore 403 or 404 error to be compatible with an v1.0 server.
160		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
161			return resources, nil

本文地址:https://www.itbaoku.cn/snippets/415693.html