drivers/rackspace/rackspace.go
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 16.04 image.
		// This is done here, rather than in the option registration, to keep the default value
		// from making "machine create --help" ugly.
		d.ImageId = "821ba5f4-712d-4ec8-9c65-a3fa4bc500f9"
	}

	if d.EndpointType != "publicURL" && d.EndpointType != "adminURL" && d.EndpointType != "internalURL" {
		return fmt.Errorf("invalid endpoint type %q (must be publicURL, adminURL or internalURL)", d.EndpointType)
	}

	return nil
}
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 16.04 image.
		// This is done here, rather than in the option registration, to keep the default value
		// from making "machine create --help" ugly.
		d.ImageId = "821ba5f4-712d-4ec8-9c65-a3fa4bc500f9"
	}

	if d.EndpointType != "publicURL" && d.EndpointType != "adminURL" && d.EndpointType != "internalURL" {
		return fmt.Errorf("invalid endpoint type %q (must be publicURL, adminURL or internalURL)", d.EndpointType)
	}

	return nil
}
func ( d * Driver ) SetConfigFromFlags ( flags drivers . DriverOptions ) error { d . ActiveTimeout = flags . Int ( " " ) d . Username = flags . String ( " " ) d . APIKey = flags . String ( " " ) d . Region = flags . String ( " " ) d . EndpointType = flags . String ( " " ) d . ImageId = flags . String ( " " ) d . FlavorId = flags . String ( " " ) d . SSHUser = flags . String ( " " ) d . SSHPort = flags . Int ( " " ) d . SetSwarmConfigFromFlags ( flags ) if d . Region == " " { return missingEnvOrOption ( " " , " " , " " ) } if d . Username == " " { return missingEnvOrOption ( " " , " " , " " ) } if d . APIKey == " " { return missingEnvOrOption ( " " , " " , " " ) } if d . ImageId == " " { // Default to the Ubuntu 16.04 image. // This is done here, rather than in the option registration, to keep the default value // from making "machine create --help" ugly. d . ImageId = " " } if d . EndpointType != " " && d . EndpointType != " " && d . EndpointType != " " { return fmt . Errorf ( " " , d . EndpointType ) } return nil }
// SetConfigFromFlags assigns and verifies the command-line arguments presented to the driver.
SetConfigFromFlags assigns and verifies the command - line arguments presented to the driver .