// uncomment this to inject a simulator, removed to save 6MB in executable size
uncomment this to inject a simulator, removed to save 6MB in executable size
// uncomment this to inject a simulator removed to save 6MB in executable size
func runSim(ctx context.Context) (c Client, err error) {
	fmt.Println("Running in simulation mode, specify a url if you want this too work for real")
	si := sim{}
	m := &simulator.Model{
		ServiceContent: vpx.ServiceContent,
		RootFolder:     vpx.RootFolder,
		Autostart:      true,
		Datacenter:     1,
		Portgroup:      1,
		Host:           0,
		Cluster:        1,
		ClusterHost:    1,
		Datastore:      2,
		Machine:        2,
		DelayConfig: simulator.DelayConfig{
			Delay:       0,
			DelayJitter: 0,
			MethodDelay: nil,
		},
	}
	si.Model = *m
	defer si.Remove()
	err = si.Create()
	if err != nil {
		return
	}
	s := si.Service.NewServer()
	u := s.URL
	_processOverride(u, "", "")
	soapClient := soap.NewClient(u, true)
	c.c, err = vim25.NewClient(ctx, soapClient)
	if err != nil {
		return c, fmt.Errorf("vim client sim %v", err)
	}
	time.AfterFunc(10*time.Second, s.Close)
	return
}
func runSim ( ctx context . Context ) ( c Client , err error ) { fmt . Println ( " " ) si := sim { } m := & simulator . Model { ServiceContent : vpx . ServiceContent , RootFolder : vpx . RootFolder , Autostart : true , Datacenter : 1 , Portgroup : 1 , Host : 0 , Cluster : 1 , ClusterHost : 1 , Datastore : 2 , Machine : 2 , DelayConfig : simulator . DelayConfig { Delay : 0 , DelayJitter : 0 , MethodDelay : nil , } , } si . Model = * m defer si . Remove ( ) err = si . Create ( ) if err != nil { return } s := si . Service . NewServer ( ) u := s . URL _processOverride ( u , " " , " " ) soapClient := soap . NewClient ( u , true ) c . c , err = vim25 . NewClient ( ctx , soapClient ) if err != nil { return c , fmt . Errorf ( " " , err ) } time . AfterFunc ( 10 * time . Second , s . Close ) return }
uncomment this to inject a simulator, removed to save 6MB in executable size
uncomment this to inject a simulator removed to save 6MB in executable size
//c.r = rest.NewClient(c.c) // run simulator for 10 seconds