// VolumeSource is defined on the storage.Provider interface.
347701
func (s *storageProvider) VolumeSource(cfg *storage.Config) (storage.VolumeSource, error) {
	environConfig := s.env.Config()
	name := environConfig.Name()
	uuid := environConfig.UUID()
	return newOracleVolumeSource(s.env, name, uuid, s.env.client, clock.WallClock)
}
278062
func BuildSource(s string) *Source {
	var result []string
	var lineBuf bytes.Buffer
	for _, runeValue := range s {
		lineBuf.WriteRune(runeValue)
		if runeValue == '\n' {
			result = append(result, lineBuf.String())
			lineBuf.Reset()
		}
	}
	rest := lineBuf.String()
	// Stuff after last end-of-line (EOF or some more code)
	result = append(result, rest+"\n")
	return &Source{result}
}
826290
func NewSource(opts ...SrcOption) (*Source, error) {
	s := &Source{
		records: make(chan map[string]interface{}, 100),
		errors:  make(chan error),
	}
	for _, opt := range opts {
		opt(s)
	}
	var err error
	s.sess, err = session.NewSession(&aws.Config{
		Region: aws.String(s.region)},
	)
	if err != nil {
		return nil, errors.Wrap(err, "getting new source")
	}
	s.s3 = s3.New(s.sess)
	resp, err := s.s3.ListObjects(&s3.ListObjectsInput{Bucket: aws.String(s.bucket), Prefix: aws.String(s.prefix)})
	if err != nil {
		return nil, errors.Wrap(err, "listing objects")
	}
	s.objects = resp.Contents

	go s.populateRecords()

	return s, nil
}
461757
func (s *VolumeService) ResizeVolume(p *ResizeVolumeParams) (*ResizeVolumeResponse, error) {
	resp, err := s.cs.newRequest("resizeVolume", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ResizeVolumeResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
954987
func (p *rootfsProvider) VolumeSource(providerConfig *storage.Config) (storage.VolumeSource, error) {
	return nil, errors.NotSupportedf("volumes")
}
646382
func (s *Service) CreateSource(ctx context.Context, src *platform.Source) error {
	src.ID = s.IDGenerator.ID()
	if err := s.PutSource(ctx, src); err != nil {
		return &platform.Error{
			Err: err,
		}
	}
	return nil
}
878346
func (e *azureStorageProvider) VolumeSource(cfg *storage.Config) (storage.VolumeSource, error) {
	// Check to see if the environment has a storage account,
	// which means it uses unmanaged disks. All models created
	// before Juju 2.3 will have a storage account already, so
	// it's safe to do the check up front.
	maybeStorageClient, maybeStorageAccount, err := e.env.maybeGetStorageClient()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &azureVolumeSource{e.env, maybeStorageAccount, maybeStorageClient}, nil
}
771605
func (s *cinderVolumeSource) ListVolumes(ctx context.ProviderCallContext) ([]string, error) {
	cinderVolumes, err := modelCinderVolumes(s.storageAdapter, s.modelUUID)
	if err != nil {
		common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
		return nil, errors.Trace(err)
	}
	return volumeInfoToVolumeIds(cinderToJujuVolumeInfos(cinderVolumes)), nil
}
265234
func (p *tmpfsProvider) FilesystemSource(sourceConfig *storage.Config) (storage.FilesystemSource, error) {
	if err := p.validateFullConfig(sourceConfig); err != nil {
		return nil, err
	}
	// storageDir is validated by validateFullConfig.
	storageDir, _ := sourceConfig.ValueString(storage.ConfigStorageDir)
	return &tmpfsFilesystemSource{
		&osDirFuncs{p.run},
		p.run,
		storageDir,
	}, nil
}
141534
func (h *Client) CampaignSource(campaignSource string) *Client {
	h.campaignSource = campaignSource
	h.campaignSourceSet = true
	return h
}
982510
func (acc *Accumulator) allocateSource() uint8 {
	acc.sourceMutex.Lock()
	defer acc.sourceMutex.Unlock()
	source := acc.nextSource
	acc.nextSource++
	return source
}
825531
func Convert_v1_StorageOSVolumeSource_To_core_StorageOSVolumeSource(in *v1.StorageOSVolumeSource, out *core.StorageOSVolumeSource, s conversion.Scope) error {
	return autoConvert_v1_StorageOSVolumeSource_To_core_StorageOSVolumeSource(in, out, s)
}
850380
func Convert_core_ProjectedVolumeSource_To_v1_ProjectedVolumeSource(in *core.ProjectedVolumeSource, out *v1.ProjectedVolumeSource, s conversion.Scope) error {
	return autoConvert_core_ProjectedVolumeSource_To_v1_ProjectedVolumeSource(in, out, s)
}
796459
func (o *Disk) SetSource(v *string) *Disk {
	if o.Source = v; o.Source == nil {
		o.nullFields = append(o.nullFields, "Source")
	}
	return o
}
95710
func (s *SourceService) CreateSource(ctx context.Context, source *platform.Source) error {
	return s.CreateSourceFn(ctx, source)
}
968874
func volumeAttachmentParamsBySource(
	baseStorageDir string,
	params []storage.VolumeAttachmentParams,
	registry storage.ProviderRegistry,
) (map[string][]storage.VolumeAttachmentParams, map[string]storage.VolumeSource, error) {
	// TODO(axw) later we may have multiple instantiations (sources)
	// for a storage provider, e.g. multiple Ceph installations. For
	// now we assume a single source for each provider type, with no
	// configuration.
	volumeSources := make(map[string]storage.VolumeSource)
	paramsBySource := make(map[string][]storage.VolumeAttachmentParams)
	for _, params := range params {
		sourceName := string(params.Provider)
		paramsBySource[sourceName] = append(paramsBySource[sourceName], params)
		if _, ok := volumeSources[sourceName]; ok {
			continue
		}
		volumeSource, err := volumeSource(
			baseStorageDir, sourceName, params.Provider, registry,
		)
		if errors.Cause(err) == errNonDynamic {
			volumeSource = nil
		} else if err != nil {
			return nil, nil, errors.Annotate(err, "getting volume source")
		}
		volumeSources[sourceName] = volumeSource
	}
	return paramsBySource, volumeSources, nil
}
847968
func (in *VolumeSource) DeepCopy() *VolumeSource {
	if in == nil {
		return nil
	}
	out := new(VolumeSource)
	in.DeepCopyInto(out)
	return out
}