當前位置: 首頁>>代碼示例>>Golang>>正文


Golang drivers.DriverOptions類代碼示例

本文整理匯總了Golang中github.com/docker/machine/libmachine/drivers.DriverOptions的典型用法代碼示例。如果您正苦於以下問題:Golang DriverOptions類的具體用法?Golang DriverOptions怎麽用?Golang DriverOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DriverOptions類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.Boot2DockerURL = flags.String("hyperv-boot2docker-url")
	d.VSwitch = flags.String("hyperv-virtual-switch")
	d.DiskSize = flags.Int("hyperv-disk-size")
	d.MemSize = flags.Int("hyperv-memory")
	d.CPU = flags.Int("hyperv-cpu-count")
	d.SSHUser = "docker"
	d.SetSwarmConfigFromFlags(flags)

	return nil
}
開發者ID:MerlinDMC,項目名稱:machine,代碼行數:11,代碼來源:hyperv.go

示例2: SetConfigFromFlags

// SetConfigFromFlags configures the driver with the object that was returned
// by RegisterCreateFlags
func (d *Driver) SetConfigFromFlags(opts drivers.DriverOptions) error {
	d.CPU = opts.Int("parallels-cpu-count")
	d.Memory = opts.Int("parallels-memory")
	d.DiskSize = opts.Int("parallels-disk-size")
	d.Boot2DockerURL = opts.String("parallels-boot2docker-url")
	d.SetSwarmConfigFromFlags(opts)
	d.SSHUser = defaultSSHUser
	d.SSHPort = defaultSSHPort
	d.NoShare = opts.Bool("parallels-no-share")

	return nil
}
開發者ID:Parallels,項目名稱:docker-machine-parallels,代碼行數:14,代碼來源:parallels_darwin.go

示例3: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.EnginePort = flags.Int("generic-engine-port")
	d.IPAddress = flags.String("generic-ip-address")
	d.SSHUser = flags.String("generic-ssh-user")
	d.SSHKey = flags.String("generic-ssh-key")
	d.SSHPort = flags.Int("generic-ssh-port")

	if d.IPAddress == "" {
		return errors.New("generic driver requires the --generic-ip-address option")
	}

	return nil
}
開發者ID:kunalkushwaha,項目名稱:machine,代碼行數:13,代碼來源:generic.go

示例4: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	if drivers.EngineInstallURLFlagSet(flags) {
		return errors.New("--engine-install-url cannot be used with the hyperv driver, use --hyperv-boot2docker-url instead")
	}
	d.Boot2DockerURL = flags.String("hyperv-boot2docker-url")
	d.VSwitch = flags.String("hyperv-virtual-switch")
	d.DiskSize = flags.Int("hyperv-disk-size")
	d.MemSize = flags.Int("hyperv-memory")
	d.CPU = flags.Int("hyperv-cpu-count")
	d.SSHUser = "docker"
	d.SetSwarmConfigFromFlags(flags)

	return nil
}
開發者ID:containerx,項目名稱:machine,代碼行數:14,代碼來源:hyperv.go

示例5: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	url := flags.String("url")
	if url == "" {
		return fmt.Errorf("--url option is required")
	}

	d.URL = url
	u, err := neturl.Parse(url)
	if err != nil {
		return err
	}

	d.IPAddress = u.Host
	return nil
}
開發者ID:docker,項目名稱:docker-machine-driver-ci-test,代碼行數:15,代碼來源:driver.go

示例6: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(opts drivers.DriverOptions) error {
	spew.Dump(opts)
	d.DindImage = opts.String("dind-image")
	d.DockerHost = opts.String("dind-host")
	d.CertPath = opts.String("dind-cert-path")
	return nil
}
開發者ID:xinbaojian,項目名稱:docker-machine-driver-dind,代碼行數:7,代碼來源:driver.go

示例7: SetConfigFromFlags

// SetConfigFromFlags configures the driver with the object that was returned
// by RegisterCreateFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.CloudApiURL = flags.String("triton-url")
	d.Account = flags.String("triton-account")
	d.DataCenter = flags.String("triton-datacenter")
	d.PrivateKey = flags.String("triton-key")
	d.SkipTlsVerify = flags.Bool("triton-skip-tls-verify")

	if d.CloudApiURL == "" {
		if d.DataCenter == "" {
			return fmt.Errorf("You must specify a cloudapi url or datacenter name")
		}
		// Shortend format for the cloudapi name, e.g. "us-east-1"
		d.CloudApiURL = fmt.Sprintf("https://%s.%s", d.DataCenter, TritonDefaultCloudapiDomain)
	}

	if d.Account == "" {
		return fmt.Errorf("You must specify the account name using --triton-account")
	}

	if d.PrivateKey == "" {
		homedir := mcnutils.GetHomeDir()
		if homedir == "" {
			return fmt.Errorf("You must specify the SSH key using --triton-key")
		}
		d.PrivateKey = path.Join(homedir, ".ssh", "id_rsa")
	}

	_, err := os.Stat(d.PrivateKey)
	if err != nil {
		return fmt.Errorf("Unable to access SSH key file %s", d.PrivateKey)
	}

	log.Debugf("CloudApiURL: %s", d.CloudApiURL)
	log.Debugf("Account: %s", d.Account)
	log.Debugf("DataCenter: %s", d.DataCenter)
	log.Debugf("PrivateKey: %s", d.PrivateKey)
	log.Debugf("SkipTlsVerify: %d", d.SkipTlsVerify)

	return nil
}
開發者ID:namtzigla,項目名稱:docker-machine-driver-triton,代碼行數:42,代碼來源:driver.go

示例8: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.UserID = flags.String("scaleway-user-id")
	d.Token = flags.String("scaleway-token")
	d.Organization = flags.String("scaleway-organization")
	d.Image = flags.String("scaleway-image")
	d.Volumes = flags.String("scaleway-volumes")
	d.SSHUser = "docker"
	d.SSHPort = 22
	if d.UserID == "" {
		return fmt.Errorf("scaleway driver requires the --scaleway-userid option")
	}
	if d.Token == "" {
		return fmt.Errorf("scaleway driver requires the --scaleway-token option")
	}
	if d.Organization == "" {
		return fmt.Errorf("scaleway driver requires the --scaleway-organization option")
	}
	if d.Image == "" {
		return fmt.Errorf("scaleway driver requires the --scaleway-image option")
	}
	return nil
}
開發者ID:nlamirault,項目名稱:docker-machine-scaleway,代碼行數:22,代碼來源:scaleway.go

示例9: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.IPAddress = flags.String("hypriot-ip-address")
	d.SSHUser = flags.String("hypriot-ssh-user")
	d.SSHKey = flags.String("hypriot-ssh-key")
	d.SSHPort = flags.Int("hypriot-ssh-port")

	if d.IPAddress == "" {
		return fmt.Errorf("hypriot driver requires the --hypriot-ip-address option")
	}

	if d.SSHKey == "" {
		return fmt.Errorf("hypriot driver requires the --hypriot-ssh-key option")
	}

	return nil
}
開發者ID:hypriot,項目名稱:docker-machine-hypriot,代碼行數:16,代碼來源:hypriot.go

示例10: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.Memory = flags.Int("vmwarefusion-memory-size")
	d.CPU = flags.Int("vmwarefusion-cpu-count")
	d.DiskSize = flags.Int("vmwarefusion-disk-size")
	d.Boot2DockerURL = flags.String("vmwarefusion-boot2docker-url")
	d.ConfigDriveURL = flags.String("vmwarefusion-configdrive-url")
	d.ISO = d.ResolveStorePath(isoFilename)
	d.SwarmMaster = flags.Bool("swarm-master")
	d.SwarmHost = flags.String("swarm-host")
	d.SwarmDiscovery = flags.String("swarm-discovery")
	d.SSHUser = flags.String("vmwarefusion-ssh-user")
	d.SSHPassword = flags.String("vmwarefusion-ssh-password")
	d.SSHPort = 22

	// We support a maximum of 16 cpu to be consistent with Virtual Hardware 10
	// specs.
	if d.CPU < 1 {
		d.CPU = int(runtime.NumCPU())
	}
	if d.CPU > 16 {
		d.CPU = 16
	}

	return nil
}
開發者ID:rominirani,項目名稱:machine,代碼行數:25,代碼來源:fusion.go

示例11: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.CPU = flags.Int("virtualbox-cpu-count")
	d.Memory = flags.Int("virtualbox-memory")
	d.DiskSize = flags.Int("virtualbox-disk-size")
	d.Boot2DockerURL = flags.String("virtualbox-boot2docker-url")
	d.SetSwarmConfigFromFlags(flags)
	d.SSHUser = "docker"
	d.Boot2DockerImportVM = flags.String("virtualbox-import-boot2docker-vm")
	d.HostDNSResolver = flags.Bool("virtualbox-host-dns-resolver")
	d.HostOnlyCIDR = flags.String("virtualbox-hostonly-cidr")
	d.HostOnlyNicType = flags.String("virtualbox-hostonly-nictype")
	d.HostOnlyPromiscMode = flags.String("virtualbox-hostonly-nicpromisc")
	d.NoShare = flags.Bool("virtualbox-no-share")
	d.DNSProxy = flags.Bool("virtualbox-dns-proxy")
	d.NoVTXCheck = flags.Bool("virtualbox-no-vtx-check")

	return nil
}
開發者ID:austinhyde,項目名稱:machine,代碼行數:18,代碼來源:virtualbox.go

示例12: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.Memory = flags.Int("vmwareappcatalyst-memory-size")
	d.CPU = flags.Int("vmwareappcatalyst-cpu-count")
	d.SwarmMaster = flags.Bool("swarm-master")
	d.SwarmHost = flags.String("swarm-host")
	d.SwarmDiscovery = flags.String("swarm-discovery")
	d.SSHUser = flags.String("vmwareappcatalyst-ssh-user")
	d.SSHPort = 22
	d.VMLocation = flags.String("vmwareappcatalyst-vm-location")
	d.APIPort = flags.Int("vmwareappcatalyst-api-port")

	// We support a maximum of 16 cpu.
	if d.CPU < 1 {
		d.CPU = int(runtime.NumCPU())
	}
	if d.CPU > 16 {
		d.CPU = 16
	}

	return nil
}
開發者ID:vmware,項目名稱:docker-machine-driver-vmwareappcatalyst,代碼行數:21,代碼來源:appcatalyst.go

示例13: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	if drivers.EngineInstallURLFlagSet(flags) {
		return errors.New("--engine-install-url cannot be used with the vmwarevsphere driver, use --vmwarevsphere-boot2docker-url instead")
	}
	d.SSHUser = "docker"
	d.SSHPort = 22
	d.CPU = flags.Int("vmwarevsphere-cpu-count")
	d.Memory = flags.Int("vmwarevsphere-memory-size")
	d.DiskSize = flags.Int("vmwarevsphere-disk-size")
	d.Boot2DockerURL = flags.String("vmwarevsphere-boot2docker-url")
	d.IP = flags.String("vmwarevsphere-vcenter")
	d.Port = flags.Int("vmwarevsphere-vcenter-port")
	d.Username = flags.String("vmwarevsphere-username")
	d.Password = flags.String("vmwarevsphere-password")
	d.Network = flags.String("vmwarevsphere-network")
	d.Datastore = flags.String("vmwarevsphere-datastore")
	d.Datacenter = flags.String("vmwarevsphere-datacenter")
	d.Pool = flags.String("vmwarevsphere-pool")
	d.HostSystem = flags.String("vmwarevsphere-hostsystem")
	d.SetSwarmConfigFromFlags(flags)

	d.ISO = d.ResolveStorePath(isoFilename)

	return nil
}
開發者ID:HewlettPackard,項目名稱:oneview-golang,代碼行數:25,代碼來源:vsphere.go

示例14: SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.Boot2DockerURL = flags.String("hyperv-boot2docker-url")
	d.VSwitch = flags.String("hyperv-virtual-switch")
	d.DiskSize = flags.Int("hyperv-disk-size")
	d.MemSize = flags.Int("hyperv-memory")
	d.CPU = flags.Int("hyperv-cpu-count")
	d.SwarmMaster = flags.Bool("swarm-master")
	d.SwarmHost = flags.String("swarm-host")
	d.SwarmDiscovery = flags.String("swarm-discovery")
	d.SSHUser = "docker"
	return nil
}
開發者ID:sergey-stratoscale,項目名稱:machine,代碼行數:12,代碼來源:hyperv.go

示例15: SetConfigFromFlags

// SetConfigFromFlags - gets the mcnflag configuration flags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	log.Debug("SetConfigFromFlags...")

	d.ClientICSP = d.ClientICSP.NewICSPClient(flags.String("oneview-icsp-user"),
		flags.String("oneview-icsp-password"),
		flags.String("oneview-icsp-domain"),
		flags.String("oneview-icsp-endpoint"),
		flags.Bool("oneview-sslverify"),
		1)

	d.ClientOV = d.ClientOV.NewOVClient(flags.String("oneview-ov-user"),
		flags.String("oneview-ov-password"),
		flags.String("oneview-ov-domain"),
		flags.String("oneview-ov-endpoint"),
		flags.Bool("oneview-sslverify"),
		1)

	d.ClientICSP.RefreshVersion()
	d.ClientOV.RefreshVersion()

	d.IloUser = flags.String("oneview-ilo-user")
	d.IloPassword = flags.String("oneview-ilo-password")
	d.IloPort = flags.Int("oneview-ilo-port")

	d.PublicSlotID = flags.Int("oneview-public-slotid")
	d.PublicConnectionName = flags.String("oneview-public-connection-name")

	d.SSHUser = flags.String("oneview-ssh-user")
	d.SSHPort = flags.Int("oneview-ssh-port")

	d.ServerTemplate = flags.String("oneview-server-template")
	d.OSBuildPlan = flags.String("oneview-os-plan")

	d.SwarmMaster = flags.Bool("swarm-master")
	d.SwarmHost = flags.String("swarm-host")
	d.SwarmDiscovery = flags.String("swarm-discovery")

	// TODO : we should verify settings for each client

	// check for the ov endpoint
	if d.ClientOV.Endpoint == "" {
		return ErrDriverMissingEndPointOptionOV
	}
	// check for the icsp endpoint
	if d.ClientICSP.Endpoint == "" {
		return ErrDriverMissingEndPointOptionICSP
	}
	// check for the template name
	if d.ServerTemplate == "" {
		return ErrDriverMissingTemplateOption
	}

	if d.OSBuildPlan == "" {
		return ErrDriverMissingBuildPlanOption
	}

	return nil
}
開發者ID:JohnKDay,項目名稱:docker-machine-oneview,代碼行數:59,代碼來源:oneview.go


注:本文中的github.com/docker/machine/libmachine/drivers.DriverOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。