本文整理汇总了Golang中github.com/docker/machine/drivers.DriverOptions.StringSlice方法的典型用法代码示例。如果您正苦于以下问题:Golang DriverOptions.StringSlice方法的具体用法?Golang DriverOptions.StringSlice怎么用?Golang DriverOptions.StringSlice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/docker/machine/drivers.DriverOptions
的用法示例。
在下文中一共展示了DriverOptions.StringSlice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.URL = flags.String("exoscale-endpoint")
d.ApiKey = flags.String("exoscale-api-key")
d.ApiSecretKey = flags.String("exoscale-api-secret-key")
d.InstanceProfile = flags.String("exoscale-instance-profile")
d.DiskSize = flags.Int("exoscale-disk-size")
d.Image = flags.String("exoscale-image")
securityGroups := flags.StringSlice("exoscale-security-group")
if len(securityGroups) == 0 {
securityGroups = []string{"docker-machine"}
}
d.SecurityGroup = strings.Join(securityGroups, ",")
d.AvailabilityZone = flags.String("exoscale-availability-zone")
d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
if d.URL == "" {
d.URL = "https://api.exoscale.ch/compute"
}
if d.ApiKey == "" || d.ApiSecretKey == "" {
return fmt.Errorf("Please specify an API key (--exoscale-api-key) and an API secret key (--exoscale-api-secret-key).")
}
return nil
}
示例2: 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.Tags = flags.StringSlice("google-tags")
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
}