// SetFilesystemInfo sets the FilesystemInfo for the specified filesystem.
760307
func (sb *storageBackend) SetFilesystemInfo(tag names.FilesystemTag, info FilesystemInfo) (err error) {
	defer errors.DeferredAnnotatef(&err, "cannot set info for filesystem %q", tag.Id())

	if info.FilesystemId == "" {
		return errors.New("filesystem ID not set")
	}
	fs, err := sb.Filesystem(tag)
	if err != nil {
		return errors.Trace(err)
	}
	// If the filesystem is volume-backed, the volume must be provisioned
	// and attached first.
	if volumeTag, err := fs.Volume(); err == nil {
		volumeAttachments, err := sb.VolumeAttachments(volumeTag)
		if err != nil {
			return errors.Trace(err)
		}
		var anyAttached bool
		for _, a := range volumeAttachments {
			if _, err := a.Info(); err == nil {
				anyAttached = true
			} else if !errors.IsNotProvisioned(err) {
				return err
			}
		}
		if !anyAttached {
			return errors.Errorf(
				"backing volume %q is not attached",
				volumeTag.Id(),
			)
		}
	} else if errors.Cause(err) != ErrNoBackingVolume {
		return errors.Trace(err)
	}
	buildTxn := func(attempt int) ([]txn.Op, error) {
		if attempt > 0 {
			fs, err = sb.Filesystem(tag)
			if err != nil {
				return nil, errors.Trace(err)
			}
		}
		// If the filesystem has parameters, unset them
		// when we set info for the first time, ensuring
		// that params and info are mutually exclusive.
		var unsetParams bool
		if params, ok := fs.Params(); ok {
			info.Pool = params.Pool
			unsetParams = true
		} else {
			// Ensure immutable properties do not change.
			oldInfo, err := fs.Info()
			if err != nil {
				return nil, err
			}
			if err := validateFilesystemInfoChange(info, oldInfo); err != nil {
				return nil, err
			}
		}
		ops := setFilesystemInfoOps(tag, info, unsetParams)
		return ops, nil
	}
	return sb.mb.db().Run(buildTxn)
}
531867
func (s *DescribeDBLogFilesInput) SetFilenameContains(v string) *DescribeDBLogFilesInput {
	s.FilenameContains = &v
	return s
}
1341751
func (s *GetFolderOutput) SetFiles(v []*File) *GetFolderOutput {
	s.Files = v
	return s
}
541874
func (s *StorageProvisionerAPIv3) SetVolumeInfo(args params.Volumes) (params.ErrorResults, error) {
	canAccessVolume, err := s.getStorageEntityAuthFunc()
	if err != nil {
		return params.ErrorResults{}, err
	}
	results := params.ErrorResults{
		Results: make([]params.ErrorResult, len(args.Volumes)),
	}
	one := func(arg params.Volume) error {
		volumeTag, volumeInfo, err := storagecommon.VolumeToState(arg)
		if err != nil {
			return errors.Trace(err)
		} else if !canAccessVolume(volumeTag) {
			return common.ErrPerm
		}
		err = s.sb.SetVolumeInfo(volumeTag, volumeInfo)
		if errors.IsNotFound(err) {
			return common.ErrPerm
		}
		return errors.Trace(err)
	}
	for i, arg := range args.Volumes {
		err := one(arg)
		results.Results[i].Error = common.ServerError(err)
	}
	return results, nil
}
1360774
func (s *InstanceHealthSummary) SetInfo(v int64) *InstanceHealthSummary {
	s.Info = &v
	return s
}
1327470
func (s *GetDeploymentOutput) SetDeploymentInfo(v *DeploymentInfo) *GetDeploymentOutput {
	s.DeploymentInfo = v
	return s
}
269330
func (s *lxdFilesystemSource) ReleaseFilesystems(ctx context.ProviderCallContext, filesystemIds []string) ([]error, error) {
	results := make([]error, len(filesystemIds))
	for i, filesystemId := range filesystemIds {
		results[i] = s.releaseFilesystem(filesystemId)
		common.HandleCredentialError(IsAuthorisationFailure, results[i], ctx)
	}
	return results, nil
}
934537
func (s *ContainerInstance) SetVersionInfo(v *VersionInfo) *ContainerInstance {
	s.VersionInfo = v
	return s
}
1054748
func (s *Disk) SetIsSystemDisk(v bool) *Disk {
	s.IsSystemDisk = &v
	return s
}
1101428
func (s *Location) SetFilePath(v string) *Location {
	s.FilePath = &v
	return s
}
507043
func (s *CreateFileSystemFromBackupOutput) SetFileSystem(v *FileSystem) *CreateFileSystemFromBackupOutput {
	s.FileSystem = v
	return s
}
541853
func (s *ExportSnapshotRecordSourceInfo) SetDiskSnapshotInfo(v *DiskSnapshotInfo) *ExportSnapshotRecordSourceInfo {
	s.DiskSnapshotInfo = v
	return s
}
1066295
func (s *MountTargetDescription) SetFileSystemId(v string) *MountTargetDescription {
	s.FileSystemId = &v
	return s
}
694105
func (f *filesystem) SetStatus(fsStatus status.StatusInfo) error {
	switch fsStatus.Status {
	case status.Attaching, status.Attached, status.Detaching, status.Detached, status.Destroying:
	case status.Error:
		if fsStatus.Message == "" {
			return errors.Errorf("cannot set status %q without info", fsStatus.Status)
		}
	case status.Pending:
		// If a filesystem is not yet provisioned, we allow its status
		// to be set back to pending (when a retry is to occur).
		// First refresh.
		f, err := getFilesystemByTag(f.mb, f.FilesystemTag())
		if err != nil {
			return errors.Trace(err)
		}
		_, err = f.Info()
		if errors.IsNotProvisioned(err) {
			break
		}
		return errors.Errorf("cannot set status %q", fsStatus.Status)
	default:
		return errors.Errorf("cannot set invalid status %q", fsStatus.Status)
	}
	return setStatus(f.mb.db(), setStatusParams{
		badge:     "filesystem",
		globalKey: filesystemGlobalKey(f.FilesystemTag().Id()),
		status:    fsStatus.Status,
		message:   fsStatus.Message,
		rawData:   fsStatus.Data,
		updated:   timeOrNow(fsStatus.Since, f.mb.clock()),
	})
}
1035036
func (s *CreateProvisioningArtifactOutput) SetInfo(v map[string]*string) *CreateProvisioningArtifactOutput {
	s.Info = v
	return s
}
10431
func NewSystemsInfo(installationSettingsFile string, sshKey string, nfs string) SystemsInfo {

	configParser := NewConfigurationParser(installationSettingsFile)
	installationSettings := configParser.InstallationSettings

	const (
		defaultRemoteArchivePath = "/tmp/archive.backup"
		mysqlRemoteArchivePath   = "/var/vcap/store/mysql/archive.backup"
		nfsRemoteArchivePath     = "/var/vcap/store/shared/archive.backup"
	)

	var systemDumps = make(map[string]SystemDump)

	for _, job := range configParser.FindCFPostgresJobs() {
		switch job.Identifier {
		case "consoledb":
			systemDumps[ERConsole] = &PgInfo{
				SystemInfo: SystemInfo{
					Product:           "cf",
					Component:         "consoledb",
					Identifier:        "credentials",
					SSHPrivateKey:     sshKey,
					RemoteArchivePath: defaultRemoteArchivePath,
				},
				Database: "console",
			}
		case "ccdb":
			systemDumps[ERCc] = &PgInfo{
				SystemInfo: SystemInfo{
					Product:           "cf",
					Component:         "ccdb",
					Identifier:        "credentials",
					SSHPrivateKey:     sshKey,
					RemoteArchivePath: defaultRemoteArchivePath,
				},
				Database: "ccdb",
			}
		case "uaadb":
			systemDumps[ERUaa] = &PgInfo{
				SystemInfo: SystemInfo{
					Product:           "cf",
					Component:         "uaadb",
					Identifier:        "credentials",
					SSHPrivateKey:     sshKey,
					RemoteArchivePath: defaultRemoteArchivePath,
				},
				Database: "uaa",
			}
		}
	}
	if installationSettings.FindJobInstanceCount("cf", "mysql") > 0 {
		systemDumps[ERMySQL] = &MysqlInfo{
			SystemInfo: SystemInfo{
				Product:           "cf",
				Component:         "mysql",
				Identifier:        "mysql_admin_credentials",
				SSHPrivateKey:     sshKey,
				RemoteArchivePath: mysqlRemoteArchivePath,
			},
			Database: "mysql",
		}
	}

	systemDumps[ERDirector] = &SystemInfo{
		Product:           installationSettings.GetBoshName(),
		Component:         "director",
		Identifier:        "director_credentials",
		SSHPrivateKey:     sshKey,
		RemoteArchivePath: defaultRemoteArchivePath,
	}
	if installationSettings.FindJobInstanceCount("cf", "nfs_server") > 0 {
		systemDumps[ERNfs] = &NfsInfo{
			SystemInfo: SystemInfo{
				Product:           "cf",
				Component:         "nfs_server",
				Identifier:        "vm_credentials",
				SSHPrivateKey:     sshKey,
				RemoteArchivePath: nfsRemoteArchivePath,
			},
			BackupType: nfs,
		}
	} else {
		lo.G.Debugf("no nfs will be set: instancecount: %v skipnfs: %v", installationSettings.FindJobInstanceCount("cf", "nfs_server"), nfs)
	}

	return SystemsInfo{
		SystemDumps: systemDumps,
	}
}
1140614
func (s *StorageInfo) SetEbsStorageInfo(v *EBSStorageInfo) *StorageInfo {
	s.EbsStorageInfo = v
	return s
}