Skip to content

Commit

Permalink
Merge pull request #123 from ans-group/loadbalancer-arguments-valuetype
Browse files Browse the repository at this point in the history
Loadbalancer arguments value type
  • Loading branch information
Xiol committed Sep 20, 2022
2 parents 6f719ba + 274f472 commit 2f828b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
37 changes: 15 additions & 22 deletions pkg/service/loadbalancer/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ type ACL struct {

// ACLArgument represents an ACL condition/action argument
type ACLArgument struct {
Name string `json:"name"`
Value string `json:"value"`
Name string `json:"name"`
Value interface{} `json:"value"`
}

// ACLCondition represents an ACL condition
Expand All @@ -257,29 +257,22 @@ type ACLTemplates struct {
}

type ACLTemplateCondition struct {
Name string `json:"name"`
FriendlyName string `json:"friendly_name"`
Description string `json:"description"`
Arguments []ACLTemplateConditionArgument `json:"arguments"`
}

type ACLTemplateConditionArgument struct {
Name string `json:"name"`
Description string `json:"description"`
Example string `json:"example"`
Values []string `json:"values"`
Name string `json:"name"`
FriendlyName string `json:"friendly_name"`
Description string `json:"description"`
Arguments []ACLTemplateArgument `json:"arguments"`
}

type ACLTemplateAction struct {
Name string `json:"name"`
FriendlyName string `json:"friendly_name"`
Description string `json:"description"`
Arguments []ACLTemplateActionArgument `json:"arguments"`
Name string `json:"name"`
FriendlyName string `json:"friendly_name"`
Description string `json:"description"`
Arguments []ACLTemplateArgument `json:"arguments"`
}

type ACLTemplateActionArgument struct {
Name string `json:"name"`
Description string `json:"description"`
Example string `json:"example"`
Values []string `json:"values"`
type ACLTemplateArgument struct {
Name string `json:"name"`
Description string `json:"description"`
Example interface{} `json:"example"`
Values []string `json:"values"`
}
4 changes: 2 additions & 2 deletions pkg/service/loadbalancer/service_listener_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestGetListenerACLs(t *testing.T) {
connection: c,
}

c.EXPECT().Get("/loadbalancers/v2/acls?listener_id=123", gomock.Any()).Return(&connection.APIResponse{
c.EXPECT().Get("/loadbalancers/v2/listeners/123/acls", gomock.Any()).Return(&connection.APIResponse{
Response: &http.Response{
Body: ioutil.NopCloser(bytes.NewReader([]byte("{\"data\":[{\"id\":456}],\"meta\":{\"pagination\":{\"total_pages\":1}}}"))),
StatusCode: 200,
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestGetListenerACLs(t *testing.T) {
connection: c,
}

c.EXPECT().Get("/loadbalancers/v2/acls?listener_id=123", gomock.Any()).Return(&connection.APIResponse{}, errors.New("test error 1"))
c.EXPECT().Get("/loadbalancers/v2/listeners/123/acls", gomock.Any()).Return(&connection.APIResponse{}, errors.New("test error 1"))

_, err := s.GetListenerACLs(123, connection.APIRequestParameters{})

Expand Down
4 changes: 2 additions & 2 deletions pkg/service/loadbalancer/service_targetgroup_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestGetTargetGroupACLs(t *testing.T) {
connection: c,
}

c.EXPECT().Get("/loadbalancers/v2/acls?target_group_id=123", gomock.Any()).Return(&connection.APIResponse{
c.EXPECT().Get("/loadbalancers/v2/target-groups/123/acls", gomock.Any()).Return(&connection.APIResponse{
Response: &http.Response{
Body: ioutil.NopCloser(bytes.NewReader([]byte("{\"data\":[{\"id\":456}],\"meta\":{\"pagination\":{\"total_pages\":1}}}"))),
StatusCode: 200,
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestGetTargetGroupACLs(t *testing.T) {
connection: c,
}

c.EXPECT().Get("/loadbalancers/v2/acls?target_group_id=123", gomock.Any()).Return(&connection.APIResponse{}, errors.New("test error 1"))
c.EXPECT().Get("/loadbalancers/v2/target-groups/123/acls", gomock.Any()).Return(&connection.APIResponse{}, errors.New("test error 1"))

_, err := s.GetTargetGroupACLs(123, connection.APIRequestParameters{})

Expand Down

0 comments on commit 2f828b1

Please sign in to comment.