func (c *client) GetClient() *api.APIClient {
	token, _ := c.GetConfigValue("access-token")
	secret, _ := c.GetConfigValue("access-token-secret")
	region, _ := c.GetConfigValue("region")

	if token.CurrentValue != "" && secret.CurrentValue != "" && region.CurrentValue != "" {
		return api.NewAPIClient(token.CurrentValue, secret.CurrentValue, region.CurrentValue)
	}
	return nil
}
// SetConfigFromFlags create config values from flags
func (d *Driver) SetConfigFromFlags(srcFlags drivers.DriverOptions) error {
	cliClient := cli.NewClient()
	flags := cliClient.GetDriverOptions(srcFlags)

	d.Client = api.NewAPIClient(
		flags.String("sakuracloud-access-token"),
		flags.String("sakuracloud-access-token-secret"),
		flags.String("sakuracloud-region"),
	)

	d.SwarmMaster = flags.Bool("swarm-master")
	d.SwarmHost = flags.String("swarm-host")
	d.SwarmDiscovery = flags.String("swarm-discovery")
	d.SSHUser = "******"
	d.SSHPort = 22
	d.SSHKey = flags.String("sakuracloud-ssh-key")

	if err := d.getClient().ValidateClientConfig(); err != nil {
		return err
	}

	d.serverConfig = &spec.SakuraServerConfig{
		HostName:            "",
		Core:                flags.Int("sakuracloud-core"),
		MemorySize:          flags.Int("sakuracloud-memory-size"),
		ConnectedSwitch:     flags.String("sakuracloud-connected-switch"),
		PrivateIP:           flags.String("sakuracloud-private-ip"),
		PrivateIPSubnetMask: flags.String("sakuracloud-private-ip-subnet-mask"),
		PrivateIPOnly:       flags.Bool("sakuracloud-private-ip-only"),
		Gateway:             flags.String("sakuracloud-gateway"),
		DiskPlan:            flags.String("sakuracloud-disk-plan"),
		DiskSize:            flags.Int("sakuracloud-disk-size"),
		DiskName:            flags.String("sakuracloud-disk-name"),
		DiskConnection:      flags.String("sakuracloud-disk-connection"),
		Group:               flags.String("sakuracloud-group"),
		AutoReboot:          flags.Bool("sakuracloud-auto-reboot"),
		IgnoreVirtioNet:     flags.Bool("sakuracloud-ignore-virtio-net"),
		PacketFilter:        flags.String("sakuracloud-packet-filter"),
		PrivatePacketFilter: flags.String("sakuracloud-private-packet-filter"),
		EnablePWAuth:        flags.Bool("sakuracloud-enable-password-auth"),
	}

	if d.serverConfig.HostName == "" {
		d.serverConfig.HostName = d.GetMachineName()
	}

	if d.serverConfig.IsDiskNameDefault() {
		d.serverConfig.DiskName = d.GetMachineName()
	}

	if d.serverConfig.PrivateIPOnly {
		d.IPAddress = d.serverConfig.PrivateIP
	}

	if d.serverConfig.DiskSourceArchiveID == "" {
		archiveID, err := d.getClient().GetUbuntuArchiveID()
		if err != nil {
			return err
		}
		d.serverConfig.DiskSourceArchiveID = archiveID
	}

	d.EnginePort = flags.Int("sakuracloud-engine-port")
	d.DNSZone = flags.String("sakuracloud-dns-zone")
	d.GSLB = flags.String("sakuracloud-gslb")

	return validateSakuraServerConfig(d.Client, d.serverConfig)
}