// Register is used to register an internal plugin.
185554
func Register(id loader.PluginID, config *loader.InternalPluginConfig) {
	mu.Lock()
	defer mu.Unlock()
	catalog[id] = &Registration{
		Config: config,
	}
}
1149152
func (s *resourceServiceImpl) Register(ctx context.Context, resourceTypeName string, resourceID, parentResourceID *string, identityID *uuid.UUID) (*resource.Resource, error) {

	var res *resource.Resource

	err := s.ExecuteInTransaction(func() error {

		// Lookup the resource type
		resourceType, err := s.Repositories().ResourceTypeRepository().Lookup(ctx, resourceTypeName)
		if err != nil {
			return errors.NewBadParameterErrorFromString("type", resourceTypeName, err.Error())
		}

		// Lookup the parent resource if it's specified
		var parentResource *resource.Resource

		if parentResourceID != nil {
			parentResource, err = s.Repositories().ResourceRepository().Load(ctx, *parentResourceID)
			if err != nil {
				return errors.NewBadParameterErrorFromString("parent resource ID", *parentResourceID, err.Error())
			}
		}

		var rID string
		if resourceID != nil {
			rID = *resourceID
		} else {
			rID = uuid.NewV4().String()
		}

		// Create a new resource instance
		res = &resource.Resource{
			ResourceID:       rID,
			ParentResourceID: parentResourceID,
			ResourceType:     *resourceType,
			ResourceTypeID:   resourceType.ResourceTypeID,
			ParentResource:   parentResource,
		}

		// Persist the resource
		err = s.Repositories().ResourceRepository().Create(ctx, res)
		if err != nil {
			return err
		}

		// Search for any default role mappings for the resource type
		defaultRoleMappings, err := s.Repositories().DefaultRoleMappingRepository().FindForResourceType(ctx, resourceType.ResourceTypeID)
		if err != nil {
			return err
		}

		// For each default role mapping for the same resource type, create a role mapping for the resource
		for _, m := range defaultRoleMappings {
			roleMapping := &repository.RoleMapping{
				ResourceID: rID,
				FromRoleID: m.FromRoleID,
				ToRoleID:   m.ToRoleID,
			}

			err = s.Repositories().RoleMappingRepository().Create(ctx, roleMapping)
			if err != nil {
				return err
			}
		}

		if identityID != nil {
			err = s.Repositories().Identities().CheckExists(ctx, (*identityID).String())
			if err != nil {
				return err
			}
			if resourceType.DefaultRoleID != nil {
				defaultRole, err := s.Repositories().RoleRepository().Load(ctx, *resourceType.DefaultRoleID)
				if err != nil {
					return err
				}
				if defaultRole != nil {
					err = s.Services().RoleManagementService().ForceAssign(ctx, *identityID, defaultRole.Name, *res)
					if err != nil {
						return err
					}
				}

			}
		}
		return nil
	})

	return res, err
}
364860
func Register(pl plugin.Plugin) error {
	for _, p := range plugin.Plugins() {
		if p.String() == pl.String() {
			return fmt.Errorf("%s registered globally", pl.String())
		}
	}
	return defaultManager.Register(pl)
}
169970
func (r *Listeners) Register(l Listener) error {
	r.Lock()
	defer r.Unlock()

	if _, ok := r.Listeners[l.key()]; ok {
		return errors.New("listener already registered")
	}

	r.Listeners[l.key()] = l
	return nil
}
767021
func (m *Manager) Register(name string, plugin Plugin) {
	m.mtx.Lock()
	defer m.mtx.Unlock()
	m.plugins = append(m.plugins, namedplugin{
		name:   name,
		plugin: plugin,
	})
}
97926
func Register(value interface{}, enc encoderFunc, dec decoderFunc) {
	typ := reflect.TypeOf(value)
	if enc != nil {
		typEncMap[typ] = enc
	}
	if dec != nil {
		typDecMap[typ] = dec
	}
}
914278
func (p *Registrar) Register() {
	if err := p.client.Register(p.registration); err != nil {
		p.logger.Log("err", err)
	} else {
		p.logger.Log("action", "register")
	}
}
757180
func (p *Plugin) Register(pluginName infra.PluginName, probe PluginStateProbe) {
	p.access.Lock()
	defer p.access.Unlock()

	stat := &status.PluginStatus{
		State:      status.OperationalState_INIT,
		LastChange: time.Now().Unix(),
	}
	p.pluginStat[string(pluginName)] = stat

	if probe != nil {
		p.pluginProbe[string(pluginName)] = probe
	}

	// write initial status data into ETCD
	p.publishPluginData(pluginName, stat)

	p.Log.Debugf("Plugin %v: status check probe registered", pluginName)
}
104264
func (r *Registry) Register(registrant Registrant) {
	if _, ok := r.registrants[registrant.Name()]; ok {
		panic(fmt.Sprintf("%s: registrant %q already registered", r.name, registrant.Name()))
	}
	r.registrants[registrant.Name()] = registrant
}
858904
func (n *Namespaces) Register(namespace *Namespace, q *WriteOptions) (*WriteMeta, error) {
	wm, err := n.client.write("/v1/namespace", namespace, nil, q)
	if err != nil {
		return nil, err
	}
	return wm, nil
}
313147
func (m *ManagerImpl) Register(ctx context.Context, r *pluginapi.RegisterRequest) (*pluginapi.Empty, error) {
	klog.Infof("Got registration request from device plugin with resource name %q", r.ResourceName)
	metrics.DevicePluginRegistrationCount.WithLabelValues(r.ResourceName).Inc()
	metrics.DeprecatedDevicePluginRegistrationCount.WithLabelValues(r.ResourceName).Inc()
	var versionCompatible bool
	for _, v := range pluginapi.SupportedVersions {
		if r.Version == v {
			versionCompatible = true
			break
		}
	}
	if !versionCompatible {
		errorString := fmt.Sprintf(errUnsupportedVersion, r.Version, pluginapi.SupportedVersions)
		klog.Infof("Bad registration request from device plugin with resource name %q: %s", r.ResourceName, errorString)
		return &pluginapi.Empty{}, fmt.Errorf(errorString)
	}

	if !v1helper.IsExtendedResourceName(v1.ResourceName(r.ResourceName)) {
		errorString := fmt.Sprintf(errInvalidResourceName, r.ResourceName)
		klog.Infof("Bad registration request from device plugin: %s", errorString)
		return &pluginapi.Empty{}, fmt.Errorf(errorString)
	}

	// TODO: for now, always accepts newest device plugin. Later may consider to
	// add some policies here, e.g., verify whether an old device plugin with the
	// same resource name is still alive to determine whether we want to accept
	// the new registration.
	go m.addEndpoint(r)

	return &pluginapi.Empty{}, nil
}
1089079
func (b *Bootstrap) Register(m app.Module) error {
	if b.inited {
		return fmt.Errorf("Can not add module after inited")
	}
	b.modules = append(b.modules, m)
	return nil
}
348691
func Register(plugins *admission.Plugins) {
	plugins.Register(PluginName, func(configFile io.Reader) (admission.Interface, error) {
		plugin, err := NewValidatingAdmissionWebhook(configFile)
		if err != nil {
			return nil, err
		}

		return plugin, nil
	})
}
790483
func (p *Plugin) Register(name interface{}, listener func(Status)) {
	p.mtx.Lock()
	defer p.mtx.Unlock()

	if p.listeners == nil {
		p.listeners = map[interface{}]func(Status){}
	}

	p.listeners[name] = listener
}
1344273
func Register(name string, plugin Pluggable) error {
	var err error

	switch Type(plugin.PluginType()) {
	case AgentProviderPlugin:
		err = registerAgentProviderPlugin(name, plugin)

	case AgentPlugin:
		err = registerAgentPlugin(name, plugin)

	case ProvisionTargetResolverPlugin:
		err = registerProvisionTargetResolverPlugin(name, plugin)

	case ConfigMutatorPlugin:
		err = registerConfigMutator(name, plugin)

	default:
		err = fmt.Errorf("unknown plugin type %d from %s", plugin.PluginType(), name)
	}

	return err
}
1112906
func (c *kregistry) Register(s *registry.Service, opts ...registry.RegisterOption) error {
	if len(s.Nodes) == 0 {
		return errors.New("you must register at least one node")
	}

	// TODO: grab podname from somewhere better than this.
	podName := os.Getenv("HOSTNAME")
	svcName := s.Name

	// encode micro service
	b, err := json.Marshal(s)
	if err != nil {
		return err
	}
	svc := string(b)

	pod := &client.Pod{
		Metadata: &client.Meta{
			Labels: map[string]*string{
				labelTypeKey:                             &labelTypeValueService,
				svcSelectorPrefix + serviceName(svcName): &svcSelectorValue,
			},
			Annotations: map[string]*string{
				annotationServiceKeyPrefix + serviceName(svcName): &svc,
			},
		},
	}

	if _, err := c.client.UpdatePod(podName, pod); err != nil {
		return err
	}

	return nil

}
57173
func (s *Instancer) Register(ch chan<- sd.Event) {
	s.cache.Register(ch)
}