本文整理汇总了Golang中github.com/docker/machine/drivers.DriverOptions.String方法的典型用法代码示例。如果您正苦于以下问题:Golang DriverOptions.String方法的具体用法?Golang DriverOptions.String怎么用?Golang DriverOptions.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/docker/machine/drivers.DriverOptions
的用法示例。
在下文中一共展示了DriverOptions.String方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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.ConfigDriveISO = d.ResolveStorePath(isoConfigDrive)
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
}
示例2: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.boot2DockerURL = flags.String("hyper-v-boot2docker-url")
d.boot2DockerLoc = flags.String("hyper-v-boot2docker-location")
d.vSwitch = flags.String("hyper-v-virtual-switch")
d.diskSize = flags.Int("hyper-v-disk-size")
d.memSize = flags.Int("hyper-v-memory")
d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
d.SSHUser = "docker"
d.SSHPort = 22
return nil
}
示例3: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
url := flags.String("url")
if url == "" {
return fmt.Errorf("--url option is required when no driver is selected")
}
validatedUrl, err := api.ValidateHost(url)
if err != nil {
return err
}
d.URL = validatedUrl
return nil
}
示例4: 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.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
d.SSHUser = "docker"
d.Boot2DockerImportVM = flags.String("virtualbox-import-boot2docker-vm")
d.HostOnlyCIDR = flags.String("virtualbox-hostonly-cidr")
return nil
}
示例5: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
url := flags.String("url")
if url == "" {
return fmt.Errorf("--url option is required when no driver is selected")
}
d.URL = url
u, err := neturl.Parse(url)
if err != nil {
return err
}
d.IPAddress = u.Host
return nil
}
示例6: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.AccessToken = flags.String("digitalocean-access-token")
d.Image = flags.String("digitalocean-image")
d.Region = flags.String("digitalocean-region")
d.Size = flags.String("digitalocean-size")
if d.AccessToken == "" {
return fmt.Errorf("digitalocean driver requires the --digitalocean-access-token option")
}
return nil
}
示例7: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
// this is generate from host range outside driver
d.Host = flags.String("aiyara-host-ip")
d.SSHUser = flags.String("aiyara-ssh-user")
d.sshPasswd = flags.String("aiyara-ssh-passwd")
d.SSHPort = flags.Int("aiyara-ssh-port")
return nil
}
示例8: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.Memory = flags.Int("virtualbox-memory")
d.DiskSize = flags.Int("virtualbox-disk-size")
d.Boot2DockerURL = flags.String("virtualbox-boot2docker-url")
d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
d.SSHUser = "docker"
return nil
}
示例9: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
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 fmt.Errorf("generic driver requires the --generic-ip-address option")
}
if d.SSHKey == "" {
return fmt.Errorf("generic driver requires the --generic-ssh-key option")
}
return nil
}
示例10: 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 = "photon"
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 > 16 {
d.CPU = 16
}
return nil
}
示例11: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.IPAddress = flags.String("hetzner-ip-address")
d.Login = flags.String("hetzner-login")
d.Password = flags.String("hetzner-password")
if d.IPAddress == "" {
return fmt.Errorf("hetzner driver requires the --hetzner-ip-address option")
}
if d.Login == "" {
return fmt.Errorf("hetzner driver requires the --hetzner-login option")
}
if d.Password == "" {
return fmt.Errorf("hetzner driver requires the --hetzner-password option")
}
return nil
}
示例12: 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.ISO = path.Join(d.storePath, isoFilename)
d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
d.SSHUser = "docker"
d.SSHPort = 22
// We support a maximum of 16 cpu to be consistent with Virtual Hardware 10
// specs.
if d.CPU > 16 {
d.CPU = 16
}
return nil
}
示例13: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.Client = &Client{
Endpoint: flags.String("softlayer-api-endpoint"),
User: flags.String("softlayer-user"),
ApiKey: flags.String("softlayer-api-key"),
}
d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
d.SSHUser = "root"
d.SSHPort = 22
if err := validateClientConfig(d.Client); err != nil {
return err
}
d.deviceConfig = &deviceConfig{
Hostname: flags.String("softlayer-hostname"),
DiskSize: flags.Int("softlayer-disk-size"),
Cpu: flags.Int("softlayer-cpu"),
Domain: flags.String("softlayer-domain"),
Memory: flags.Int("softlayer-memory"),
PrivateNet: flags.Bool("softlayer-private-net-only"),
LocalDisk: flags.Bool("softlayer-local-disk"),
HourlyBilling: flags.Bool("softlayer-hourly-billing"),
Image: flags.String("softlayer-image"),
Region: flags.String("softlayer-region"),
PublicVLAN: flags.Int("softlayer-public-vlan-id"),
PrivateVLAN: flags.Int("softlayer-private-vlan-id"),
}
if d.deviceConfig.Hostname == "" {
d.deviceConfig.Hostname = d.GetMachineName()
}
return validateDeviceConfig(d.deviceConfig)
}
示例14: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.AccessToken = flags.String("digitalocean-access-token")
d.Image = flags.String("digitalocean-image")
d.Region = flags.String("digitalocean-region")
d.Size = flags.String("digitalocean-size")
d.IPv6 = flags.Bool("digitalocean-ipv6")
d.PrivateNetworking = flags.Bool("digitalocean-private-networking")
d.Backups = flags.Bool("digitalocean-backups")
d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
d.SSHUser = flags.String("digitalocean-ssh-user")
d.SSHPort = 22
if d.AccessToken == "" {
return fmt.Errorf("digitalocean driver requires the --digitalocean-access-token option")
}
return nil
}
示例15: SetConfigFromFlags
// SetConfigFromFlags initializes the driver based on the command line flags.
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.Zone = flags.String("google-zone")
d.MachineType = flags.String("google-machine-type")
d.DiskSize = flags.Int("google-disk-size")
d.DiskType = flags.String("google-disk-type")
d.Address = flags.String("google-address")
d.Preemptible = flags.Bool("google-preemptible")
d.AuthTokenPath = flags.String("google-auth-token")
d.Project = flags.String("google-project")
d.Scopes = flags.String("google-scopes")
d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
if d.Project == "" {
return fmt.Errorf("Please specify the Google Cloud Project name using the option --google-project.")
}
d.SSHUser = flags.String("google-username")
d.SSHPort = 22
return nil
}