// addMetadata applies metadata specified in the template
439987
func (woc *wfOperationCtx) addMetadata(pod *apiv1.Pod, tmpl *wfv1.Template) {
	for k, v := range tmpl.Metadata.Annotations {
		pod.ObjectMeta.Annotations[k] = v
	}
	for k, v := range tmpl.Metadata.Labels {
		pod.ObjectMeta.Labels[k] = v
	}
	if woc.workflowDeadline != nil {
		execCtl := common.ExecutionControl{
			Deadline: woc.workflowDeadline,
		}
		execCtlBytes, err := json.Marshal(execCtl)
		if err != nil {
			panic(err)
		}
		pod.ObjectMeta.Annotations[common.AnnotationKeyExecutionControl] = string(execCtlBytes)
	}
}
1231394
func (s *TrustedAdvisorCheckDescription) SetMetadata(v []*string) *TrustedAdvisorCheckDescription {
	s.Metadata = v
	return s
}
777518
func (o *UplinkConnection) CreateMetadata(child *Metadata) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
252698
func (s *CreateJobInput) SetUserMetadata(v map[string]*string) *CreateJobInput {
	s.UserMetadata = v
	return s
}
221180
func (n *metadataNode) metadata() (md []*api.PrefixMetadata) {
	n.assertFrozen()
	if n.parent != nil {
		md = n.parent.metadata()
	} else {
		md = make([]*api.PrefixMetadata, 0, 32) // 32 is picked arbitrarily
	}
	if n.md != nil {
		md = append(md, n.md)
	}
	return
}
763784
func addDefaultMetadata(obj runtime.Object) {
	metadata, err := meta.Accessor(obj)
	if err != nil {
		// if this happens, then some static code is broken
		panic(err)
	}

	annotations := metadata.GetAnnotations()
	if annotations == nil {
		annotations = map[string]string{}
	}
	for k, v := range bootstrappolicy.Annotation {
		annotations[k] = v
	}
	metadata.SetAnnotations(annotations)
}
1192793
func (s *RouteData) SetMetadata(v *ResourceMetadata) *RouteData {
	s.Metadata = v
	return s
}
861108
func (s *RedisAnnouncementStore) AddMetadata(serviceName, serviceID string, metadata ...Metadata) error {
	key := fmt.Sprintf("%s:%s", serviceName, serviceID)

	metadataStrings := make([]string, 0, len(metadata))
	for _, meta := range metadata {
		txt, err := meta.MarshalText()
		if err != nil {
			return err
		}
		metadataStrings = append(metadataStrings, string(txt))

		switch meta := meta.(type) {
		case AppIDMetadata:
			existing, err := s.byAppID.Get(meta.AppID)
			switch {
			case errors.GetErrType(err) == errors.NotFound:
				if err := s.byAppID.Create(meta.AppID, key); err != nil {
					return err
				}
			case err != nil:
				return err
			case existing == key:
				continue
			default:
				go s.metadata.Remove(existing, string(txt))
				if err := s.byAppID.Update(meta.AppID, key); err != nil {
					return err
				}
			}
		case GatewayIDMetadata:
			existing, err := s.byGatewayID.Get(meta.GatewayID)
			switch {
			case errors.GetErrType(err) == errors.NotFound:
				if err := s.byGatewayID.Create(meta.GatewayID, key); err != nil {
					return err
				}
			case err != nil:
				return err
			case existing == key:
				continue
			default:
				go s.metadata.Remove(existing, string(txt))
				if err := s.byGatewayID.Update(meta.GatewayID, key); err != nil {
					return err
				}
			}
		case AppEUIMetadata:
			existing, err := s.byAppEUI.Get(meta.AppEUI.String())
			switch {
			case errors.GetErrType(err) == errors.NotFound:
				if err := s.byAppEUI.Create(meta.AppEUI.String(), key); err != nil {
					return err
				}
			case err != nil:
				return err
			case existing == key:
				continue
			default:
				go s.metadata.Remove(existing, string(txt))
				if err := s.byAppEUI.Update(meta.AppEUI.String(), key); err != nil {
					return err
				}
			}
		}
	}
	err := s.metadata.Add(key, metadataStrings...)
	if err != nil {
		return err
	}
	return nil
}
1265500
func (s *CopyObjectInput) SetMetadata(v map[string]*string) *CopyObjectInput {
	s.Metadata = v
	return s
}
1340807
func (s *GetFolderOutput) SetMetadata(v *FolderMetadata) *GetFolderOutput {
	s.Metadata = v
	return s
}
314776
func (s *GetTemplateSummaryOutput) SetMetadata(v string) *GetTemplateSummaryOutput {
	s.Metadata = &v
	return s
}
1020217
func (s *GetObjectOutput) SetMetadata(v map[string]*string) *GetObjectOutput {
	s.Metadata = v
	return s
}
798075
func AddGRPCInfoToMetadata(
	metadata map[string]string,
	region string,
	host, port string,
	externalHost, externalPort string,
) map[string]string {
	metadata[constants.GRPCHostKey] = host
	metadata[constants.GRPCPortKey] = port
	metadata[constants.GRPCExternalHostKey] = externalHost
	metadata[constants.GRPCExternalPortKey] = externalPort
	metadata[constants.RegionKey] = region
	return metadata
}
19833
func Metadatify(i interface{}) (Metadata, error) {
	value := reflect.ValueOf(i)
	if value.Kind() == reflect.Map {
		m := map[string]interface{}{}
		for _, k := range value.MapKeys() {
			m[k.String()] = value.MapIndex(k).Interface()
		}
		return Metadata(m), nil
	}
	return nil, errors.New("is not a map")
}
809757
func (s *Application) SetMetadata(v map[string]*string) *Application {
	s.Metadata = v
	return s
}
429858
func LoadedMetadata(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "loadedmetadata", Listener: listener}
}
420535
func (s *StartRestoreJobInput) SetMetadata(v map[string]*string) *StartRestoreJobInput {
	s.Metadata = v
	return s
}