From 6779603bb94b1d3e88a758a2e806cc817cc83e43 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Tue, 19 Apr 2022 17:46:20 +1000 Subject: [PATCH 1/2] feat: remove billinggroups --- .../client/_lgraphql/addBillingGroup.graphql | 13 --- .../addProjectToBillingGroup.graphql | 11 -- .../client/_lgraphql/projectByName.graphql | 8 -- internal/lagoon/client/lgraphql/lgraphql.go | 50 +------- internal/lagoon/client/mutation.go | 28 ----- internal/lagoon/import.go | 33 ------ internal/lagoon/import_test.go | 23 ---- .../lagoon/testdata/exhaustive.import.yaml | 6 - internal/mock/mock_importer.go | 28 ----- internal/schema/config.go | 21 +--- internal/schema/config_test.go | 8 -- internal/schema/group.go | 25 +--- internal/schema/project.go | 9 -- .../testdata/noBillingGroups.golden.yaml | 37 ------ internal/schema/testdata/noBillingGroups.json | 103 ----------------- .../testdata/withBillingGroups.golden.yaml | 43 ------- .../schema/testdata/withBillingGroups.json | 108 ------------------ 17 files changed, 7 insertions(+), 547 deletions(-) delete mode 100644 internal/lagoon/client/_lgraphql/addBillingGroup.graphql delete mode 100644 internal/lagoon/client/_lgraphql/addProjectToBillingGroup.graphql delete mode 100644 internal/schema/testdata/noBillingGroups.golden.yaml delete mode 100644 internal/schema/testdata/noBillingGroups.json delete mode 100644 internal/schema/testdata/withBillingGroups.golden.yaml delete mode 100644 internal/schema/testdata/withBillingGroups.json diff --git a/internal/lagoon/client/_lgraphql/addBillingGroup.graphql b/internal/lagoon/client/_lgraphql/addBillingGroup.graphql deleted file mode 100644 index 3f399814..00000000 --- a/internal/lagoon/client/_lgraphql/addBillingGroup.graphql +++ /dev/null @@ -1,13 +0,0 @@ -mutation ( - $name: String!, - $currency: Currency!, - $billingSoftware: String) { - addBillingGroup(input: { - name: $name, - currency: $currency, - billingSoftware: $billingSoftware - }) { - id - name - } - } diff --git a/internal/lagoon/client/_lgraphql/addProjectToBillingGroup.graphql b/internal/lagoon/client/_lgraphql/addProjectToBillingGroup.graphql deleted file mode 100644 index a9485d10..00000000 --- a/internal/lagoon/client/_lgraphql/addProjectToBillingGroup.graphql +++ /dev/null @@ -1,11 +0,0 @@ -mutation ( - $group: GroupInput!, - $project: ProjectInput!) { - addProjectToBillingGroup(input: { - group: $group, - project: $project - }) { - id - name - } - } diff --git a/internal/lagoon/client/_lgraphql/projectByName.graphql b/internal/lagoon/client/_lgraphql/projectByName.graphql index fe421216..3a7f1c69 100644 --- a/internal/lagoon/client/_lgraphql/projectByName.graphql +++ b/internal/lagoon/client/_lgraphql/projectByName.graphql @@ -36,14 +36,6 @@ query ( role } } - {{ if apiVerGreaterThanOrEqual . "1.2.0" }} - ... on BillingGroup { - __typename - name - currency - billingSoftware - } - {{ end }} } notifications { ... on NotificationSlack { diff --git a/internal/lagoon/client/lgraphql/lgraphql.go b/internal/lagoon/client/lgraphql/lgraphql.go index 39133536..4fdcb1c0 100644 --- a/internal/lagoon/client/lgraphql/lgraphql.go +++ b/internal/lagoon/client/lgraphql/lgraphql.go @@ -1,7 +1,6 @@ // Code generated by go-bindata. (@generated) DO NOT EDIT. - //Package lgraphql generated by go-bindata.// sources: -// _lgraphql/addBillingGroup.graphql +//Package lgraphql generated by go-bindata.// sources: // _lgraphql/addDeployTargetConfig.graphql // _lgraphql/addEnvVariable.graphql // _lgraphql/addGroup.graphql @@ -13,7 +12,6 @@ // _lgraphql/addNotificationToProject.graphql // _lgraphql/addOrUpdateEnvironment.graphql // _lgraphql/addProject.graphql -// _lgraphql/addProjectToBillingGroup.graphql // _lgraphql/addRestore.graphql // _lgraphql/addSshKey.graphql // _lgraphql/addUser.graphql @@ -114,26 +112,6 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var __lgraphqlAddbillinggroupGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x01\x89\x24\x97\x16\x15\xa5\xe6\x25\x57\x5a\x29\x38\x43\x59\x10\xf1\xa4\xcc\x9c\x9c\xcc\xbc\xf4\xe0\xfc\xb4\x92\xf2\xc4\x22\xb8\x26\x4d\x85\x6a\x2e\x05\x05\x05\x85\xc4\x94\x14\x27\x88\x0a\xf7\xa2\xfc\xd2\x02\x8d\xcc\xbc\x82\xd2\x12\x2b\xa8\xa4\x82\x02\xc4\x1e\xb0\x75\x3a\x50\x21\x84\x45\x70\x3b\x61\x52\x18\x76\xa1\xdb\x0e\x56\x57\xab\x09\x37\x3e\x33\x05\xc9\x1e\x88\x24\x17\x08\x03\x02\x00\x00\xff\xff\x90\xae\x83\xc3\xed\x00\x00\x00") - -func _lgraphqlAddbillinggroupGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlAddbillinggroupGraphql, - "_lgraphql/addBillingGroup.graphql", - ) -} - -func _lgraphqlAddbillinggroupGraphql() (*asset, error) { - bytes, err := _lgraphqlAddbillinggroupGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/addBillingGroup.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - var __lgraphqlAdddeploytargetconfigGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x90\x41\x4e\xc3\x30\x10\x45\xf7\x3d\x85\x91\x58\xb4\x57\xc8\x16\x36\x6c\x50\x04\x5c\xc0\xc4\x53\x77\x90\x3b\x0e\xd3\x31\xa8\x42\xb9\x3b\x6a\x9c\xd8\xb1\x13\xd5\xcb\xff\xff\xcc\xf8\xfd\x73\x10\x2d\xe8\x49\xed\x77\x4a\x29\xf5\xd8\xb3\xff\x82\x4e\x1a\xf5\x42\xf2\x10\xa5\x5f\x40\x7b\x8a\x4a\x14\x3e\x59\x53\x77\x82\x4b\xa3\xde\x85\x91\xec\x34\x19\x9c\x63\xf8\x0e\x70\x91\xca\x31\xd0\x3b\x7f\xfd\xd0\x6c\xa1\x58\xbc\xd4\xdb\x78\xb7\xd5\x22\xc0\x94\xe6\x0f\x7f\x63\x54\x1b\xf3\xbc\x08\x3f\x79\x3a\xa2\xdd\x23\xf5\x41\x9a\x98\xb8\xbd\xf2\x4e\xb1\x3e\x65\x66\x98\x89\x2a\xe9\x99\x29\xe1\x25\xaf\x24\x2b\x40\x73\x66\xee\x6d\x6e\x70\xf3\x57\x35\xe5\x9d\x0a\xc6\xf9\xe1\x90\xe9\xd0\x6c\xae\xcc\x81\x2a\x74\x7b\xa4\xcf\x50\x08\x47\x46\x20\xe3\xae\xaf\xb5\xd1\x39\x1f\x4c\xcb\xfe\x07\x0d\xf0\xda\x79\x03\x8b\x9e\x92\x3e\xac\x7a\xdb\x2c\xab\x6a\x3d\x22\xed\x86\xff\x00\x00\x00\xff\xff\xbe\x7e\x9c\x20\x74\x02\x00\x00") func _lgraphqlAdddeploytargetconfigGraphqlBytes() ([]byte, error) { @@ -354,26 +332,6 @@ func _lgraphqlAddprojectGraphql() (*asset, error) { return a, nil } -var __lgraphqlAddprojecttobillinggroupGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\x49\x2f\xca\x2f\x2d\xb0\x52\x70\x07\x51\x9e\x79\x05\xa5\x25\x8a\x3a\x20\xe1\x82\xa2\xfc\xac\xd4\xe4\x12\x2b\x85\x00\x08\x03\x22\xa5\xa9\x50\xcd\xa5\xa0\xa0\xa0\x90\x98\x92\x02\x15\x0f\xc9\x77\xca\xcc\xc9\xc9\xcc\x4b\x07\x1b\xa0\x91\x09\x52\x66\x05\x55\xa5\xa0\x00\x35\x1c\x62\x89\x0e\x54\x10\x6e\x34\xcc\x12\xb0\x78\xad\x26\x5c\x57\x66\x0a\x94\x91\x97\x98\x9b\x0a\x91\xe4\x02\x61\x40\x00\x00\x00\xff\xff\x98\x52\x69\x5c\xb9\x00\x00\x00") - -func _lgraphqlAddprojecttobillinggroupGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlAddprojecttobillinggroupGraphql, - "_lgraphql/addProjectToBillingGroup.graphql", - ) -} - -func _lgraphqlAddprojecttobillinggroupGraphql() (*asset, error) { - bytes, err := _lgraphqlAddprojecttobillinggroupGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/addProjectToBillingGroup.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - var __lgraphqlAddrestoreGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\x49\x4a\x4c\xce\x2e\x2d\xc8\x4c\xb1\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x48\x4c\x49\x09\x4a\x2d\x2e\xc9\x2f\x4a\xd5\xc8\xcc\x2b\x28\x2d\xb1\x52\xa8\x86\xa8\xf5\x4c\xb1\x42\x68\xab\x85\x29\x57\x50\xc8\x4c\x01\x33\x6a\xb9\x40\x18\x10\x00\x00\xff\xff\xdc\x18\x6c\xe7\x65\x00\x00\x00") func _lgraphqlAddrestoreGraphqlBytes() ([]byte, error) { @@ -694,7 +652,7 @@ func _lgraphqlMinimalprojectbynameGraphql() (*asset, error) { return a, nil } -var __lgraphqlProjectbynameGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x55\x4f\x6f\xdb\x3e\x0c\xbd\xf7\x53\xf0\x57\xfc\x0e\xdd\xc5\xd8\x76\xdc\x6d\xed\x8a\x6e\xe8\x96\x05\x49\x96\x6b\xc1\xc8\x74\xac\x45\x96\x1c\x8a\x76\x61\x04\xf9\xee\x83\x13\xd4\x96\xff\x24\x0d\xd0\x61\xba\x84\x79\x8f\x26\x9f\x48\x89\xda\x16\xc4\x15\xdc\x5c\x01\xfc\x6f\x31\xa3\x4f\x30\x17\xd6\x76\xfd\xdf\x3b\xd8\x5d\x01\x00\xe4\xec\x7e\x93\x92\xdb\x6a\x82\x19\xdd\x1c\x20\x80\xa3\xe7\xe1\x83\x17\xbf\x7a\xe9\xb8\x31\x6b\xaa\xf9\x83\x85\xb8\x6f\xb1\x69\x81\x15\xa3\x55\x29\xf9\x06\xc8\x0b\x63\x98\xb6\x05\x79\x09\x40\xd6\x25\x0a\x3d\x52\x15\x40\x2e\x2e\x94\x68\x67\xef\x6d\xa9\xd9\xd9\x8c\xac\xb4\x79\x94\xe8\x92\xe6\x95\x17\xca\xfc\x17\xca\x8d\xab\xc6\xb9\x05\xfa\xcd\x38\x33\xa3\xcc\x95\x34\xce\x4d\xd9\x65\x4e\x5a\xd2\x8b\x63\x5c\xd3\x1d\x1a\xd5\x60\x2e\x27\xeb\x53\x9d\xc8\xf4\x58\xb7\x29\x8a\x10\xdb\x86\x8f\xa9\x24\xe3\xf2\x5a\x76\xb0\x03\xff\x5d\x67\xba\xdd\xc7\x5a\xcb\x2f\x36\xa7\xcb\xb7\x66\x57\xe4\xbe\xad\x3b\x40\x14\x45\xe0\x2c\x3c\xd4\x04\x84\x04\xc0\xd3\x93\x54\x39\x75\xfa\x31\x68\x50\xbd\x32\xca\x56\xc4\xbe\xfb\x31\x40\xe1\x89\xfb\x18\x00\x65\xa8\xcd\x00\xf5\x3e\x7d\xa4\x6a\x10\x62\x34\xdd\x71\x6d\xa8\x5a\x54\xf9\x09\x66\x89\xa6\x18\x52\xfb\x01\x92\x68\xf6\x32\x19\x4b\x60\x70\x94\xe8\x87\x60\x67\xba\x2e\xa1\x43\x68\xef\x76\xa0\x13\xc0\x5c\x2f\x89\x1f\x98\x50\x88\x17\x29\xda\x9f\x7c\xbf\x2d\xd0\x40\x04\xd7\x1f\xa2\x8f\xd1\xfb\x6b\xd8\xef\x87\xcd\xb9\xd5\xc6\x68\xbb\x7e\x4b\x8f\x54\xc1\x4c\x56\x55\x1d\x70\x75\x8c\x3b\x77\x89\x3c\x23\xd3\x69\xe9\x64\xe3\x50\x58\x6b\x59\x27\x3a\xd1\x0a\xeb\x7b\xe5\x61\xe4\x5c\x4d\x02\x87\xb9\x41\xb5\xb9\x4c\xff\x33\xad\x52\xe7\x36\xaf\xec\x29\x45\x6b\xc9\x9c\x90\x3d\x22\x60\xe6\xd4\x86\xe4\x2e\x45\xf9\x67\x2a\xde\xd4\xf7\x50\xfb\x7d\x7d\x6f\x2e\x93\x7d\xb8\x62\x9f\xe3\x98\xc9\xfb\x73\xda\x5f\xc9\xf8\x43\x2b\x76\xde\x25\xb2\x20\xcc\xfc\x5f\xab\xd8\xa5\x47\xab\x99\x87\x61\xe2\xe0\x9d\x68\x3d\xc9\x96\x4b\x64\x8d\x2b\x43\x5d\x99\xbd\xcc\x5e\xb9\xce\xc0\x28\x3b\x53\xa2\x13\xaf\x19\xaf\xe7\xe2\xc5\x87\x77\xa2\x37\x85\x8e\xe0\x2d\x7a\x9a\x51\x32\xc0\xbf\x12\xc6\x63\xf8\x42\x4b\x67\x90\x04\x12\x7a\xf1\xfb\xcf\x44\x6f\x48\x0d\x26\xfe\x99\xf2\x8c\x1c\xe6\x7e\x89\xfa\x45\x0a\xcb\xf4\x62\xd5\xbf\xfb\xab\x3f\x01\x00\x00\xff\xff\x88\xc1\x98\xb6\x0e\x08\x00\x00") +var __lgraphqlProjectbynameGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x54\x4d\x6f\xd3\x4c\x10\xbe\xf7\x57\xcc\x5b\xbd\x87\x72\xb1\x80\x23\x37\x5a\xaa\x82\x0a\x21\x4a\x42\xae\xd5\xc4\x1e\xc7\x4b\xd6\x3b\xce\xec\xd8\xc8\x8a\xf2\xdf\x91\x13\xe1\xcf\x6d\xda\x03\x62\x2f\xd9\x3c\xcf\x78\xe6\xd9\xf9\xda\x97\x24\x35\xdc\x5c\x01\xfc\xef\x30\xa7\x0f\xb0\x54\x31\x6e\xfb\xdf\x1b\x38\x5c\x01\x00\x14\xc2\x3f\x29\xd6\xdb\x7a\x86\x39\xdd\x9c\x20\x80\xb3\xe5\xe9\x83\x3f\x76\xcd\x31\x49\x7b\x6d\xa8\xf6\x0f\x96\xca\x5f\x12\xdb\x01\x1b\x41\x17\x67\xe4\x5b\xa0\x28\xad\x15\xda\x97\xe4\xb5\x07\x8a\xa9\x50\xe9\x91\xea\x1e\xc4\x49\x19\xab\x61\x77\xef\x2a\x23\xec\x72\x72\xda\xc5\x89\xd5\x54\xb4\xac\xbd\x52\xee\x3f\x51\x61\xb9\x0e\x73\x2b\xf4\xbb\x30\xb3\xa0\x9c\x2b\x0a\x73\x73\xe1\x9c\xb5\x23\xbd\xb2\xe0\x96\xee\xd0\xc6\x2d\xc6\x05\x39\x9f\x99\x54\xe7\xe7\xbc\xcd\x51\x95\xc4\xb5\x7c\x42\x15\x59\x2e\x1a\xd9\xbd\x17\xf8\xaf\x26\x37\xdd\x3b\xb6\x46\x7f\x88\x7d\x3e\x7d\x5b\xe1\xb2\xf0\x5d\xde\x01\xa2\x28\x02\x76\xf0\xd0\x10\xd0\x27\x00\x9e\x9e\xb4\x2e\x68\x50\x8f\x49\x81\x9a\x93\x53\xbe\x21\xf1\xc3\x8f\x01\x4a\x4f\x32\xc6\x00\x28\x47\x63\x27\xa8\xf7\xd9\x23\xd5\x13\x17\xc1\x70\xe7\xb3\xa3\x7a\x55\x17\xcf\x30\x6b\xb4\xe5\x94\x3a\x4e\x90\xd4\x88\xd7\x59\x28\x80\xc5\x20\x31\x76\x21\x6c\x87\x26\x7d\x83\xee\xde\xdd\x1c\xab\x49\x4d\x8c\x4d\x23\x7a\x08\x14\x62\xd6\x33\x58\x5a\x8c\x77\xaf\x2b\xca\x2f\xda\x64\xcc\xbb\xcb\x85\x8a\x33\x74\x8e\x6c\x50\x62\x50\xc0\x82\xe3\x1d\xe9\x5d\x86\xfa\xcf\x54\x1c\x0e\x60\x52\xc0\xc2\xac\x49\x1e\x84\x50\x49\x56\x19\xba\xef\x72\xbf\x2f\xd1\x42\x04\xd7\xef\xa2\xf7\xd1\xdb\x6b\x38\xbe\xa0\xfd\xbe\x69\xb4\xd7\xc9\x3e\xf5\xe4\xc7\x24\x11\xf2\xfe\x92\xf6\x17\x22\x7e\x33\xb1\xb0\xe7\x54\x57\x84\xb9\xff\x6b\x19\x1b\x65\x87\x5c\xd2\x7f\xfb\x71\xba\x40\xfa\x81\x7b\x8b\xb5\xb3\x24\x57\xad\x51\x0c\x6e\x2c\x0d\x65\x8e\x22\xfb\x98\x07\x13\x56\x0d\xc6\x6a\xe0\xaf\xdd\x47\x97\xfc\x25\xa7\xc5\x3a\x1a\xdb\x33\x78\x8b\x9e\x16\x94\x4e\xf0\xcf\x84\x49\x08\x5f\x19\x1d\x4c\x5e\x4f\xc2\xc8\xff\x78\xaf\x8e\xa6\x7a\xb2\x22\x2f\xa4\x27\xd0\xcc\xe3\x14\x8d\x93\x14\xda\x02\xcd\xef\xf1\xea\x77\x00\x00\x00\xff\xff\x6d\x0c\x95\x26\x3f\x07\x00\x00") func _lgraphqlProjectbynameGraphqlBytes() ([]byte, error) { return bindataRead( @@ -906,7 +864,6 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "_lgraphql/addBillingGroup.graphql": _lgraphqlAddbillinggroupGraphql, "_lgraphql/addDeployTargetConfig.graphql": _lgraphqlAdddeploytargetconfigGraphql, "_lgraphql/addEnvVariable.graphql": _lgraphqlAddenvvariableGraphql, "_lgraphql/addGroup.graphql": _lgraphqlAddgroupGraphql, @@ -918,7 +875,6 @@ var _bindata = map[string]func() (*asset, error){ "_lgraphql/addNotificationToProject.graphql": _lgraphqlAddnotificationtoprojectGraphql, "_lgraphql/addOrUpdateEnvironment.graphql": _lgraphqlAddorupdateenvironmentGraphql, "_lgraphql/addProject.graphql": _lgraphqlAddprojectGraphql, - "_lgraphql/addProjectToBillingGroup.graphql": _lgraphqlAddprojecttobillinggroupGraphql, "_lgraphql/addRestore.graphql": _lgraphqlAddrestoreGraphql, "_lgraphql/addSshKey.graphql": _lgraphqlAddsshkeyGraphql, "_lgraphql/addUser.graphql": _lgraphqlAdduserGraphql, @@ -987,7 +943,6 @@ type bintree struct { var _bintree = &bintree{nil, map[string]*bintree{ "_lgraphql": &bintree{nil, map[string]*bintree{ - "addBillingGroup.graphql": &bintree{_lgraphqlAddbillinggroupGraphql, map[string]*bintree{}}, "addDeployTargetConfig.graphql": &bintree{_lgraphqlAdddeploytargetconfigGraphql, map[string]*bintree{}}, "addEnvVariable.graphql": &bintree{_lgraphqlAddenvvariableGraphql, map[string]*bintree{}}, "addGroup.graphql": &bintree{_lgraphqlAddgroupGraphql, map[string]*bintree{}}, @@ -999,7 +954,6 @@ var _bintree = &bintree{nil, map[string]*bintree{ "addNotificationToProject.graphql": &bintree{_lgraphqlAddnotificationtoprojectGraphql, map[string]*bintree{}}, "addOrUpdateEnvironment.graphql": &bintree{_lgraphqlAddorupdateenvironmentGraphql, map[string]*bintree{}}, "addProject.graphql": &bintree{_lgraphqlAddprojectGraphql, map[string]*bintree{}}, - "addProjectToBillingGroup.graphql": &bintree{_lgraphqlAddprojecttobillinggroupGraphql, map[string]*bintree{}}, "addRestore.graphql": &bintree{_lgraphqlAddrestoreGraphql, map[string]*bintree{}}, "addSshKey.graphql": &bintree{_lgraphqlAddsshkeyGraphql, map[string]*bintree{}}, "addUser.graphql": &bintree{_lgraphqlAdduserGraphql, map[string]*bintree{}}, diff --git a/internal/lagoon/client/mutation.go b/internal/lagoon/client/mutation.go index f13320e6..266c4023 100644 --- a/internal/lagoon/client/mutation.go +++ b/internal/lagoon/client/mutation.go @@ -205,34 +205,6 @@ func (c *Client) AddNotificationToProject(ctx context.Context, }) } -// AddBillingGroup adds a Billing Group. -func (c *Client) AddBillingGroup(ctx context.Context, - in *schema.AddBillingGroupInput, out *schema.BillingGroup) error { - req, err := c.newRequest("_lgraphql/addBillingGroup.graphql", in) - if err != nil { - return err - } - return c.client.Run(ctx, req, &struct { - Response *schema.BillingGroup `json:"addBillingGroup"` - }{ - Response: out, - }) -} - -// AddProjectToBillingGroup adds a Project to a Billing Group. -func (c *Client) AddProjectToBillingGroup(ctx context.Context, - in *schema.ProjectBillingGroupInput, out *schema.Project) error { - req, err := c.newRequest("_lgraphql/addProjectToBillingGroup.graphql", in) - if err != nil { - return err - } - return c.client.Run(ctx, req, &struct { - Response *schema.Project `json:"addProjectToBillingGroup"` - }{ - Response: out, - }) -} - // DeployEnvironmentLatest deploys a latest environment. func (c *Client) DeployEnvironmentLatest(ctx context.Context, in *schema.DeployEnvironmentLatestInput, out *schema.DeployEnvironmentLatest) error { diff --git a/internal/lagoon/import.go b/internal/lagoon/import.go index 9d71263e..bbfd9892 100644 --- a/internal/lagoon/import.go +++ b/internal/lagoon/import.go @@ -48,10 +48,6 @@ type Importer interface { context.Context, *schema.ProjectGroupsInput, *schema.Project) error AddNotificationToProject(context.Context, *schema.AddNotificationToProjectInput, *schema.Project) error - AddBillingGroup( - context.Context, *schema.AddBillingGroupInput, *schema.BillingGroup) error - AddProjectToBillingGroup(context.Context, *schema.ProjectBillingGroupInput, - *schema.Project) error } // Import creates objects in the Lagoon API based on a configuration object. @@ -70,15 +66,6 @@ func Import(ctx context.Context, i Importer, r io.Reader, keepGoing bool, // import the config l := log.New(os.Stderr, "import: ", 0) - // add billing groups - for _, bg := range config.BillingGroups { - if err := i.AddBillingGroup(ctx, &bg, nil); err != nil { - if !keepGoing { - return fmt.Errorf("couldn't add billing group: %w", err) - } - l.Printf("couldn't add billing group: %v", err) - } - } // add groups for _, group := range config.Groups { if err := i.AddGroup(ctx, &group.AddGroupInput, nil); err != nil { @@ -261,26 +248,6 @@ func Import(ctx context.Context, i Importer, r io.Reader, keepGoing bool, l.Printf(`couldn't add Groups to Project "%s": %v`, p.Name, err) } } - if len(p.BillingGroups) > 1 { - return fmt.Errorf( - `project can only have one billing group: %v`, p.BillingGroups) - } - // add project to billing group - for _, bgName := range p.BillingGroups { - err = i.AddProjectToBillingGroup(ctx, &schema.ProjectBillingGroupInput{ - Group: schema.GroupInput{Name: bgName}, - Project: schema.ProjectInput{Name: p.Name}, - }, nil) - if err != nil { - if !keepGoing { - return fmt.Errorf( - `couldn't add Project "%s" to Billing Group "%s": %w`, p.Name, - bgName, err) - } - l.Printf(`couldn't add Project "%s" to Billing Group "%s": %v`, p.Name, - bgName, err) - } - } // add project users for _, u := range p.Users { err := i.AddUserToGroup(ctx, &schema.UserGroupRoleInput{ diff --git a/internal/lagoon/import_test.go b/internal/lagoon/import_test.go index 5374a49f..0fb84c4f 100644 --- a/internal/lagoon/import_test.go +++ b/internal/lagoon/import_test.go @@ -32,8 +32,6 @@ type importCalls struct { AddEnvironmentInputs []schema.AddEnvironmentInput ProjectGroupsInputs []schema.ProjectGroupsInput AddNotificationToProjectInputs []schema.AddNotificationToProjectInput - AddBillingGroupInputs []schema.AddBillingGroupInput - ProjectBillingGroupInputs []schema.ProjectBillingGroupInput } func TestImport(t *testing.T) { @@ -179,19 +177,6 @@ func TestImport(t *testing.T) { NotificationName: "example-slack", }, }, - AddBillingGroupInputs: []schema.AddBillingGroupInput{ - { - Name: "High Cotton Billing Group", - Currency: schema.USD, - BillingSoftware: "Microsoft Billing", - }, - }, - ProjectBillingGroupInputs: []schema.ProjectBillingGroupInput{ - { - Project: schema.ProjectInput{Name: "bananas"}, - Group: schema.GroupInput{Name: "High Cotton Billing Group"}, - }, - }, }}, } for name, tc := range testCases { @@ -261,14 +246,6 @@ func TestImport(t *testing.T) { importer.EXPECT().AddNotificationToProject( ctx, &tc.expect.AddNotificationToProjectInputs[i], nil) } - for i := range tc.expect.AddBillingGroupInputs { - importer.EXPECT().AddBillingGroup(ctx, - &tc.expect.AddBillingGroupInputs[i], nil) - } - for i := range tc.expect.ProjectBillingGroupInputs { - importer.EXPECT().AddProjectToBillingGroup(ctx, - &tc.expect.ProjectBillingGroupInputs[i], nil) - } // open the test yaml file, err := os.Open(tc.input) if err != nil { diff --git a/internal/lagoon/testdata/exhaustive.import.yaml b/internal/lagoon/testdata/exhaustive.import.yaml index 96a6f183..03f313c1 100644 --- a/internal/lagoon/testdata/exhaustive.import.yaml +++ b/internal/lagoon/testdata/exhaustive.import.yaml @@ -1,7 +1,3 @@ -billingGroups: -- billingSoftware: Microsoft Billing - currency: USD - name: High Cotton Billing Group groups: - name: abc users: @@ -26,8 +22,6 @@ notifications: name: example-msteams projects: - autoIdle: 1 - billingGroups: - - High Cotton Billing Group branches: ^(master|develop|production)$ developmentEnvironmentsLimit: 10 envVariables: diff --git a/internal/mock/mock_importer.go b/internal/mock/mock_importer.go index 3dcc91ee..603e530c 100644 --- a/internal/mock/mock_importer.go +++ b/internal/mock/mock_importer.go @@ -35,20 +35,6 @@ func (m *MockImporter) EXPECT() *MockImporterMockRecorder { return m.recorder } -// AddBillingGroup mocks base method. -func (m *MockImporter) AddBillingGroup(arg0 context.Context, arg1 *schema.AddBillingGroupInput, arg2 *schema.BillingGroup) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddBillingGroup", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddBillingGroup indicates an expected call of AddBillingGroup. -func (mr *MockImporterMockRecorder) AddBillingGroup(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBillingGroup", reflect.TypeOf((*MockImporter)(nil).AddBillingGroup), arg0, arg1, arg2) -} - // AddEnvVariable mocks base method. func (m *MockImporter) AddEnvVariable(arg0 context.Context, arg1 *schema.EnvVariableInput, arg2 *schema.EnvKeyValue) error { m.ctrl.T.Helper() @@ -189,20 +175,6 @@ func (mr *MockImporterMockRecorder) AddProject(arg0, arg1, arg2 interface{}) *go return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddProject", reflect.TypeOf((*MockImporter)(nil).AddProject), arg0, arg1, arg2) } -// AddProjectToBillingGroup mocks base method. -func (m *MockImporter) AddProjectToBillingGroup(arg0 context.Context, arg1 *schema.ProjectBillingGroupInput, arg2 *schema.Project) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddProjectToBillingGroup", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddProjectToBillingGroup indicates an expected call of AddProjectToBillingGroup. -func (mr *MockImporterMockRecorder) AddProjectToBillingGroup(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddProjectToBillingGroup", reflect.TypeOf((*MockImporter)(nil).AddProjectToBillingGroup), arg0, arg1, arg2) -} - // AddSSHKey mocks base method. func (m *MockImporter) AddSSHKey(arg0 context.Context, arg1 *schema.AddSSHKeyInput, arg2 *schema.SSHKey) error { m.ctrl.T.Helper() diff --git a/internal/schema/config.go b/internal/schema/config.go index 26d14aeb..753ecdf7 100644 --- a/internal/schema/config.go +++ b/internal/schema/config.go @@ -14,11 +14,10 @@ import ( // Fields for comprising structs are dictated by the add* Lagoon APIs. type Config struct { // API objects - Projects []ProjectConfig `json:"projects,omitempty"` - Groups []GroupConfig `json:"groups,omitempty"` - BillingGroups []AddBillingGroupInput `json:"billingGroups,omitempty"` - Users []User `json:"users,omitempty"` - Notifications *NotificationsConfig `json:"notifications,omitempty"` + Projects []ProjectConfig `json:"projects,omitempty"` + Groups []GroupConfig `json:"groups,omitempty"` + Users []User `json:"users,omitempty"` + Notifications *NotificationsConfig `json:"notifications,omitempty"` } // UnmarshalJSON implements json.Unmarshaler interface to control how lagoon @@ -151,18 +150,6 @@ func ProjectsToConfig( } config.Groups = append(config.Groups, newGroup) } - // add billing groups - for _, billingGroup := range project.Groups.BillingGroups { - projectConfig.BillingGroups = - append(projectConfig.BillingGroups, billingGroup.Name) - // skip creating the group if already done - if groups[billingGroup.Name] { - continue // next group - } - groups[billingGroup.Name] = true - config.BillingGroups = - append(config.BillingGroups, billingGroup.AddBillingGroupInput) - } // add notifications for _, n := range project.Notifications.Slack { projectConfig.Notifications.Slack = diff --git a/internal/schema/config_test.go b/internal/schema/config_test.go index 4ea86ea2..f20f3acb 100644 --- a/internal/schema/config_test.go +++ b/internal/schema/config_test.go @@ -28,14 +28,6 @@ func TestProjectsToConfig(t *testing.T) { input: "testdata/ciBranchPicky.json", expect: "testdata/ciBranchPicky.golden.yaml", }, - "noBillingGroups": { - input: "testdata/noBillingGroups.json", - expect: "testdata/noBillingGroups.golden.yaml", - }, - "withBillingGroups": { - input: "testdata/withBillingGroups.json", - expect: "testdata/withBillingGroups.golden.yaml", - }, "noNewNotifications": { input: "testdata/noNewNotifications.json", expect: "testdata/noNewNotifications.golden.yaml", diff --git a/internal/schema/group.go b/internal/schema/group.go index 2fb00958..1e651968 100644 --- a/internal/schema/group.go +++ b/internal/schema/group.go @@ -46,24 +46,10 @@ type UserRoleConfig struct { Role api.GroupRole `json:"role"` } -// AddBillingGroupInput is based on the input to addBillingGroup. -type AddBillingGroupInput struct { - Name string `json:"name"` - Currency Currency `json:"currency"` - BillingSoftware string `json:"billingSoftware,omitempty"` -} - -// BillingGroup provides for unmarshalling the groups contained with a Project. -type BillingGroup struct { - AddBillingGroupInput - ID *uuid.UUID `json:"id,omitempty"` -} - // Groups represents possible Lagoon group types. // These are unmarshalled from a projectByName query response. type Groups struct { - Groups []Group - BillingGroups []BillingGroup + Groups []Group } // UnmarshalJSON unmashals a quoted json string to the Notification values. @@ -106,15 +92,6 @@ func (g *Groups) UnmarshalJSON(b []byte) error { return err } g.Groups = append(g.Groups, group) - case "BillingGroup": - g.BillingGroups = append(g.BillingGroups, - BillingGroup{ - AddBillingGroupInput: AddBillingGroupInput{ - Name: gMap["name"], - Currency: Currency(gMap["currency"]), - BillingSoftware: gMap["billingSoftware"], - }, - }) case "": return fmt.Errorf(`missing key "__typename" in group response`) default: diff --git a/internal/schema/project.go b/internal/schema/project.go index 49157da0..85e8d4ae 100644 --- a/internal/schema/project.go +++ b/internal/schema/project.go @@ -47,8 +47,6 @@ type ProjectConfig struct { Notifications *ProjectNotifications `json:"notifications,omitempty"` // Group are (un)marshalled during import. Groups []string `json:"groups,omitempty"` - // BillingGroup are (un)marshalled during import. - BillingGroups []string `json:"billingGroups,omitempty"` // Users are members of the project. // Note that in Lagoon this is implemented as being a member of the // project- group. @@ -90,13 +88,6 @@ type AddNotificationToProjectInput struct { NotificationName string `json:"notificationName"` } -// ProjectBillingGroupInput is based on the input to -// addProjectToBillingGroup. -type ProjectBillingGroupInput struct { - Group GroupInput `json:"group"` - Project ProjectInput `json:"project"` -} - // ProjectMetadata . type ProjectMetadata struct { Project diff --git a/internal/schema/testdata/noBillingGroups.golden.yaml b/internal/schema/testdata/noBillingGroups.golden.yaml deleted file mode 100644 index 854534f3..00000000 --- a/internal/schema/testdata/noBillingGroups.golden.yaml +++ /dev/null @@ -1,37 +0,0 @@ -groups: -- name: ui-customer -projects: -- autoIdle: 1 - environments: - - autoIdle: 1 - deployBaseRef: Master - deployType: branch - environmentType: production - name: Master - openshiftProjectName: high-cotton-master - - autoIdle: 1 - deployBaseRef: Staging - deployType: branch - environmentType: development - name: Staging - openshiftProjectName: high-cotton-staging - - autoIdle: 1 - deployBaseRef: Development - deployType: branch - environmentType: development - name: Development - openshiftProjectName: high-cotton-development - - autoIdle: 1 - deployBaseRef: target - deployHeadRef: source - deployTitle: PR-175 - deployType: pullrequest - environmentType: development - name: PR-175 - openshiftProjectName: high-cotton-pr-175 - gitUrl: ssh://git@192.168.42.1:2222/git/project18.git - groups: - - ui-customer - name: high-cotton - productionEnvironment: Master - storageCalc: 1 diff --git a/internal/schema/testdata/noBillingGroups.json b/internal/schema/testdata/noBillingGroups.json deleted file mode 100644 index 54a540da..00000000 --- a/internal/schema/testdata/noBillingGroups.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "data": { - "projectByName": { - "id": 18, - "name": "high-cotton", - "autoIdle": 1, - "branches": "true", - "pullrequests": "true", - "privateKey": "-----BEGIN OPENSSH PRIVATE KEY-----\nb3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW\nQyNTUxOQAAACCiXQRY2swIZ5cMS1pBd/FMeZ65EnXUAhyxIXKB8FtaoQAAAIixOPe0sTj3\ntAAAAAtzc2gtZWQyNTUxOQAAACCiXQRY2swIZ5cMS1pBd/FMeZ65EnXUAhyxIXKB8FtaoQ\nAAAEBpG78n7RgfyHGi2suzBxFDLCaZ3TfHI/s60JGzxh6dFaJdBFjazAhnlwxLWkF38Ux5\nnrkSddQCHLEhcoHwW1qhAAAAAAECAwQF\n-----END OPENSSH PRIVATE KEY-----\n", - "productionEnvironment": "Master", - "activeSystemsDeploy": "lagoon_openshiftBuildDeploy", - "activeSystemsTask": "lagoon_openshiftJob", - "activeSystemsRemove": "lagoon_openshiftRemove", - "activeSystemsPromote": "lagoon_openshiftBuildDeploy", - "storageCalc": 1, - "openshiftProjectPattern": null, - "developmentEnvironmentsLimit": 5, - "gitUrl": "ssh://git@192.168.42.1:2222/git/project18.git", - "groups": [ - {}, - { - "__typename": "Group", - "name": "project-high-cotton", - "members": [ - { - "user": { - "email": "default-user@high-cotton", - "sshKeys": [ - { - "name": "auto-add via api", - "created": "2020-02-11 09:00:42", - "keyFingerprint": "", - "keyType": "ssh-ed25519", - "keyValue": "AAAAC3NzaC1lZDI1NTE5AAAAIKJdBFjazAhnlwxLWkF38Ux5nrkSddQCHLEhcoHwW1qh" - } - ], - "firstName": null, - "lastName": null - }, - "role": "MAINTAINER" - } - ] - }, - { - "__typename": "Group", - "name": "ui-customer", - "members": [] - } - ], - "notifications": [], - "openshift": { - "id": 2 - }, - "envVariables": [], - "environments": [ - { - "name": "Master", - "deployType": "branch", - "deployBaseRef": "Master", - "deployHeadRef": null, - "deployTitle": null, - "environmentType": "production", - "openshiftProjectName": "high-cotton-master", - "autoIdle": 1, - "envVariables": [] - }, - { - "name": "Staging", - "deployType": "branch", - "deployBaseRef": "Staging", - "deployHeadRef": null, - "deployTitle": null, - "environmentType": "development", - "openshiftProjectName": "high-cotton-staging", - "autoIdle": 1, - "envVariables": [] - }, - { - "name": "Development", - "deployType": "branch", - "deployBaseRef": "Development", - "deployHeadRef": null, - "deployTitle": null, - "environmentType": "development", - "openshiftProjectName": "high-cotton-development", - "autoIdle": 1, - "envVariables": [] - }, - { - "name": "PR-175", - "deployType": "pullrequest", - "deployBaseRef": "target", - "deployHeadRef": "source", - "deployTitle": "PR-175", - "environmentType": "development", - "openshiftProjectName": "high-cotton-pr-175", - "autoIdle": 1, - "envVariables": [] - } - ] - } - } -} diff --git a/internal/schema/testdata/withBillingGroups.golden.yaml b/internal/schema/testdata/withBillingGroups.golden.yaml deleted file mode 100644 index a7198362..00000000 --- a/internal/schema/testdata/withBillingGroups.golden.yaml +++ /dev/null @@ -1,43 +0,0 @@ -billingGroups: -- billingSoftware: "null" - currency: USD - name: High Cotton Billing Group -groups: -- name: ui-customer -projects: -- autoIdle: 1 - billingGroups: - - High Cotton Billing Group - environments: - - autoIdle: 1 - deployBaseRef: Master - deployType: branch - environmentType: production - name: Master - openshiftProjectName: high-cotton-master - - autoIdle: 1 - deployBaseRef: Staging - deployType: branch - environmentType: development - name: Staging - openshiftProjectName: high-cotton-staging - - autoIdle: 1 - deployBaseRef: Development - deployType: branch - environmentType: development - name: Development - openshiftProjectName: high-cotton-development - - autoIdle: 1 - deployBaseRef: target - deployHeadRef: source - deployTitle: PR-175 - deployType: pullrequest - environmentType: development - name: PR-175 - openshiftProjectName: high-cotton-pr-175 - gitUrl: ssh://git@192.168.42.1:2222/git/project18.git - groups: - - ui-customer - name: high-cotton - productionEnvironment: Master - storageCalc: 1 diff --git a/internal/schema/testdata/withBillingGroups.json b/internal/schema/testdata/withBillingGroups.json deleted file mode 100644 index 42d45118..00000000 --- a/internal/schema/testdata/withBillingGroups.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "data": { - "projectByName": { - "id": 18, - "name": "high-cotton", - "autoIdle": 1, - "branches": "true", - "pullrequests": "true", - "privateKey": "-----BEGIN OPENSSH PRIVATE KEY-----\nb3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW\nQyNTUxOQAAACCiXQRY2swIZ5cMS1pBd/FMeZ65EnXUAhyxIXKB8FtaoQAAAIixOPe0sTj3\ntAAAAAtzc2gtZWQyNTUxOQAAACCiXQRY2swIZ5cMS1pBd/FMeZ65EnXUAhyxIXKB8FtaoQ\nAAAEBpG78n7RgfyHGi2suzBxFDLCaZ3TfHI/s60JGzxh6dFaJdBFjazAhnlwxLWkF38Ux5\nnrkSddQCHLEhcoHwW1qhAAAAAAECAwQF\n-----END OPENSSH PRIVATE KEY-----\n", - "productionEnvironment": "Master", - "activeSystemsDeploy": "lagoon_openshiftBuildDeploy", - "activeSystemsTask": "lagoon_openshiftJob", - "activeSystemsRemove": "lagoon_openshiftRemove", - "activeSystemsPromote": "lagoon_openshiftBuildDeploy", - "storageCalc": 1, - "openshiftProjectPattern": null, - "developmentEnvironmentsLimit": 5, - "gitUrl": "ssh://git@192.168.42.1:2222/git/project18.git", - "groups": [ - { - "__typename": "BillingGroup", - "name": "High Cotton Billing Group", - "currency": "USD", - "billingSoftware": "null" - }, - { - "__typename": "Group", - "name": "project-high-cotton", - "members": [ - { - "user": { - "email": "default-user@high-cotton", - "sshKeys": [ - { - "name": "auto-add via api", - "created": "2020-02-11 09:00:42", - "keyFingerprint": "", - "keyType": "ssh-ed25519", - "keyValue": "AAAAC3NzaC1lZDI1NTE5AAAAIKJdBFjazAhnlwxLWkF38Ux5nrkSddQCHLEhcoHwW1qh" - } - ], - "firstName": null, - "lastName": null - }, - "role": "MAINTAINER" - } - ] - }, - { - "__typename": "Group", - "name": "ui-customer", - "members": [] - } - ], - "notifications": [], - "openshift": { - "id": 2 - }, - "envVariables": [], - "environments": [ - { - "name": "Master", - "deployType": "branch", - "deployBaseRef": "Master", - "deployHeadRef": null, - "deployTitle": null, - "environmentType": "production", - "openshiftProjectName": "high-cotton-master", - "autoIdle": 1, - "envVariables": [] - }, - { - "name": "Staging", - "deployType": "branch", - "deployBaseRef": "Staging", - "deployHeadRef": null, - "deployTitle": null, - "environmentType": "development", - "openshiftProjectName": "high-cotton-staging", - "autoIdle": 1, - "envVariables": [] - }, - { - "name": "Development", - "deployType": "branch", - "deployBaseRef": "Development", - "deployHeadRef": null, - "deployTitle": null, - "environmentType": "development", - "openshiftProjectName": "high-cotton-development", - "autoIdle": 1, - "envVariables": [] - }, - { - "name": "PR-175", - "deployType": "pullrequest", - "deployBaseRef": "target", - "deployHeadRef": "source", - "deployTitle": "PR-175", - "environmentType": "development", - "openshiftProjectName": "high-cotton-pr-175", - "autoIdle": 1, - "envVariables": [] - } - ] - } - } -} From 099653ac3d45e414fb9dbf10ba89532674cc6df8 Mon Sep 17 00:00:00 2001 From: Tim Clifford Date: Thu, 21 Apr 2022 09:38:38 +0100 Subject: [PATCH 2/2] allowing json string flag to be used when updating a project --- cmd/project.go | 11 +++++++++-- pkg/api/types.go | 2 ++ pkg/lagoon/projects/main.go | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/project.go b/cmd/project.go index aef30814..a95a8f9e 100644 --- a/cmd/project.go +++ b/cmd/project.go @@ -101,8 +101,15 @@ var updateProjectCmd = &cobra.Command{ os.Exit(1) } - jsonPatch, _ := json.Marshal(projectFlags) - projectUpdateID, err := pClient.UpdateProject(cmdProjectName, string(jsonPatch)) + var jsonPatchFromProjectFlags string + if string(jsonPatch) != "" { + jsonPatchFromProjectFlags = jsonPatch + } else { + jsonMarshalPatch, _ := json.Marshal(projectFlags) + jsonPatchFromProjectFlags = string(jsonMarshalPatch) + } + + projectUpdateID, err := pClient.UpdateProject(cmdProjectName, jsonPatchFromProjectFlags) handleError(err) var updatedProject api.Project err = json.Unmarshal([]byte(projectUpdateID), &updatedProject) diff --git a/pkg/api/types.go b/pkg/api/types.go index e61fe90b..65e48b68 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -249,6 +249,7 @@ type Project struct { Environments []Environment `json:"environments,omitempty"` Deployments []Deployment `json:"deployments,omitempty"` Notifications []interface{} `json:"notifications,omitempty"` + FactsUI *int `json:"factsUi,omitempty"` } // ProjectPatch struct. @@ -273,6 +274,7 @@ type ProjectPatch struct { OpenshiftProjectPattern string `json:"openshiftProjectPattern,omitempty"` DevelopmentEnvironmentsLimit *int `json:"developmentEnvironmentsLimit,omitempty"` Openshift *int `json:"openshift,omitempty"` + FactsUI *int `json:"factsUi,omitempty"` } // AddSSHKey . diff --git a/pkg/lagoon/projects/main.go b/pkg/lagoon/projects/main.go index ba9c37ff..16d7d2a0 100644 --- a/pkg/lagoon/projects/main.go +++ b/pkg/lagoon/projects/main.go @@ -274,7 +274,7 @@ func processProjectUpdate(projectByName []byte, jsonPatch string) (api.UpdatePro var projects api.Project var projectUpdate api.UpdateProject var project api.ProjectPatch - err := json.Unmarshal([]byte(projectByName), &projects) + err := json.Unmarshal(projectByName, &projects) if err != nil { return projectUpdate, err }