// NewSystemsInfo creates a map of SystemDumps that are configured
// based on the installation settings fetched from ops manager
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,
	}
}
1122346
func (api *SystemAPI) GetSystemInfo() (systemInfo *SystemInfo, err error) {
	res, err := api.client.restClient.Get(api.getEndpointUrl("info"), api.client.options.TokenOptions)
	if err != nil {
		return
	}
	defer res.Body.Close()
	res, err = getError(res)
	if err != nil {
		return
	}
	var result SystemInfo
	err = json.NewDecoder(res.Body).Decode(&result)
	return &result, err
}
184826
func (c *NodeupModelContext) EnsureSystemdSuffix(name string) string {
	if !systemd.UnitFileExtensionValid(name) {
		name += ".service"
	}

	return name
}
659326
func (s SystemsInfo) PersistentSystems() []SystemDump {
	ps := []string{ERCc, ERUaa, ERConsole, ERNfs, ERMySQL}
	jobs := []SystemDump{}

	for _, info := range ps {
		if _, ok := s.SystemDumps[info]; ok {
			jobs = append(jobs, s.SystemDumps[info])
		}
	}
	return jobs
}
14021
func NewServiceManager(
	isRunning func() bool,
	newService func(string, common.Conf) (Service, error),
) SystemdServiceManager {
	return &systemdServiceManager{
		isRunning:  isRunning,
		newService: newService,
	}
}
74687
func NewSandboxedFilesystemLoader(baseDir string) (*SandboxedFilesystemLoader, error) {
	fs, err := NewLocalFileSystemLoader(baseDir)
	if err != nil {
		return nil, err
	}
	return &SandboxedFilesystemLoader{
		LocalFilesystemLoader: fs,
	}, nil
}
748847
func (s *InternalLBService) NewStartInternalLoadBalancerVMParams(id string) *StartInternalLoadBalancerVMParams {
	p := &StartInternalLoadBalancerVMParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}
638277
func (c *SystemInfo) GetProcessInfo() ([]*SystemInfoProcessInfo, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "SystemInfo.getProcessInfo"})
	if err != nil {
		return nil, err
	}

	var chromeData struct {
		Result struct {
			ProcessInfo []*SystemInfoProcessInfo
		}
	}

	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}

	// test if error first
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}

	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}

	return chromeData.Result.ProcessInfo, nil
}
354261
func (daemon *Daemon) SystemInfo() (*types.Info, error) {
	sysInfo := sysinfo.New(true)
	cRunning, cPaused, cStopped := stateCtr.get()

	v := &types.Info{
		ID:                 daemon.ID,
		Containers:         cRunning + cPaused + cStopped,
		ContainersRunning:  cRunning,
		ContainersPaused:   cPaused,
		ContainersStopped:  cStopped,
		Images:             daemon.imageService.CountImages(),
		IPv4Forwarding:     !sysInfo.IPv4ForwardingDisabled,
		BridgeNfIptables:   !sysInfo.BridgeNFCallIPTablesDisabled,
		BridgeNfIP6tables:  !sysInfo.BridgeNFCallIP6TablesDisabled,
		Debug:              debug.IsEnabled(),
		Name:               hostName(),
		NFd:                fileutils.GetTotalUsedFds(),
		NGoroutines:        runtime.NumGoroutine(),
		SystemTime:         time.Now().Format(time.RFC3339Nano),
		LoggingDriver:      daemon.defaultLogConfig.Type,
		CgroupDriver:       daemon.getCgroupDriver(),
		NEventsListener:    daemon.EventsService.SubscribersCount(),
		KernelVersion:      kernelVersion(),
		OperatingSystem:    operatingSystem(),
		IndexServerAddress: registry.IndexServer,
		OSType:             platform.OSType,
		Architecture:       platform.Architecture,
		RegistryConfig:     daemon.RegistryService.ServiceConfig(),
		NCPU:               sysinfo.NumCPU(),
		MemTotal:           memInfo().MemTotal,
		GenericResources:   daemon.genericResources,
		DockerRootDir:      daemon.configStore.Root,
		Labels:             daemon.configStore.Labels,
		ExperimentalBuild:  daemon.configStore.Experimental,
		ServerVersion:      dockerversion.Version,
		ClusterStore:       daemon.configStore.ClusterStore,
		ClusterAdvertise:   daemon.configStore.ClusterAdvertise,
		HTTPProxy:          maskCredentials(sockets.GetProxyEnv("http_proxy")),
		HTTPSProxy:         maskCredentials(sockets.GetProxyEnv("https_proxy")),
		NoProxy:            sockets.GetProxyEnv("no_proxy"),
		LiveRestoreEnabled: daemon.configStore.LiveRestoreEnabled,
		Isolation:          daemon.defaultIsolation,
	}

	daemon.fillAPIInfo(v)
	// Retrieve platform specific info
	daemon.fillPlatformInfo(v, sysInfo)
	daemon.fillDriverInfo(v)
	daemon.fillPluginsInfo(v)
	daemon.fillSecurityOptions(v, sysInfo)
	daemon.fillLicense(v)

	return v, nil
}
941757
func (is *InfoSyncer) newSessionAndStoreServerInfo(ctx context.Context, retryCnt int) error {
	if is.etcdCli == nil {
		return nil
	}
	logPrefix := fmt.Sprintf("[Info-syncer] %s", is.serverInfoPath)
	session, err := owner.NewSession(ctx, logPrefix, is.etcdCli, retryCnt, InfoSessionTTL)
	if err != nil {
		return err
	}
	is.session = session

	err = is.storeServerInfo(ctx)
	return err
}
1178766
func NewSystemConfig() *SystemConfig {

	return &SystemConfig{
		AARFlowStatsInterval:            30,
		AARProbeStatsInterval:           30,
		ACLAllowOrigin:                  "*",
		ECMPCount:                       1,
		LDAPSyncInterval:                600,
		LDAPTrustStoreCertifcate:        "/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts",
		LDAPTrustStorePassword:          "changeit",
		ADGatewayPurgeTime:              7200,
		RDLowerLimit:                    0,
		RDPublicNetworkLowerLimit:       0,
		RDPublicNetworkUpperLimit:       65535,
		RDUpperLimit:                    65535,
		ZFBRequestRetryTimer:            30,
		ZFBSchedulerStaleRequestTimeout: 1440,
		PGIDLowerLimit:                  65536,
		PGIDUpperLimit:                  2147483647,
		DHCPOptionSize:                  16,
		VLANIDLowerLimit:                0,
		VLANIDUpperLimit:                0,
		VMCacheSize:                     5000,
		VMPurgeTime:                     60,
		VMResyncDeletionWaitTime:        2,
		VMResyncOutstandingInterval:     1000,
		VMUnreachableCleanupTime:        7200,
		VMUnreachableTime:               3600,
		VNFTaskTimeout:                  3600,
		VNIDLowerLimit:                  1,
		VNIDPublicNetworkLowerLimit:     1,
		VNIDPublicNetworkUpperLimit:     16777215,
		VNIDUpperLimit:                  1048575,
		APIKeyRenewalInterval:           300,
		APIKeyValidity:                  86400,
		VPortInitStatefulTimer:          300,
		LRUCacheSizePerSubnet:           32,
		VSDReadOnlyMode:                 false,
		NSGUplinkHoldDownTimer:          5,
		ASNumber:                        65534,
		VSSStatsInterval:                30,
		RTLowerLimit:                    0,
		RTPublicNetworkLowerLimit:       0,
		RTPublicNetworkUpperLimit:       65535,
		RTUpperLimit:                    65535,
		EVPNBGPCommunityTagASNumber:     65534,
		EVPNBGPCommunityTagLowerLimit:   0,
		EVPNBGPCommunityTagUpperLimit:   65535,
		PageMaxSize:                     500,
		PageSize:                        50,
		GatewayProbeInterval:            5,
		GatewayProbeWindow:              120,
		GatewayRebalancingInterval:      600,
		MaxResponse:                     500,
		AccumulateLicensesEnabled:       false,
		PerDomainVlanIdEnabled:          false,
		ServiceIDUpperLimit:             2147483648,
		OffsetCustomerID:                10000,
		OffsetServiceID:                 20001,
		VirtualFirewallRulesEnabled:     false,
		EjbcaNSGCertificateProfile:      "VSPClient",
		EjbcaNSGEndEntityProfile:        "NSG",
		EjbcaOCSPResponderCN:            "ocspsigner",
		EjbcaOCSPResponderURI:           "http://localhost:7080/ejbca/publicweb/status/ocsp",
		EjbcaVspRootCa:                  "VSPCA",
		AlarmsMaxPerObject:              10,
		ElasticClusterName:              "nuage_elasticsearch",
		AllowEnterpriseAvatarOnNSG:      true,
		ImportedSaaSApplicationsVersion: "1.0",
		InactiveTimeout:                 600000,
		InfrastructureBGPASNumber:       65500,
		PostProcessorThreadsCount:       20,
		NsgBootstrapEndpoint:            "https://proxy-bootstrap:12443/nuage/api",
		NsgConfigEndpoint:               "https://{proxyDNSName}:11443/nuage/api",
		NsgLocalUiUrl:                   "http://registration.nsg",
		EsiID:                           10000,
		CsprootAuthenticationMethod:     "LOCAL",
		StackTraceEnabled:               false,
		StatefulACLNonTCPTimeout:        180,
		StatefulACLTCPTimeout:           3600,
		StaticWANServicePurgeTime:       3600,
		StatsCollectorAddress:           "localhost",
		StatsCollectorPort:              "29090",
		StatsCollectorProtoBufPort:      "39090",
		StatsMaxDataPoints:              10000,
		StatsMinDuration:                2592000,
		StatsNumberOfDataPoints:         30,
		StatsTSDBServerAddress:          "localhost:9300",
		StickyECMPIdleTimeout:           0,
		AttachProbeToIPsecNPM:           true,
		AttachProbeToVXLANNPM:           true,
		SubnetResyncInterval:            10,
		SubnetResyncOutstandingInterval: 20,
		CustomerIDUpperLimit:            2147483647,
		AvatarBasePath:                  "/opt/vsd/jboss/standalone/deployments/CloudMgmt-web.war",
		AvatarBaseURL:                   "https://localhost:8443",
		EventLogCleanupInterval:         3600,
		EventLogEntryMaxAge:             7,
		EventProcessorInterval:          250,
		EventProcessorMaxEventsCount:    100,
		EventProcessorTimeout:           25000,
		TwoFactorCodeExpiry:             300,
		TwoFactorCodeLength:             6,
		TwoFactorCodeSeedLength:         96,
		DynamicWANServiceDiffTime:       1,
		SyslogDestinationHost:           "http://localhost",
		SysmonCleanupTaskInterval:       20,
		SysmonNodePresenceTimeout:       3600,
		SysmonProbeResponseTimeout:      30,
	}
}
156342
func (st *State) SetFilesystemAttachmentInfo(filesystemAttachments []params.FilesystemAttachment) ([]params.ErrorResult, error) {
	args := params.FilesystemAttachments{FilesystemAttachments: filesystemAttachments}
	var results params.ErrorResults
	err := st.facade.FacadeCall("SetFilesystemAttachmentInfo", args, &results)
	if err != nil {
		return nil, err
	}
	if len(results.Results) != len(filesystemAttachments) {
		return nil, errors.Errorf("expected %d result(s), got %d", len(filesystemAttachments), len(results.Results))
	}
	return results.Results, nil
}
508522
func FsInfo(path string) (int64, int64, int64, int64, int64, int64, error) {
	return 0, 0, 0, 0, 0, 0, fmt.Errorf("FsInfo not supported for this build.")
}
1340090
func NewNotificationSys(config *serverConfig, endpoints EndpointList) *NotificationSys {
	targetList := getNotificationTargets(config)
	remoteHosts := getRemoteHosts(endpoints)
	remoteClients, err := getRestClients(remoteHosts)
	if err != nil {
		logger.FatalIf(err, "Unable to start notification sub system")
	}

	// bucketRulesMap/bucketRemoteTargetRulesMap are initialized by NotificationSys.Init()
	return &NotificationSys{
		targetList:                 targetList,
		bucketRulesMap:             make(map[string]event.RulesMap),
		bucketRemoteTargetRulesMap: make(map[string]map[event.TargetID]event.RulesMap),
		peerClients:                remoteClients,
	}
}
354054
func (s *SystemVMService) NewStopSystemVmParams(id string) *StopSystemVmParams {
	p := &StopSystemVmParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}
490057
func NewServer(name string, s func(...server.Option) server.Server) Option {
	return func(o *Options) {
		o.Servers[name] = s
	}
}
1306899
func NewSSEKMS(keyID string, context interface{}) (ServerSide, error) {
	if context == nil {
		return kms{key: keyID, hasContext: false}, nil
	}
	serializedContext, err := json.Marshal(context)
	if err != nil {
		return nil, err
	}
	return kms{key: keyID, context: serializedContext, hasContext: true}, nil
}