Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LBAAS-2321 Add project_id to load balancers structs #568

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions load_balancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type LoadBalancer struct {
VPCUUID string `json:"vpc_uuid,omitempty"`
DisableLetsEncryptDNSRecords *bool `json:"disable_lets_encrypt_dns_records,omitempty"`
ValidateOnly bool `json:"validate_only,omitempty"`
ProjectID string `json:"project_id,omitempty"`
}

// String creates a human-readable description of a LoadBalancer.
Expand Down Expand Up @@ -81,6 +82,7 @@ func (l LoadBalancer) AsRequest() *LoadBalancerRequest {
VPCUUID: l.VPCUUID,
DisableLetsEncryptDNSRecords: l.DisableLetsEncryptDNSRecords,
ValidateOnly: l.ValidateOnly,
ProjectID: l.ProjectID,
}

if l.DisableLetsEncryptDNSRecords != nil {
Expand Down Expand Up @@ -165,6 +167,7 @@ type LoadBalancerRequest struct {
VPCUUID string `json:"vpc_uuid,omitempty"`
DisableLetsEncryptDNSRecords *bool `json:"disable_lets_encrypt_dns_records,omitempty"`
ValidateOnly bool `json:"validate_only,omitempty"`
ProjectID string `json:"project_id,omitempty"`
}

// String creates a human-readable description of a LoadBalancerRequest.
Expand Down
20 changes: 16 additions & 4 deletions load_balancers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ var lbListJSONResponse = `
2,
21
],
"disable_lets_encrypt_dns_records": true
"disable_lets_encrypt_dns_records": true,
"project_id": "6929eef6-4e45-11ed-bdc3-0242ac120002"
}
],
"links":{
Expand Down Expand Up @@ -148,7 +149,8 @@ var lbCreateJSONResponse = `
],
"redirect_http_to_https":true,
"vpc_uuid":"880b7f98-f062-404d-b33c-458d545696f6",
"disable_lets_encrypt_dns_records": true
"disable_lets_encrypt_dns_records": true,
"project_id": "6929eef6-4e45-11ed-bdc3-0242ac120002"
}
}
`
Expand Down Expand Up @@ -209,7 +211,8 @@ var lbGetJSONResponse = `
2,
21
],
"disable_lets_encrypt_dns_records": false
"disable_lets_encrypt_dns_records": false,
"project_id": "6929eef6-4e45-11ed-bdc3-0242ac120002"
}
}
`
Expand Down Expand Up @@ -274,7 +277,8 @@ var lbUpdateJSONResponse = `
"droplet_ids":[
2,
21
]
],
"project_id": "6929eef6-4e45-11ed-bdc3-0242ac120002"
}
}
`
Expand Down Expand Up @@ -333,6 +337,7 @@ func TestLoadBalancers_Get(t *testing.T) {
Features: []string{"private_networking", "backups", "ipv6", "metadata", "storage"},
},
DropletIDs: []int{2, 21},
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
}

disableLetsEncryptDNSRecords := false
Expand Down Expand Up @@ -377,6 +382,7 @@ func TestLoadBalancers_Create(t *testing.T) {
DropletIDs: []int{2, 21},
RedirectHttpToHttps: true,
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
}

path := "/v2/load_balancers"
Expand Down Expand Up @@ -445,6 +451,7 @@ func TestLoadBalancers_Create(t *testing.T) {
DropletIDs: []int{2, 21},
RedirectHttpToHttps: true,
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
}

disableLetsEncryptDNSRecords := true
Expand Down Expand Up @@ -609,6 +616,7 @@ func TestLoadBalancers_Update(t *testing.T) {
Type: "none",
},
DropletIDs: []int{2, 21},
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
}

path := "/v2/load_balancers"
Expand Down Expand Up @@ -675,6 +683,7 @@ func TestLoadBalancers_Update(t *testing.T) {
},
DropletIDs: []int{2, 21},
DisableLetsEncryptDNSRecords: nil,
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
}

assert.Equal(t, expected, loadBalancer)
Expand Down Expand Up @@ -733,6 +742,7 @@ func TestLoadBalancers_List(t *testing.T) {
Features: []string{"private_networking", "backups", "ipv6", "metadata", "storage"},
},
DropletIDs: []int{2, 21},
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
},
}
disableLetsEncryptDNSRecords := true
Expand Down Expand Up @@ -949,6 +959,7 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
EnableProxyProtocol: true,
EnableBackendKeepalive: true,
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
ValidateOnly: true,
}
lb.DropletIDs = make([]int, 1, 2)
Expand Down Expand Up @@ -991,6 +1002,7 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
EnableProxyProtocol: true,
EnableBackendKeepalive: true,
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
ValidateOnly: true,
}

Expand Down