Skip to content

Commit

Permalink
merge cfnetworking updates from main
Browse files Browse the repository at this point in the history
  • Loading branch information
jcvrabo committed Jan 6, 2025
1 parent 6d5bbf7 commit 4b2d312
Show file tree
Hide file tree
Showing 30 changed files with 531 additions and 273 deletions.
2 changes: 1 addition & 1 deletion actor/cfnetworkingaction/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"errors"
"fmt"

"code.cloudfoundry.org/cli/v8/api/cfnetworking/cfnetv1"
"code.cloudfoundry.org/cli/v8/api/cloudcontroller/ccv3"
"code.cloudfoundry.org/cli/v8/api/cloudcontroller/ccv3/constant"
"code.cloudfoundry.org/cli/v8/resources"
"code.cloudfoundry.org/cli/v8/util/batcher"

"code.cloudfoundry.org/cfnetworking-cli-api/cfnetworking/cfnetv1"
"code.cloudfoundry.org/cli/v8/actor/actionerror"
. "code.cloudfoundry.org/cli/v8/actor/cfnetworkingaction"
"code.cloudfoundry.org/cli/v8/actor/cfnetworkingaction/cfnetworkingactionfakes"
Expand Down
2 changes: 1 addition & 1 deletion api/cfnetworking/cfnetv1/cfnetv1_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

. "code.cloudfoundry.org/cli/v8/api/cfnetworking/cfnetv1"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/ghttp"
)
Expand Down
70 changes: 48 additions & 22 deletions api/cfnetworking/cfnetv1/cfnetv1fakes/fake_connection_wrapper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions api/cfnetworking/cfnetv1/cfvnetv1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package cfnetv1

//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
4 changes: 2 additions & 2 deletions api/cfnetworking/cfnetv1/connection_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package cfnetv1

import "code.cloudfoundry.org/cli/v8/api/cfnetworking"

//go:generate counterfeiter . ConnectionWrapper

// ConnectionWrapper can wrap a given connection allowing the wrapper to modify
// all requests going in and out of the given connection.
//
//counterfeiter:generate . ConnectionWrapper
type ConnectionWrapper interface {
cfnetworking.Connection
Wrap(innerconnection cfnetworking.Connection) cfnetworking.Connection
Expand Down
6 changes: 3 additions & 3 deletions api/cfnetworking/cfnetv1/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type PolicyDestination struct {
}

// CreatePolicies will create the network policy with the given parameters.
func (client Client) CreatePolicies(policies []Policy) error {
func (client *Client) CreatePolicies(policies []Policy) error {
rawJSON, err := json.Marshal(PolicyList{Policies: policies})
if err != nil {
return err
Expand All @@ -55,7 +55,7 @@ func (client Client) CreatePolicies(policies []Policy) error {
}

// ListPolicies will list the policies with the app guids in either the source or destination.
func (client Client) ListPolicies(appGUIDs ...string) ([]Policy, error) {
func (client *Client) ListPolicies(appGUIDs ...string) ([]Policy, error) {
var request *cfnetworking.Request
var err error
if len(appGUIDs) == 0 {
Expand Down Expand Up @@ -91,7 +91,7 @@ func (client Client) ListPolicies(appGUIDs ...string) ([]Policy, error) {
}

// RemovePolicies will remove the network policy with the given parameters.
func (client Client) RemovePolicies(policies []Policy) error {
func (client *Client) RemovePolicies(policies []Policy) error {
rawJSON, err := json.Marshal(PolicyList{Policies: policies})
if err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions api/cfnetworking/cfnetv1/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package cfnetv1_test
import (
"net/http"

. "code.cloudfoundry.org/cfnetworking-cli-api/cfnetworking/cfnetv1"
"code.cloudfoundry.org/cfnetworking-cli-api/cfnetworking/networkerror"
. "github.com/onsi/ginkgo"
. "code.cloudfoundry.org/cli/v8/api/cfnetworking/cfnetv1"
"code.cloudfoundry.org/cli/v8/api/cfnetworking/networkerror"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/ghttp"
)
Expand Down
6 changes: 6 additions & 0 deletions api/cfnetworking/cfnetworking.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// CF networking API. Copied from code.cloudfoundry.org/cfnetworking-cli-api
// to reduce recursive dependencies and allow proper go module management.

package cfnetworking

//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
2 changes: 1 addition & 1 deletion api/cfnetworking/cfnetworking_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/ghttp"
)
Expand Down
37 changes: 25 additions & 12 deletions api/cfnetworking/cfnetworkingfakes/fake_connection.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4b2d312

Please sign in to comment.