diff --git a/bare_metal_server.go b/bare_metal_server.go index 6ad0fdd..69bcc61 100644 --- a/bare_metal_server.go +++ b/bare_metal_server.go @@ -53,71 +53,65 @@ type BareMetalServerServiceHandler struct { // BareMetalServer represents a Bare Metal server on Vultr type BareMetalServer struct { - 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"` + 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"` + 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 { - 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"` + 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"` + 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 { - 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"` + 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"` Tags []string `json:"tags"` AttachVPC2 []string `json:"attach_vpc2,omitempty"` DetachVPC2 []string `json:"detach_vpc2,omitempty"` diff --git a/firewall_rule.go b/firewall_rule.go index 727b6a0..2609101 100644 --- a/firewall_rule.go +++ b/firewall_rule.go @@ -24,10 +24,8 @@ type FireWallRuleServiceHandler struct { // FirewallRule represents a Vultr firewall rule type FirewallRule struct { - ID int `json:"id"` - Action string `json:"action"` - // Deprecated: Type should no longer be used. Instead, use IPType. - Type string `json:"type"` + ID int `json:"id"` + Action string `json:"action"` IPType string `json:"ip_type"` Protocol string `json:"protocol"` Port string `json:"port"` diff --git a/firewall_rule_test.go b/firewall_rule_test.go index 9965591..f8796cc 100644 --- a/firewall_rule_test.go +++ b/firewall_rule_test.go @@ -33,7 +33,6 @@ func TestFireWallRuleServiceHandler_Create(t *testing.T) { expected := &FirewallRule{ ID: 1, Action: "accept", - Type: "v4", IPType: "v4", Protocol: "tcp", Port: "80", @@ -81,7 +80,6 @@ func TestFireWallRuleServiceHandler_List(t *testing.T) { { ID: 1, Action: "accept", - Type: "v4", IPType: "v4", Protocol: "tcp", Port: "22", @@ -123,7 +121,6 @@ func TestFireWallRuleServiceHandler_Get(t *testing.T) { expectedRule := &FirewallRule{ ID: 1, Action: "accept", - Type: "v4", IPType: "v4", Protocol: "tcp", Port: "22", diff --git a/instance.go b/instance.go index 148f0a6..14e647f 100644 --- a/instance.go +++ b/instance.go @@ -72,37 +72,35 @@ type InstanceServiceHandler struct { // Instance represents a VPS type Instance struct { - ID string `json:"id"` - Os string `json:"os"` - RAM int `json:"ram"` - Disk int `json:"disk"` - Plan string `json:"plan"` - MainIP string `json:"main_ip"` - VCPUCount int `json:"vcpu_count"` - Region string `json:"region"` - DefaultPassword string `json:"default_password,omitempty"` - DateCreated string `json:"date_created"` - Status string `json:"status"` - AllowedBandwidth int `json:"allowed_bandwidth"` - NetmaskV4 string `json:"netmask_v4"` - GatewayV4 string `json:"gateway_v4"` - PowerStatus string `json:"power_status"` - ServerStatus string `json:"server_status"` - V6Network string `json:"v6_network"` - V6MainIP string `json:"v6_main_ip"` - V6NetworkSize int `json:"v6_network_size"` - Label string `json:"label"` - InternalIP string `json:"internal_ip"` - KVM string `json:"kvm"` - // 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"` - FirewallGroupID string `json:"firewall_group_id"` - Features []string `json:"features"` - Hostname string `json:"hostname"` - Tags []string `json:"tags"` + ID string `json:"id"` + Os string `json:"os"` + RAM int `json:"ram"` + Disk int `json:"disk"` + Plan string `json:"plan"` + MainIP string `json:"main_ip"` + VCPUCount int `json:"vcpu_count"` + Region string `json:"region"` + DefaultPassword string `json:"default_password,omitempty"` + DateCreated string `json:"date_created"` + Status string `json:"status"` + AllowedBandwidth int `json:"allowed_bandwidth"` + NetmaskV4 string `json:"netmask_v4"` + GatewayV4 string `json:"gateway_v4"` + PowerStatus string `json:"power_status"` + ServerStatus string `json:"server_status"` + V6Network string `json:"v6_network"` + V6MainIP string `json:"v6_main_ip"` + V6NetworkSize int `json:"v6_network_size"` + Label string `json:"label"` + InternalIP string `json:"internal_ip"` + KVM string `json:"kvm"` + OsID int `json:"os_id"` + AppID int `json:"app_id"` + ImageID string `json:"image_id"` + FirewallGroupID string `json:"firewall_group_id"` + Features []string `json:"features"` + Hostname string `json:"hostname"` + Tags []string `json:"tags"` } type instanceBase struct { @@ -233,11 +231,9 @@ type Upgrades struct { // InstanceCreateReq struct used to create an instance. type InstanceCreateReq struct { - Region string `json:"region,omitempty"` - Plan string `json:"plan,omitempty"` - Label string `json:"label,omitempty"` - // Deprecated: Tag should no longer be used. Instead, use Tags. - Tag string `json:"tag,omitempty"` + Region string `json:"region,omitempty"` + Plan string `json:"plan,omitempty"` + Label string `json:"label,omitempty"` Tags []string `json:"tags"` OsID int `json:"os_id,omitempty"` ISOID string `json:"iso_id,omitempty"` @@ -265,10 +261,8 @@ type InstanceCreateReq struct { // InstanceUpdateReq struct used to update an instance. type InstanceUpdateReq struct { - Plan string `json:"plan,omitempty"` - Label string `json:"label,omitempty"` - // Deprecated: Tag should no longer be used. Instead, use Tags. - Tag *string `json:"tag,omitempty"` + Plan string `json:"plan,omitempty"` + Label string `json:"label,omitempty"` Tags []string `json:"tags"` OsID int `json:"os_id,omitempty"` AppID int `json:"app_id,omitempty"`