// CreateSource creates a platform source and sets s.ID.
551828
func (c *Client) CreateSource(ctx context.Context, s *platform.Source) error {
	err := c.db.Update(func(tx *bolt.Tx) error {
		s.ID = c.IDGenerator.ID()

		// Generating an organization id if it missing or invalid
		if !s.OrganizationID.Valid() {
			s.OrganizationID = c.IDGenerator.ID()
		}

		return c.putSource(ctx, tx, s)
	})
	if err != nil {
		return &platform.Error{
			Err: err,
			Op:  getOp(platform.OpCreateSource),
		}
	}
	return nil
}
390512
func (arc *ConfigFactory) AddSource(source core.ConfigSource) error {
	if source == nil {
		return errors.New("source can not be nil")
	}
	if arc.initSuccess == false {
		openlogging.Warn("Plz call factory.Init() first, failed to add source: " + source.GetSourceName())
		return nil
	}

	return arc.configMgr.AddSource(source, source.GetPriority())
}
657788
func (s *SourceService) DeleteSource(ctx context.Context, id platform.ID) error {
	return s.DeleteSourceFn(ctx, id)
}
796459
func (o *Disk) SetSource(v *string) *Disk {
	if o.Source = v; o.Source == nil {
		o.nullFields = append(o.nullFields, "Source")
	}
	return o
}
1137593
func NewCachableSource(root string) *CachableSource {
	ts := &CachableSource{
		tree: iradix.New(),
		root: containerfs.NewLocalContainerFS(root),
	}
	return ts
}
31728
func (s *CreateFlowInput) SetSource(v *SetSourceRequest) *CreateFlowInput {
	s.Source = v
	return s
}
201201
func (s *StartSigningJobInput) SetSource(v *Source) *StartSigningJobInput {
	s.Source = v
	return s
}
1201305
func (p *ChargeParams) SetSource(sp interface{}) error {
	source, err := SourceParamsFor(sp)
	p.Source = source
	return err
}
1373270
func (op *OrderPayParams) SetSource(sp interface{}) error {
	source, err := SourceParamsFor(sp)
	op.Source = source
	return err
}
1251416
func (b *BaseBody) SetSource(s *string) {
	if s == nil {
		b.StructSource = SourceSystem
	} else {
		b.StructSource = SourceType(*s)
	}
}
723594
func (s *TerminationHealth) SetSource(v string) *TerminationHealth {
	s.Source = &v
	return s
}
43065
func (s *TimecodeConfig) SetSource(v string) *TimecodeConfig {
	s.Source = &v
	return s
}
95710
func (s *SourceService) CreateSource(ctx context.Context, source *platform.Source) error {
	return s.CreateSourceFn(ctx, source)
}
328166
func NewBundleSource(bundle *Bundle, callbacks ...BundleActor) *BundleSource {
	bs := &BundleSource{
		callbacks: callbacks,
	}
	bs.Update(bundle)
	return bs
}
209951
func (c *Client) FindSourceByID(ctx context.Context, id platform.ID) (*platform.Source, error) {
	var s *platform.Source

	err := c.db.View(func(tx *bolt.Tx) error {
		src, pe := c.findSourceByID(ctx, tx, id)
		if pe != nil {
			return &platform.Error{
				Err: pe,
				Op:  getOp(platform.OpFindSourceByID),
			}
		}
		s = src
		return nil
	})
	return s, err
}
80691
func (cp *CustomerParams) SetSource(sp interface{}) error {
	source, err := SourceParamsFor(sp)
	cp.Source = source
	return err
}
1292545
func (c *Client) PutSource(ctx context.Context, s *platform.Source) error {
	return c.db.Update(func(tx *bolt.Tx) error {
		return c.putSource(ctx, tx, s)
	})
}