k8s/io/kubernetes/pkg/api/meta.Name 示例代码

2022-03-03

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

示例1:
meta.go开发语言: Go项目名称: juju代码行数: 384
165	meta = &Meta{}
166	meta.Name = m["name"].(string)
167	// Schema decodes as int64, but the int range should be good
198			if rel.Name != name {
199				return fmt.Errorf("charm %q has mismatched relation name %q; expected %q", meta.Name, rel.Name, name)
200			}
201			if rel.Role != role {
202				return fmt.Errorf("charm %q has mismatched role %q; expected %q", meta.Name, rel.Role, role)
203			}
207				if reservedName(name) {
208					return fmt.Errorf("charm %q using a reserved relation name: %q", meta.Name, name)
209				}
212				if reservedName(rel.Interface) {
213					return fmt.Errorf("charm %q relation %q using a reserved interface: %q", meta.Name, name, rel.Interface)
214				}
示例2:
validation.go开发语言: Go项目名称: kubernetes代码行数: 938
174	// report it here. This may confuse users, but indicates a programming bug and still must be validated.
175	if len(meta.Name) == 0 {
176		allErrs = append(allErrs, errs.NewFieldRequired("name", meta.Name))
177	} else {
178		if ok, qualifier := nameFn(meta.Name, false); !ok {
179			allErrs = append(allErrs, errs.NewFieldInvalid("name", meta.Name, qualifier))
183	if requiresNamespace {
184		if len(meta.Namespace) == 0 {
185			allErrs = append(allErrs, errs.NewFieldRequired("namespace", meta.Namespace))
186		} else if !util.IsDNSSubdomain(meta.Namespace) {
187			allErrs = append(allErrs, errs.NewFieldInvalid("namespace", meta.Namespace, dnsSubdomainErrorMsg))
189	} else {
190		if len(meta.Namespace) != 0 {
191			allErrs = append(allErrs, errs.NewFieldInvalid("namespace", meta.Namespace, "namespace is not allowed on this type"))
示例3:
charm_test.go开发语言: Go项目名称: juju代码行数: 219
39	meta := dummy.Meta()
40	c.Assert(meta.Name, gc.Equals, "dummy")
41	config := dummy.Config()
示例4:
meta_test.go开发语言: Go项目名称: juju代码行数: 534
41	c.Assert(err, gc.IsNil)
42	c.Assert(meta.Name, gc.Equals, "dummy")
43	c.Assert(meta.Summary, gc.Equals, "That's a dummy charm.")
53	c.Assert(err, gc.IsNil)
54	c.Assert(meta.Name, gc.Equals, "format2")
55	c.Assert(meta.Format, gc.Equals, 2)
示例5:
charm_test.go开发语言: Go项目名称: juju代码行数: 184
42	meta := dummy.Meta()
43	c.Assert(meta.Name, gc.Equals, "dummy")
44	config := dummy.Config()
示例6:
printers.go开发语言: Go项目名称: ddysher代码行数: 1872
1259	meta := roleBinding.ObjectMeta
1260	name := printers.FormatResourceName(options.Kind, meta.Name, options.WithKind)
1261
1262	if options.WithNamespace {
1263		if _, err := fmt.Fprintf(w, "%s\t", meta.Namespace); err != nil {
1264			return err
1307	meta := clusterRoleBinding.ObjectMeta
1308	name := printers.FormatResourceName(options.Kind, meta.Name, options.WithKind)
1309
示例7:
meta.go开发语言: Go项目名称: ddysher代码行数: 108
27// fast, direct access to metadata fields for API objects.
28func (meta *ObjectMeta) GetNamespace() string                { return meta.Namespace }
29func (meta *ObjectMeta) SetNamespace(namespace string)       { meta.Namespace = namespace }
30func (meta *ObjectMeta) GetName() string                     { return meta.Name }
31func (meta *ObjectMeta) SetName(name string)                 { meta.Name = name }
示例8:
meta.go开发语言: Go项目名称: ddysher代码行数: 201
115// fast, direct access to metadata fields for API objects.
116func (meta *ObjectMeta) GetNamespace() string                { return meta.Namespace }
117func (meta *ObjectMeta) SetNamespace(namespace string)       { meta.Namespace = namespace }
118func (meta *ObjectMeta) GetName() string                     { return meta.Name }
119func (meta *ObjectMeta) SetName(name string)                 { meta.Name = name }
示例9:
meta.go开发语言: Go项目名称: detiber代码行数: 108
27// fast, direct access to metadata fields for API objects.
28func (meta *ObjectMeta) GetNamespace() string                { return meta.Namespace }
29func (meta *ObjectMeta) SetNamespace(namespace string)       { meta.Namespace = namespace }
30func (meta *ObjectMeta) GetName() string                     { return meta.Name }
31func (meta *ObjectMeta) SetName(name string)                 { meta.Name = name }
示例10:
meta.go开发语言: Go项目名称: detiber代码行数: 201
115// fast, direct access to metadata fields for API objects.
116func (meta *ObjectMeta) GetNamespace() string                { return meta.Namespace }
117func (meta *ObjectMeta) SetNamespace(namespace string)       { meta.Namespace = namespace }
118func (meta *ObjectMeta) GetName() string                     { return meta.Name }
119func (meta *ObjectMeta) SetName(name string)                 { meta.Name = name }

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