<commit_before>package virtualboxclient

import (
	"github.com/appropriate/go-virtualboxclient/vboxwebsrv"
)

type VirtualBoxClient struct {
	username string
	password string
	url      string

	client          *vboxwebsrv.VboxPortType
	managedObjectId string
}

func New(username, password, url string) *VirtualBoxClient {
	return &VirtualBoxClient{
		username: username,
		password: password,
		url:      url,
	}
}

func (svc *VirtualBoxClient) Logon() error {
	svc.client = vboxwebsrv.NewVboxPortType(svc.url, false, nil)

	request := vboxwebsrv.IWebsessionManagerlogon{
		Username: svc.username,
		Password: svc.password,
	}

	response, err := svc.client.IWebsessionManagerlogon(&request)
	if err != nil {
		return err // TODO: Wrap the error
	}

	svc.managedObjectId = response.Returnval

	return nil
}

func (svc *VirtualBoxClient) SessionId() string {
	return svc.managedObjectId
}<commit_msg>Implement CreateHardDisk<commit_after>package virtualboxclient

import (
	"github.com/appropriate/go-virtualboxclient/vboxwebsrv"
)

type VirtualBoxClient struct {
	username string
	password string
	url      string

	client          *vboxwebsrv.VboxPortType
	managedObjectId string
}

type HardDisk struct {
	managedObjectId string
}

func New(username, password, url string) *VirtualBoxClient {
	return &VirtualBoxClient{
		username: username,
		password: password,
		url:      url,
	}
}

func (svc *VirtualBoxClient) Logon() error {
	if svc.managedObjectId != "" {
		// Already logged in
		return nil
	}

	svc.client = vboxwebsrv.NewVboxPortType(svc.url, false, nil)

	request := vboxwebsrv.IWebsessionManagerlogon{
		Username: svc.username,
		Password: svc.password,
	}

	response, err := svc.client.IWebsessionManagerlogon(&request)
	if err != nil {
		return err // TODO: Wrap the error
	}

	svc.managedObjectId = response.Returnval

	return nil
}

func (svc *VirtualBoxClient) SessionId() string {
	return svc.managedObjectId
}

func (svc *VirtualBoxClient) CreateHardDisk(format, location string) (*HardDisk, error) {
	svc.Logon()

	request := vboxwebsrv.IVirtualBoxcreateHardDisk{This: svc.managedObjectId, Format: format, Location: location}

	response, err := svc.client.IVirtualBoxcreateHardDisk(&request)
	if err != nil {
		return nil, err // TODO: Wrap the error
	}

	return &HardDisk{managedObjectId: response.Returnval}, nil
}
{'fraction_non_alphanumeric': 0.09705002137665669, 'fraction_numerical': 0.0, 'mean_word_length': 4.518867924528302, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5079727', 'n_tokens_mistral': 809, 'n_tokens_neox': 771, 'n_words': 184}