Skip to content

Commit

Permalink
Merge pull request #55 from lsviben/gmp-management-policies
Browse files Browse the repository at this point in the history
Changed ManagementPolicy to ManagementPolicies
  • Loading branch information
turkenh committed Jul 14, 2023
2 parents 4236bf7 + f65dadc commit 2684f4b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions cmd/angryjet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func GenerateManaged(filename, header string, p *packages.Package) error {
"GetWriteConnectionSecretToReference": method.NewGetWriteConnectionSecretToReference(receiver, RuntimeImport),
"SetPublishConnectionDetailsTo": method.NewSetPublishConnectionDetailsTo(receiver, RuntimeImport),
"GetPublishConnectionDetailsTo": method.NewGetPublishConnectionDetailsTo(receiver, RuntimeImport),
"SetManagementPolicy": method.NewSetManagementPolicy(receiver, RuntimeImport),
"GetManagementPolicy": method.NewGetManagementPolicy(receiver, RuntimeImport),
"SetManagementPolicies": method.NewSetManagementPolicies(receiver, RuntimeImport),
"GetManagementPolicies": method.NewGetManagementPolicies(receiver, RuntimeImport),
"SetDeletionPolicy": method.NewSetDeletionPolicy(receiver, RuntimeImport),
"GetDeletionPolicy": method.NewGetDeletionPolicy(receiver, RuntimeImport),
}
Expand Down
24 changes: 12 additions & 12 deletions cmd/breakingChanges/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func TestBreakingChanges(t *testing.T) {
},
"spec": {
Properties: map[string]v1.JSONSchemaProps{
"managementPolicy": {},
"deletionPolicy": {},
"managementPolicies": {},
"deletionPolicy": {},
"forProvider": {
Properties: map[string]v1.JSONSchemaProps{
"description": {},
Expand Down Expand Up @@ -125,8 +125,8 @@ func TestBreakingChanges(t *testing.T) {
},
"spec": {
Properties: map[string]v1.JSONSchemaProps{
"managementPolicy": {},
"deletionPolicy": {},
"managementPolicies": {},
"deletionPolicy": {},
"forProvider": {
Properties: map[string]v1.JSONSchemaProps{
"description": {},
Expand Down Expand Up @@ -186,8 +186,8 @@ func TestBreakingChanges(t *testing.T) {
Properties: map[string]v1.JSONSchemaProps{
"spec": {
Properties: map[string]v1.JSONSchemaProps{
"deletionPolicy": {},
"managementPolicy": {},
"deletionPolicy": {},
"managementPolicies": {},
"forProvider": {
Properties: map[string]v1.JSONSchemaProps{
"description": {},
Expand All @@ -209,8 +209,8 @@ func TestBreakingChanges(t *testing.T) {
Properties: map[string]v1.JSONSchemaProps{
"spec": {
Properties: map[string]v1.JSONSchemaProps{
"deletionPolicy": {},
"managementPolicy": {},
"deletionPolicy": {},
"managementPolicies": {},
"forProvider": {
Properties: map[string]v1.JSONSchemaProps{
"enableInboundForwarding": {},
Expand Down Expand Up @@ -252,8 +252,8 @@ func TestBreakingChanges(t *testing.T) {
},
"spec": {
Properties: map[string]v1.JSONSchemaProps{
"managementPolicy": {},
"deletionPolicy": {},
"managementPolicies": {},
"deletionPolicy": {},
},
},
},
Expand All @@ -274,8 +274,8 @@ func TestBreakingChanges(t *testing.T) {
},
"spec": {
Properties: map[string]v1.JSONSchemaProps{
"managementPolicy": {},
"deletionPolicy": {},
"managementPolicies": {},
"deletionPolicy": {},
},
},
},
Expand Down
20 changes: 10 additions & 10 deletions internal/method/method.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,24 @@ func NewLocalGetWriteConnectionSecretToReference(receiver, runtime string) New {
}
}

// NewSetManagementPolicy returns a NewMethod that writes a SetManagementPolicy
// NewSetManagementPolicies returns a NewMethod that writes a SetManagementPolicies
// method for the supplied Object to the supplied file.
func NewSetManagementPolicy(receiver, runtime string) New {
func NewSetManagementPolicies(receiver, runtime string) New {
return func(f *jen.File, o types.Object) {
f.Commentf("SetManagementPolicy of this %s.", o.Name())
f.Func().Params(jen.Id(receiver).Op("*").Id(o.Name())).Id("SetManagementPolicy").Params(jen.Id("r").Qual(runtime, "ManagementPolicy")).Block(
jen.Id(receiver).Dot(fields.NameSpec).Dot("ManagementPolicy").Op("=").Id("r"),
f.Commentf("SetManagementPolicies of this %s.", o.Name())
f.Func().Params(jen.Id(receiver).Op("*").Id(o.Name())).Id("SetManagementPolicies").Params(jen.Id("r").Qual(runtime, "ManagementPolicies")).Block(
jen.Id(receiver).Dot(fields.NameSpec).Dot("ManagementPolicies").Op("=").Id("r"),
)
}
}

// NewGetManagementPolicy returns a NewMethod that writes a GetManagementPolicy
// NewGetManagementPolicies returns a NewMethod that writes a GetManagementPolicies
// method for the supplied Object to the supplied file.
func NewGetManagementPolicy(receiver, runtime string) New {
func NewGetManagementPolicies(receiver, runtime string) New {
return func(f *jen.File, o types.Object) {
f.Commentf("GetManagementPolicy of this %s.", o.Name())
f.Func().Params(jen.Id(receiver).Op("*").Id(o.Name())).Id("GetManagementPolicy").Params().Qual(runtime, "ManagementPolicy").Block(
jen.Return(jen.Id(receiver).Dot(fields.NameSpec).Dot("ManagementPolicy")),
f.Commentf("GetManagementPolicies of this %s.", o.Name())
f.Func().Params(jen.Id(receiver).Op("*").Id(o.Name())).Id("GetManagementPolicies").Params().Qual(runtime, "ManagementPolicies").Block(
jen.Return(jen.Id(receiver).Dot(fields.NameSpec).Dot("ManagementPolicies")),
)
}
}
Expand Down
24 changes: 12 additions & 12 deletions internal/method/method_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,37 +279,37 @@ func (t *Type) GetWriteConnectionSecretToReference() *runtime.LocalSecretReferen
}
}

func TestNewSetManagementPolicy(t *testing.T) {
func TestNewSetManagementPolicies(t *testing.T) {
want := `package pkg
import runtime "example.org/runtime"
// SetManagementPolicy of this Type.
func (t *Type) SetManagementPolicy(r runtime.ManagementPolicy) {
t.Spec.ManagementPolicy = r
// SetManagementPolicies of this Type.
func (t *Type) SetManagementPolicies(r runtime.ManagementPolicies) {
t.Spec.ManagementPolicies = r
}
`
f := jen.NewFilePath("pkg")
NewSetManagementPolicy("t", "example.org/runtime")(f, MockObject{Named: "Type"})
NewSetManagementPolicies("t", "example.org/runtime")(f, MockObject{Named: "Type"})
if diff := cmp.Diff(want, fmt.Sprintf("%#v", f)); diff != "" {
t.Errorf("NewSetManagementPolicy(): -want, +got\n%s", diff)
t.Errorf("NewSetManagementPolicies(): -want, +got\n%s", diff)
}
}

func TestNewGetManagementPolicy(t *testing.T) {
func TestNewGetManagementPolicies(t *testing.T) {
want := `package pkg
import runtime "example.org/runtime"
// GetManagementPolicy of this Type.
func (t *Type) GetManagementPolicy() runtime.ManagementPolicy {
return t.Spec.ManagementPolicy
// GetManagementPolicies of this Type.
func (t *Type) GetManagementPolicies() runtime.ManagementPolicies {
return t.Spec.ManagementPolicies
}
`
f := jen.NewFilePath("pkg")
NewGetManagementPolicy("t", "example.org/runtime")(f, MockObject{Named: "Type"})
NewGetManagementPolicies("t", "example.org/runtime")(f, MockObject{Named: "Type"})
if diff := cmp.Diff(want, fmt.Sprintf("%#v", f)); diff != "" {
t.Errorf("NewGetManagementPolicy(): -want, +got\n%s", diff)
t.Errorf("NewGetManagementPolicies(): -want, +got\n%s", diff)
}
}

Expand Down

0 comments on commit 2684f4b

Please sign in to comment.