本文整理汇总了Golang中github.com/docker/machine/libmachine/drivers.DriverOptions.Int方法的典型用法代码示例。如果您正苦于以下问题:Golang DriverOptions.Int方法的具体用法?Golang DriverOptions.Int怎么用?Golang DriverOptions.Int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/docker/machine/libmachine/drivers.DriverOptions
的用法示例。
在下文中一共展示了DriverOptions.Int方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.AuthUrl = flags.String("openstack-auth-url")
d.ActiveTimeout = flags.Int("openstack-active-timeout")
d.Insecure = flags.Bool("openstack-insecure")
d.DomainID = flags.String("openstack-domain-id")
d.DomainName = flags.String("openstack-domain-name")
d.Username = flags.String("openstack-username")
d.Password = flags.String("openstack-password")
d.TenantName = flags.String("openstack-tenant-name")
d.TenantId = flags.String("openstack-tenant-id")
d.Region = flags.String("openstack-region")
d.AvailabilityZone = flags.String("openstack-availability-zone")
d.EndpointType = flags.String("openstack-endpoint-type")
d.FlavorId = flags.String("openstack-flavor-id")
d.FlavorName = flags.String("openstack-flavor-name")
d.ImageId = flags.String("openstack-image-id")
d.ImageName = flags.String("openstack-image-name")
d.NetworkId = flags.String("openstack-net-id")
d.NetworkName = flags.String("openstack-net-name")
if flags.String("openstack-sec-groups") != "" {
d.SecurityGroups = strings.Split(flags.String("openstack-sec-groups"), ",")
}
d.FloatingIpPool = flags.String("openstack-floatingip-pool")
d.SSHUser = flags.String("openstack-ssh-user")
d.SSHPort = flags.Int("openstack-ssh-port")
d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
d.SwarmDiscovery = flags.String("swarm-discovery")
return d.checkConfig()
}
示例2: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.URL = flags.String("exoscale-url")
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.SSHUser = flags.String("exoscale-ssh-user")
d.UserDataFile = flags.String("exoscale-userdata")
d.SetSwarmConfigFromFlags(flags)
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
}
示例3: SetConfigFromFlags
// SetConfigFromFlags initializes the driver based on the command line flags.
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.Project = flags.String("google-project")
if d.Project == "" {
return fmt.Errorf("Please specify the Google Cloud Project name using the option --google-project.")
}
d.Zone = flags.String("google-zone")
d.UseExisting = flags.Bool("google-use-existing")
if !d.UseExisting {
d.MachineType = flags.String("google-machine-type")
d.MachineImage = flags.String("google-machine-image")
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.UseInternalIP = flags.Bool("google-use-internal-ip") || flags.Bool("google-use-internal-ip-only")
d.UseInternalIPOnly = flags.Bool("google-use-internal-ip-only")
d.Scopes = flags.String("google-scopes")
d.Tags = flags.String("google-tags")
}
d.SSHUser = flags.String("google-username")
d.SSHPort = 22
d.SetSwarmConfigFromFlags(flags)
return nil
}
示例4: 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
}
示例5: SetConfigFromFlags
// SetConfigFromFlags assigns and verifies the command-line arguments presented to the driver.
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.ActiveTimeout = flags.Int("rackspace-active-timeout")
d.Username = flags.String("rackspace-username")
d.APIKey = flags.String("rackspace-api-key")
d.Region = flags.String("rackspace-region")
d.EndpointType = flags.String("rackspace-endpoint-type")
d.ImageId = flags.String("rackspace-image-id")
d.FlavorId = flags.String("rackspace-flavor-id")
d.SSHUser = flags.String("rackspace-ssh-user")
d.SSHPort = flags.Int("rackspace-ssh-port")
d.SetSwarmConfigFromFlags(flags)
if d.Region == "" {
return missingEnvOrOption("Region", "OS_REGION_NAME", "--rackspace-region")
}
if d.Username == "" {
return missingEnvOrOption("Username", "OS_USERNAME", "--rackspace-username")
}
if d.APIKey == "" {
return missingEnvOrOption("API key", "OS_API_KEY", "--rackspace-api-key")
}
if d.ImageId == "" {
// Default to the Ubuntu 15.10 image.
// This is done here, rather than in the option registration, to keep the default value
// from making "machine create --help" ugly.
d.ImageId = "59a3fadd-93e7-4674-886a-64883e17115f"
}
if d.EndpointType != "publicURL" && d.EndpointType != "adminURL" && d.EndpointType != "internalURL" {
return fmt.Errorf(`Invalid endpoint type "%s". Endpoint type must be publicURL, adminURL or internalURL.`, d.EndpointType)
}
return nil
}
示例6: 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 errors.New("generic driver requires the --generic-ip-address option")
}
return nil
}
示例7: 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
}
示例8: 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
}
示例9: SetConfigFromFlags
// SetConfigFromFlags initializes driver values from the command line values
// and checks if the arguments have values.
func (d *Driver) SetConfigFromFlags(fl drivers.DriverOptions) error {
// Initialize driver context for machine
d.ctx = &azureutil.DeploymentContext{}
// Required string flags
flags := []struct {
target *string
flag string
}{
{&d.BaseDriver.SSHUser, flAzureSSHUser},
{&d.SubscriptionID, flAzureSubscriptionID},
{&d.ResourceGroup, flAzureResourceGroup},
{&d.Location, flAzureLocation},
{&d.Size, flAzureSize},
{&d.Image, flAzureImage},
{&d.VirtualNetwork, flAzureVNet},
{&d.SubnetName, flAzureSubnet},
{&d.SubnetPrefix, flAzureSubnetPrefix},
{&d.AvailabilitySet, flAzureAvailabilitySet},
{&d.StorageType, flAzureStorageType},
}
for _, f := range flags {
*f.target = fl.String(f.flag)
if *f.target == "" {
return requiredOptionError(f.flag)
}
}
// Optional flags or Flags of other types
d.Environment = fl.String(flAzureEnvironment)
d.OpenPorts = fl.StringSlice(flAzurePorts)
d.PrivateIPAddr = fl.String(flAzurePrivateIPAddr)
d.UsePrivateIP = fl.Bool(flAzureUsePrivateIP)
d.NoPublicIP = fl.Bool(flAzureNoPublicIP)
d.StaticPublicIP = fl.Bool(flAzureStaticPublicIP)
d.DockerPort = fl.Int(flAzureDockerPort)
d.DNSLabel = fl.String(flAzureDNSLabel)
d.CustomDataFile = fl.String(flAzureCustomData)
d.ClientID = fl.String(flAzureClientID)
d.ClientSecret = fl.String(flAzureClientSecret)
// Set flags on the BaseDriver
d.BaseDriver.SSHPort = sshPort
d.SetSwarmConfigFromFlags(fl)
log.Debug("Set configuration from flags.")
return nil
}
示例10: SetConfigFromFlags
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.ApiKey = flags.String("gandi-api-key")
d.Image = flags.String("gandi-image")
d.Datacenter = flags.String("gandi-datacenter")
d.Url = flags.String("gandi-url")
d.Memory = flags.Int("gandi-memory")
d.Core = flags.Int("gandi-core")
if d.ApiKey == "" {
return fmt.Errorf("gandi driver requires the -gandi-api-key option")
}
return nil
}
示例11: 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
}
示例12: 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.UserDataFile = flags.String("digitalocean-userdata")
d.SSHUser = flags.String("digitalocean-ssh-user")
d.SSHPort = flags.Int("digitalocean-ssh-port")
d.SetSwarmConfigFromFlags(flags)
if d.AccessToken == "" {
return fmt.Errorf("digitalocean driver requires the --digitalocean-access-token option")
}
return nil
}
示例13: 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.MacAddr = flags.String("hyperv-static-macaddress")
d.VLanID = flags.Int("hyperv-vlan-id")
d.SSHUser = "docker"
d.SetSwarmConfigFromFlags(flags)
return nil
}
示例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
d.SSHKeyID = flags.Int("digitalocean-sshkey-id")
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.Tags = flags.String("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
}