// StorageProviderTypes implements storage.ProviderRegistry.
181217
func (env *Environ) StorageProviderTypes() ([]storage.ProviderType, error) {
	var types []storage.ProviderType
	if _, err := env.cinderProvider(); err == nil {
		types = append(types, CinderProviderType)
	} else if !errors.IsNotSupported(err) {
		return nil, errors.Trace(err)
	}
	return types, nil
}
744391
func (m *MockZonedEnviron) StorageProviderTypes() ([]storage.ProviderType, error) {
	ret := m.ctrl.Call(m, "StorageProviderTypes")
	ret0, _ := ret[0].([]storage.ProviderType)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
353350
func (p environStatePolicy) StorageProviderRegistry() (storage.ProviderRegistry, error) {
	model, err := p.st.Model()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return NewStorageProviderRegistryForModel(model, p.getEnviron, p.getBroker)
}
1130832
func IdentityFilterByProviderType(providerType string) func(db *gorm.DB) *gorm.DB {
	return func(db *gorm.DB) *gorm.DB {
		return db.Where("provider_type = ?", providerType)
	}
}
1325278
func (m *MockStorageV1Interface) StorageClasses() v11.StorageClassInterface {
	ret := m.ctrl.Call(m, "StorageClasses")
	ret0, _ := ret[0].(v11.StorageClassInterface)
	return ret0
}
405094
func (env *environ) StorageProviderTypes() ([]storage.ProviderType, error) {
	var types []storage.ProviderType
	if env.storageSupported() {
		types = append(types, lxdStorageProviderType)
	}
	return types, nil
}
557035
func (env *environ) StorageProviderTypes() ([]storage.ProviderType, error) {
	return []storage.ProviderType{EBS_ProviderType}, nil
}
285291
func (a *InstancePollerAPI) ProviderAddresses(args params.Entities) (params.MachineAddressesResults, error) {
	result := params.MachineAddressesResults{
		Results: make([]params.MachineAddressesResult, len(args.Entities)),
	}
	canAccess, err := a.accessMachine()
	if err != nil {
		return result, err
	}
	for i, arg := range args.Entities {
		machine, err := a.getOneMachine(arg.Tag, canAccess)
		if err == nil {
			addrs := machine.ProviderAddresses()
			result.Results[i].Addresses = params.FromNetworkAddresses(addrs...)
		}
		result.Results[i].Error = common.ServerError(err)
	}
	return result, nil
}
988211
func (env *azureEnviron) StorageProvider(t storage.ProviderType) (storage.Provider, error) {
	if t == azureStorageProviderType {
		return &azureStorageProvider{env}, nil
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
170384
func (sd *StorageGroupDefinition) IterateStores(it StoreIterator) error {
	if sd == nil {
		return nil
	}
	if sd.RelationalStores != nil {
		names := make([]string, len(sd.RelationalStores))
		i := 0
		for n := range sd.RelationalStores {
			names[i] = n
			i++
		}
		sort.Strings(names)
		for _, n := range names {
			if err := it(sd.RelationalStores[n]); err != nil {
				return err
			}
		}
	}
	return nil
}
232079
func (o *OracleEnviron) StorageProvider(t storage.ProviderType) (storage.Provider, error) {
	access, err := o.canAccessStorageAPI()
	if err != nil {
		return nil, errors.Trace(err)
	}
	if access && t == oracleStorageProviderType {
		return &storageProvider{
			env: o,
			api: o.client,
		}, nil
	}

	return nil, errors.NotFoundf("storage provider %q", t)
}
716798
func (*maasEnviron) StorageProvider(t storage.ProviderType) (storage.Provider, error) {
	if t == maasStorageProviderType {
		return maasStorageProvider{}, nil
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
934171
func (env *environ) StorageProvider(t storage.ProviderType) (storage.Provider, error) {
	if env.storageSupported() && t == lxdStorageProviderType {
		return &lxdStorageProvider{env}, nil
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
1095561
func (s *CreateIdentityProviderInput) SetProviderType(v string) *CreateIdentityProviderInput {
	s.ProviderType = &v
	return s
}
1066875
func NewEncryptedStorageProvider(storageProvider StorageProvider, encryptionKey string) (encryptedStorageProvider *EncryptedStorageProvider, err error) {
	if encryptionKey != "" {
		encryptedStorageProvider = &EncryptedStorageProvider{
			EncryptionKey:          encryptionKey,
			wrappedStorageProvider: storageProvider,
		}

	} else {
		errMsg := "no encryption key provided"
		lo.G.Error(errMsg)
		err = errors.New(errMsg)
	}
	return
}
521358
func (s storageProvider) DefaultPools() []*storage.Config {
	latencyPool, _ := storage.NewConfig("oracle-latency", oracleStorageProviderType, map[string]interface{}{
		oracleVolumeType: latencyPool,
	})
	return []*storage.Config{latencyPool}
}
700900
func WithStorageService(
	parent context.Context, service types.StorageService) types.Context {

	var (
		serviceName = strings.ToLower(service.Name())
		driver      = service.Driver()
		driverName  = strings.ToLower(driver.Name())
	)

	parent = newContext(parent, DriverKey, driver, nil, nil)

	// set the service's InstanceID if present
	if iidm, ok := parent.Value(AllInstanceIDsKey).(types.InstanceIDMap); ok {
		if iid, ok := iidm[serviceName]; ok {
			parent = newContext(parent, InstanceIDKey, iid, nil, nil)
		}
	}

	// set the service's LocalDevices if present
	if ldm, ok := parent.Value(AllLocalDevicesKey).(types.LocalDevicesMap); ok {
		if ld, ok := ldm[driverName]; ok {
			parent = newContext(parent, LocalDevicesKey, ld, nil, nil)
		}
	}

	return newContext(parent, ServiceKey, service, nil, nil)
}