Skip to content

Commit

Permalink
Adjust variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
asaha2 committed Oct 21, 2024
1 parent 98229a4 commit 61f95d4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 60 deletions.
40 changes: 20 additions & 20 deletions droplet_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ type DropletAutoscaleService interface {

// DropletAutoscalePool represents a DigitalOcean droplet autoscale pool
type DropletAutoscalePool struct {
ID string `json:"id"`
Name string `json:"name"`
Config *DropletAutoscaleConfiguration `json:"config"`
DropletTemplate *DropletAutoscaleResourceTemplate `json:"droplet_template"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CurrentUtlization *DropletAutoscaleResourceUtilization `json:"current_utilization,omitempty"`
Status string `json:"status"`
ID string `json:"id"`
Name string `json:"name"`
Config *DropletAutoscaleConfiguration `json:"config"`
DropletTemplate *DropletAutoscaleResourceTemplate `json:"droplet_template"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CurrentUtilization *DropletAutoscaleResourceUtilization `json:"current_utilization,omitempty"`
Status string `json:"status"`
}

// DropletAutoscaleConfiguration represents a DigitalOcean droplet autoscale pool configuration
Expand All @@ -47,8 +47,8 @@ type DropletAutoscaleConfiguration struct {

// DropletAutoscaleResourceTemplate represents a DigitalOcean droplet autoscale pool resource template
type DropletAutoscaleResourceTemplate struct {
SizeSlug string `json:"size"`
RegionSlug string `json:"region"`
Size string `json:"size"`
Region string `json:"region"`
Image string `json:"image"`
Tags []string `json:"tags"`
SSHKeys []string `json:"ssh_keys"`
Expand All @@ -67,13 +67,13 @@ type DropletAutoscaleResourceUtilization struct {

// DropletAutoscaleResource represents a DigitalOcean droplet autoscale pool resource
type DropletAutoscaleResource struct {
DropletID uint64 `json:"droplet_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
HealthStatus string `json:"health_status"`
UnhealthyReason string `json:"unhealthy_reason,omitempty"`
Status string `json:"status"`
DropletAutoscaleResourceUtilization *DropletAutoscaleResourceUtilization `json:"current_utilization,omitempty"`
DropletID uint64 `json:"droplet_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
HealthStatus string `json:"health_status"`
UnhealthyReason string `json:"unhealthy_reason,omitempty"`
Status string `json:"status"`
CurrentUtilization *DropletAutoscaleResourceUtilization `json:"current_utilization,omitempty"`
}

// DropletAutoscaleHistoryEvent represents a DigitalOcean droplet autoscale pool history event
Expand All @@ -90,9 +90,9 @@ type DropletAutoscaleHistoryEvent struct {

// DropletAutoscalePoolRequest represents a DigitalOcean droplet autoscale pool create/update request
type DropletAutoscalePoolRequest struct {
Name string `json:"name"`
AutoscalingConfig *DropletAutoscaleConfiguration `json:"config"`
DropletTemplate *DropletAutoscaleResourceTemplate `json:"droplet_template"`
Name string `json:"name"`
Config *DropletAutoscaleConfiguration `json:"config"`
DropletTemplate *DropletAutoscaleResourceTemplate `json:"droplet_template"`
}

type dropletAutoscalePoolRoot struct {
Expand Down
80 changes: 40 additions & 40 deletions droplet_autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,16 @@ func TestDropletAutoscaler_Get(t *testing.T) {
CooldownMinutes: 5,
},
DropletTemplate: &DropletAutoscaleResourceTemplate{
SizeSlug: "s-1vcpu-512mb-10gb",
RegionSlug: "s2r1",
Image: "547864",
Tags: []string{"test-ag-01"},
SSHKeys: []string{"372862", "367582", "355790"},
VpcUUID: "72b0812c-7535-4388-8507-5ad29b4487b3",
IPV6: true,
UserData: "\n#cloud-config\nruncmd:\n- apt-get update\n- apt-get install -y stress-ng\n",
Size: "s-1vcpu-512mb-10gb",
Region: "s2r1",
Image: "547864",
Tags: []string{"test-ag-01"},
SSHKeys: []string{"372862", "367582", "355790"},
VpcUUID: "72b0812c-7535-4388-8507-5ad29b4487b3",
IPV6: true,
UserData: "\n#cloud-config\nruncmd:\n- apt-get update\n- apt-get install -y stress-ng\n",
},
CurrentUtlization: &DropletAutoscaleResourceUtilization{
CurrentUtilization: &DropletAutoscaleResourceUtilization{
Memory: 0.35,
CPU: 0.0008,
},
Expand Down Expand Up @@ -297,22 +297,22 @@ func TestDropletAutoscaler_List(t *testing.T) {
CooldownMinutes: 5,
}
expectedDropletTemplate := &DropletAutoscaleResourceTemplate{
SizeSlug: "s-1vcpu-512mb-10gb",
RegionSlug: "s2r1",
Image: "547864",
Tags: []string{"test-ag-01"},
SSHKeys: []string{"372862", "367582", "355790"},
VpcUUID: "72b0812c-7535-4388-8507-5ad29b4487b3",
IPV6: true,
UserData: "\n#cloud-config\nruncmd:\n- apt-get update\n- apt-get install -y stress-ng\n",
Size: "s-1vcpu-512mb-10gb",
Region: "s2r1",
Image: "547864",
Tags: []string{"test-ag-01"},
SSHKeys: []string{"372862", "367582", "355790"},
VpcUUID: "72b0812c-7535-4388-8507-5ad29b4487b3",
IPV6: true,
UserData: "\n#cloud-config\nruncmd:\n- apt-get update\n- apt-get install -y stress-ng\n",
}
expectedPoolsResp := []*DropletAutoscalePool{
{
ID: "1044bfca-e490-44a1-aa1c-6f002daf6a13",
Name: "test-autoscalergroup-01",
Config: expectedConfig,
DropletTemplate: expectedDropletTemplate,
CurrentUtlization: &DropletAutoscaleResourceUtilization{
CurrentUtilization: &DropletAutoscaleResourceUtilization{
Memory: 0.35,
CPU: 0.0009,
},
Expand All @@ -323,7 +323,7 @@ func TestDropletAutoscaler_List(t *testing.T) {
Name: "test-autoscalergroup-02",
Config: expectedConfig,
DropletTemplate: expectedDropletTemplate,
CurrentUtlization: &DropletAutoscaleResourceUtilization{
CurrentUtilization: &DropletAutoscaleResourceUtilization{
Memory: 0.56,
CPU: 0.0002,
},
Expand All @@ -334,7 +334,7 @@ func TestDropletAutoscaler_List(t *testing.T) {
Name: "test-autoscalergroup-03",
Config: expectedConfig,
DropletTemplate: expectedDropletTemplate,
CurrentUtlization: &DropletAutoscaleResourceUtilization{
CurrentUtilization: &DropletAutoscaleResourceUtilization{
Memory: 0.33,
CPU: 0.0007,
},
Expand Down Expand Up @@ -370,7 +370,7 @@ func TestDropletAutoscaler_ListMembers(t *testing.T) {
DropletID: 1677149,
HealthStatus: "healthy",
Status: "active",
DropletAutoscaleResourceUtilization: &DropletAutoscaleResourceUtilization{
CurrentUtilization: &DropletAutoscaleResourceUtilization{
Memory: 0.35,
CPU: 0.0012,
},
Expand All @@ -379,7 +379,7 @@ func TestDropletAutoscaler_ListMembers(t *testing.T) {
DropletID: 1677150,
HealthStatus: "healthy",
Status: "active",
DropletAutoscaleResourceUtilization: &DropletAutoscaleResourceUtilization{
CurrentUtilization: &DropletAutoscaleResourceUtilization{
Memory: 0.40,
CPU: 0.0013,
},
Expand Down Expand Up @@ -452,20 +452,20 @@ func TestDropletAutoscaler_Create(t *testing.T) {

createReq := &DropletAutoscalePoolRequest{
Name: "test-autoscalergroup-01",
AutoscalingConfig: &DropletAutoscaleConfiguration{
Config: &DropletAutoscaleConfiguration{
MinInstances: 1,
MaxInstances: 5,
TargetCPUUtilization: 0.5,
},
DropletTemplate: &DropletAutoscaleResourceTemplate{
SizeSlug: "s-1vcpu-512mb-10gb",
RegionSlug: "s2r1",
Image: "547864",
Tags: []string{"test-ag-01"},
SSHKeys: []string{"372862", "367582", "355790"},
VpcUUID: "72b0812c-7535-4388-8507-5ad29b4487b3",
IPV6: true,
UserData: "\n#cloud-config\nruncmd:\n- apt-get update\n- apt-get install -y stress-ng\n",
Size: "s-1vcpu-512mb-10gb",
Region: "s2r1",
Image: "547864",
Tags: []string{"test-ag-01"},
SSHKeys: []string{"372862", "367582", "355790"},
VpcUUID: "72b0812c-7535-4388-8507-5ad29b4487b3",
IPV6: true,
UserData: "\n#cloud-config\nruncmd:\n- apt-get update\n- apt-get install -y stress-ng\n",
},
}

Expand Down Expand Up @@ -495,20 +495,20 @@ func TestDropletAutoscaler_Update(t *testing.T) {

updateReq := &DropletAutoscalePoolRequest{
Name: "test-autoscalergroup-01",
AutoscalingConfig: &DropletAutoscaleConfiguration{
Config: &DropletAutoscaleConfiguration{
MinInstances: 1,
MaxInstances: 5,
TargetCPUUtilization: 0.5,
},
DropletTemplate: &DropletAutoscaleResourceTemplate{
SizeSlug: "s-1vcpu-512mb-10gb",
RegionSlug: "s2r1",
Image: "547864",
Tags: []string{"test-ag-01"},
SSHKeys: []string{"372862", "367582", "355790"},
VpcUUID: "72b0812c-7535-4388-8507-5ad29b4487b3",
IPV6: true,
UserData: "\n#cloud-config\nruncmd:\n- apt-get update\n- apt-get install -y stress-ng\n",
Size: "s-1vcpu-512mb-10gb",
Region: "s2r1",
Image: "547864",
Tags: []string{"test-ag-01"},
SSHKeys: []string{"372862", "367582", "355790"},
VpcUUID: "72b0812c-7535-4388-8507-5ad29b4487b3",
IPV6: true,
UserData: "\n#cloud-config\nruncmd:\n- apt-get update\n- apt-get install -y stress-ng\n",
},
}

Expand Down

0 comments on commit 61f95d4

Please sign in to comment.