Skip to content

Commit

Permalink
Revert "Apply fieldalignment fixes for struct byte sizes"
Browse files Browse the repository at this point in the history
This reverts commit 6b1fabb.
  • Loading branch information
optik-aper committed Jun 5, 2024
1 parent 6b1fabb commit 3934ddc
Show file tree
Hide file tree
Showing 35 changed files with 408 additions and 377 deletions.
6 changes: 3 additions & 3 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ type accountBase struct {

// Account represents a Vultr account
type Account struct {
Balance float32 `json:"balance"`
PendingCharges float32 `json:"pending_charges"`
LastPaymentDate string `json:"last_payment_date"`
LastPaymentAmount float32 `json:"last_payment_amount"`
Name string `json:"name"`
Email string `json:"email"`
ACL []string `json:"acls"`
Balance float32 `json:"balance"`
PendingCharges float32 `json:"pending_charges"`
LastPaymentAmount float32 `json:"last_payment_amount"`
}

// Get Vultr account info
Expand Down
4 changes: 2 additions & 2 deletions application.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ type ApplicationServiceHandler struct {

// Application represents all available apps that can be used to deployed with vultr Instances.
type Application struct {
ID int `json:"id"`
Name string `json:"name"`
ShortName string `json:"short_name"`
DeployName string `json:"deploy_name"`
Type string `json:"type"`
Vendor string `json:"vendor"`
ImageID string `json:"image_id"`
ID int `json:"id"`
}

type applicationBase struct {
Meta *Meta `json:"meta"`
Applications []Application `json:"applications"`
Meta *Meta `json:"meta"`
}

// List retrieves a list of available applications that can be launched when creating a Vultr instance
Expand Down
4 changes: 2 additions & 2 deletions backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ type Backup struct {
ID string `json:"id"`
DateCreated string `json:"date_created"`
Description string `json:"description"`
Status string `json:"status"`
Size int `json:"size"`
Status string `json:"status"`
}

type backupsBase struct {
Meta *Meta `json:"meta"`
Backups []Backup `json:"backups"`
Meta *Meta `json:"meta"`
}

type backupBase struct {
Expand Down
113 changes: 58 additions & 55 deletions bare_metal_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,72 +53,75 @@ type BareMetalServerServiceHandler struct {

// BareMetalServer represents a Bare Metal server on Vultr
type BareMetalServer struct {
Plan string `json:"plan"`
ImageID string `json:"image_id"`
RAM string `json:"ram"`
Disk string `json:"disk"`
MainIP string `json:"main_ip"`
NetmaskV4 string `json:"netmask_v4"`
Region string `json:"region"`
DefaultPassword string `json:"default_password"`
DateCreated string `json:"date_created"`
Status string `json:"status"`
GatewayV4 string `json:"gateway_v4"`
Os string `json:"os"`
V6MainIP string `json:"v6_main_ip"`
V6Network string `json:"v6_network"`
ID string `json:"id"`
Tag string `json:"tag"`
Label string `json:"label"`
Tags []string `json:"tags"`
Features []string `json:"features"`
MacAddress int `json:"mac_address"`
V6NetworkSize int `json:"v6_network_size"`
OsID int `json:"os_id"`
AppID int `json:"app_id"`
CPUCount int `json:"cpu_count"`
ID string `json:"id"`
Os string `json:"os"`
RAM string `json:"ram"`
Disk string `json:"disk"`
MainIP string `json:"main_ip"`
CPUCount int `json:"cpu_count"`
Region string `json:"region"`
DefaultPassword string `json:"default_password"`
DateCreated string `json:"date_created"`
Status string `json:"status"`
NetmaskV4 string `json:"netmask_v4"`
GatewayV4 string `json:"gateway_v4"`
Plan string `json:"plan"`
V6Network string `json:"v6_network"`
V6MainIP string `json:"v6_main_ip"`
V6NetworkSize int `json:"v6_network_size"`
MacAddress int `json:"mac_address"`
Label string `json:"label"`
// Deprecated: Tag should no longer be used. Instead, use Tags.
Tag string `json:"tag"`
OsID int `json:"os_id"`
AppID int `json:"app_id"`
ImageID string `json:"image_id"`
Features []string `json:"features"`
Tags []string `json:"tags"`
}

// BareMetalCreate represents the optional parameters that can be set when creating a Bare Metal server
type BareMetalCreate struct {
EnableIPv6 *bool `json:"enable_ipv6,omitempty"`
AppVariables map[string]string `json:"app_variables,omitempty"`
EnableVPC2 *bool `json:"enable_vpc2,omitempty"`
PersistentPxe *bool `json:"persistent_pxe,omitempty"`
ActivationEmail *bool `json:"activation_email,omitempty"`
UserData string `json:"user_data,omitempty"`
Tag string `json:"tag,omitempty"`
Plan string `json:"plan,omitempty"`
StartupScriptID string `json:"script_id,omitempty"`
ImageID string `json:"image_id,omitempty"`
Region string `json:"region,omitempty"`
SnapshotID string `json:"snapshot_id,omitempty"`
Hostname string `json:"hostname,omitempty"`
MdiskMode string `json:"mdisk_mode,omitempty"`
Label string `json:"label,omitempty"`
ReservedIPv4 string `json:"reserved_ipv4,omitempty"`
Tags []string `json:"tags"`
AttachVPC2 []string `json:"attach_vpc2,omitempty"`
DetachVPC2 []string `json:"detach_vpc2,omitempty"`
SSHKeyIDs []string `json:"sshkey_id,omitempty"`
AppID int `json:"app_id,omitempty"`
OsID int `json:"os_id,omitempty"`
Region string `json:"region,omitempty"`
Plan string `json:"plan,omitempty"`
OsID int `json:"os_id,omitempty"`
StartupScriptID string `json:"script_id,omitempty"`
SnapshotID string `json:"snapshot_id,omitempty"`
EnableIPv6 *bool `json:"enable_ipv6,omitempty"`
Label string `json:"label,omitempty"`
SSHKeyIDs []string `json:"sshkey_id,omitempty"`
AppID int `json:"app_id,omitempty"`
ImageID string `json:"image_id,omitempty"`
UserData string `json:"user_data,omitempty"`
ActivationEmail *bool `json:"activation_email,omitempty"`
Hostname string `json:"hostname,omitempty"`
MdiskMode string `json:"mdisk_mode,omitempty"`
// Deprecated: Tag should no longer be used. Instead, use Tags.
Tag string `json:"tag,omitempty"`
ReservedIPv4 string `json:"reserved_ipv4,omitempty"`
PersistentPxe *bool `json:"persistent_pxe,omitempty"`
Tags []string `json:"tags"`
AttachVPC2 []string `json:"attach_vpc2,omitempty"`
DetachVPC2 []string `json:"detach_vpc2,omitempty"`
EnableVPC2 *bool `json:"enable_vpc2,omitempty"`
AppVariables map[string]string `json:"app_variables,omitempty"`
}

// BareMetalUpdate represents the optional parameters that can be set when updating a Bare Metal server
type BareMetalUpdate struct {
EnableIPv6 *bool `json:"enable_ipv6,omitempty"`
OsID int `json:"os_id,omitempty"`
EnableIPv6 *bool `json:"enable_ipv6,omitempty"`
Label string `json:"label,omitempty"`
AppID int `json:"app_id,omitempty"`
ImageID string `json:"image_id,omitempty"`
UserData string `json:"user_data,omitempty"`
MdiskMode string `json:"mdisk_mode,omitempty"`
// Deprecated: Tag should no longer be used. Instead, use Tags.
Tag *string `json:"tag,omitempty"`
EnableVPC2 *bool `json:"enable_vpc2,omitempty"`
Label string `json:"label,omitempty"`
ImageID string `json:"image_id,omitempty"`
UserData string `json:"user_data,omitempty"`
MdiskMode string `json:"mdisk_mode,omitempty"`
Tags []string `json:"tags"`
AttachVPC2 []string `json:"attach_vpc2,omitempty"`
DetachVPC2 []string `json:"detach_vpc2,omitempty"`
OsID int `json:"os_id,omitempty"`
AppID int `json:"app_id,omitempty"`
EnableVPC2 *bool `json:"enable_vpc2,omitempty"`
}

// BareMetalServerBandwidth represents bandwidth information for a Bare Metal server
Expand All @@ -128,8 +131,8 @@ type BareMetalServerBandwidth struct {
}

type bareMetalsBase struct {
Meta *Meta `json:"meta"`
BareMetals []BareMetalServer `json:"bare_metals"`
Meta *Meta `json:"meta"`
}

type bareMetalBase struct {
Expand Down
12 changes: 6 additions & 6 deletions billing.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ type BillingServiceHandler struct {

// History represents a billing history item on an account
type History struct {
ID int `json:"id"`
Date string `json:"date"`
Type string `json:"type"`
Description string `json:"description"`
ID int `json:"id"`
Amount float32 `json:"amount"`
Balance float32 `json:"balance"`
}

// Invoice represents an invoice on an account
type Invoice struct {
ID int `json:"id"`
Date string `json:"date"`
Description string `json:"description"`
ID int `json:"id"`
Amount float32 `json:"amount"`
Balance float32 `json:"balance"`
}
Expand All @@ -47,29 +47,29 @@ type InvoiceItem struct {
Product string `json:"product"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
UnitType string `json:"unit_type"`
Units int `json:"units"`
UnitType string `json:"unit_type"`
UnitPrice float32 `json:"unit_price"`
Total float32 `json:"total"`
}

type billingHistoryBase struct {
Meta *Meta `json:"meta"`
History []History `json:"billing_history"`
Meta *Meta `json:"meta"`
}

type invoicesBase struct {
Meta *Meta `json:"meta"`
Invoice []Invoice `json:"billing_invoices"`
Meta *Meta `json:"meta"`
}

type invoiceBase struct {
Invoice *Invoice `json:"billing_invoice"`
}

type invoiceItemsBase struct {
Meta *Meta `json:"meta"`
InvoiceItems []InvoiceItem `json:"invoice_items"`
Meta *Meta `json:"meta"`
}

// ListHistory retrieves a list of all billing history on the current account
Expand Down
12 changes: 6 additions & 6 deletions block_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,35 @@ type BlockStorageServiceHandler struct {
// BlockStorage represents Vultr Block-Storage
type BlockStorage struct {
ID string `json:"id"`
Cost float32 `json:"cost"`
Status string `json:"status"`
SizeGB int `json:"size_gb"`
Region string `json:"region"`
DateCreated string `json:"date_created"`
AttachedToInstance string `json:"attached_to_instance"`
Label string `json:"label"`
MountID string `json:"mount_id"`
BlockType string `json:"block_type"`
SizeGB int `json:"size_gb"`
Cost float32 `json:"cost"`
}

// BlockStorageCreate struct is used for creating Block Storage.
type BlockStorageCreate struct {
Region string `json:"region"`
SizeGB int `json:"size_gb"`
Label string `json:"label,omitempty"`
BlockType string `json:"block_type,omitempty"`
SizeGB int `json:"size_gb"`
}

// BlockStorageUpdate struct is used to update Block Storage.
type BlockStorageUpdate struct {
Label string `json:"label,omitempty"`
SizeGB int `json:"size_gb,omitempty"`
Label string `json:"label,omitempty"`
}

// BlockStorageAttach struct used to define if a attach should be restart the instance.
type BlockStorageAttach struct {
Live *bool `json:"live,omitempty"`
InstanceID string `json:"instance_id"`
Live *bool `json:"live,omitempty"`
}

// BlockStorageDetach struct used to define if a detach should be restart the instance.
Expand All @@ -66,8 +66,8 @@ type BlockStorageDetach struct {
}

type blockStoragesBase struct {
Meta *Meta `json:"meta"`
Blocks []BlockStorage `json:"blocks"`
Meta *Meta `json:"meta"`
}

type blockStorageBase struct {
Expand Down
Loading

0 comments on commit 3934ddc

Please sign in to comment.