diff --git a/CHANGELOG.md b/CHANGELOG.md index 810f238..73f779a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [0.8.3] - 2024-09-12 + +### Changed + +- Added required attribute to impart_rule_test_case resource + +### Fixed + +- Errors on empty descriptions for impart_rule_test_case and impart_rule_script resources +- Array validation for impart_rule_test_case + ## [0.8.2] - 2024-08-23 ### Changed diff --git a/VERSION b/VERSION index 100435b..ee94dd8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.2 +0.8.3 diff --git a/docs/resources/list.md b/docs/resources/list.md index 1061704..aad0c49 100644 --- a/docs/resources/list.md +++ b/docs/resources/list.md @@ -38,7 +38,7 @@ resource "impart_list" "example" { ### Optional -- `functionality` (String) The list functionality. Allowed values are add, add/remove, none. +- `functionality` (String) The list functionality. Allowed values are add, add/remove. - `items` (Attributes List) The list items. (see [below for nested schema](#nestedatt--items)) - `subkind` (String) The list subkind. diff --git a/docs/resources/rule_test_case.md b/docs/resources/rule_test_case.md index da17821..4de3839 100644 --- a/docs/resources/rule_test_case.md +++ b/docs/resources/rule_test_case.md @@ -79,6 +79,7 @@ resource "impart_rule_test_case" "example" { - `assertions` (Attributes List) The assertions of the test case. (see [below for nested schema](#nestedatt--assertions)) - `description` (String) The description of the test case. +- `required` (Boolean) Sets if test case required to pass on update. ### Read-Only diff --git a/go.mod b/go.mod index 2c1ddbe..fdce03d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/impart-security/terraform-provider-impart -go 1.22 +go 1.23.1 require ( github.com/hashicorp/terraform-plugin-docs v0.19.4 @@ -10,7 +10,7 @@ require ( github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-testing v1.10.0 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba - golang.org/x/oauth2 v0.22.0 + golang.org/x/oauth2 v0.23.0 gopkg.in/validator.v2 v2.0.1 ) @@ -26,7 +26,7 @@ require ( github.com/armon/go-radix v1.0.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect - github.com/cloudflare/circl v1.3.9 // indirect + github.com/cloudflare/circl v1.4.0 // indirect github.com/fatih/color v1.17.0 // indirect github.com/go-test/deep v1.0.4 // indirect github.com/golang/protobuf v1.5.4 // indirect @@ -44,7 +44,7 @@ require ( github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/hc-install v0.8.0 // indirect - github.com/hashicorp/hcl/v2 v2.21.0 // indirect + github.com/hashicorp/hcl/v2 v2.22.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.21.0 // indirect github.com/hashicorp/terraform-json v0.22.1 // indirect @@ -74,17 +74,17 @@ require ( github.com/yuin/goldmark-meta v1.1.0 // indirect github.com/zclconf/go-cty v1.15.0 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect - golang.org/x/crypto v0.26.0 // indirect + golang.org/x/crypto v0.27.0 // indirect golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect - golang.org/x/mod v0.20.0 // indirect - golang.org/x/net v0.28.0 // indirect + golang.org/x/mod v0.21.0 // indirect + golang.org/x/net v0.29.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/text v0.17.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect + golang.org/x/tools v0.25.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.66.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 5e53159..840844a 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwN github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/cloudflare/circl v1.3.9 h1:QFrlgFYf2Qpi8bSpVPK1HBvWpx16v/1TZivyo7pGuBE= -github.com/cloudflare/circl v1.3.9/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= +github.com/cloudflare/circl v1.4.0 h1:BV7h5MgrktNzytKmWjpOtdYrf0lkkbF8YMlBGPhJQrY= +github.com/cloudflare/circl v1.4.0/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -92,8 +92,8 @@ github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKe github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hc-install v0.8.0 h1:LdpZeXkZYMQhoKPCecJHlKvUkQFixN/nvyR1CdfOLjI= github.com/hashicorp/hc-install v0.8.0/go.mod h1:+MwJYjDfCruSD/udvBmRB22Nlkwwkwf5sAB6uTIhSaU= -github.com/hashicorp/hcl/v2 v2.21.0 h1:lve4q/o/2rqwYOgUg3y3V2YPyD1/zkCLGjIV74Jit14= -github.com/hashicorp/hcl/v2 v2.21.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= +github.com/hashicorp/hcl/v2 v2.22.0 h1:hkZ3nCtqeJsDhPRFz5EA9iwcG1hNWGePOTw6oyul12M= +github.com/hashicorp/hcl/v2 v2.22.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ= @@ -217,22 +217,22 @@ go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/W golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 h1:LoYXNGAShUG3m/ehNk4iFctuhGX/+R1ZpfJ4/ia80JM= golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -251,8 +251,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -262,22 +262,22 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= diff --git a/internal/client/api_api_bindings.go b/internal/apiclient/api_api_bindings.go similarity index 99% rename from internal/client/api_api_bindings.go rename to internal/apiclient/api_api_bindings.go index 75b9c7e..26b7ea2 100644 --- a/internal/client/api_api_bindings.go +++ b/internal/apiclient/api_api_bindings.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -616,19 +616,19 @@ func (a *ApiBindingsAPIService) GetAPIBindingsExecute(r ApiGetAPIBindingsRequest } if r.collectionId != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "collection_id", r.collectionId, "csv") + parameterAddToHeaderOrQuery(localVarQueryParams, "collection_id", r.collectionId, "", "csv") } if r.specId != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "spec_id", r.specId, "csv") + parameterAddToHeaderOrQuery(localVarQueryParams, "spec_id", r.specId, "", "csv") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "", "") } else { var defaultValue int32 = 0 r.page = &defaultValue } if r.maxResults != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "", "") } else { var defaultValue int32 = 100 r.maxResults = &defaultValue diff --git a/internal/client/api_connectors.go b/internal/apiclient/api_connectors.go similarity index 99% rename from internal/client/api_connectors.go rename to internal/apiclient/api_connectors.go index 6acd596..213f8ef 100644 --- a/internal/client/api_connectors.go +++ b/internal/apiclient/api_connectors.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -382,7 +382,7 @@ func (a *ConnectorsAPIService) DeleteConnectorExecute(r ApiDeleteConnectorReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { @@ -804,13 +804,13 @@ func (a *ConnectorsAPIService) GetConnectorTypesExecute(r ApiGetConnectorTypesRe } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "", "") } else { var defaultValue int32 = 0 r.page = &defaultValue } if r.maxResults != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "", "") } else { var defaultValue int32 = 100 r.maxResults = &defaultValue @@ -969,13 +969,13 @@ func (a *ConnectorsAPIService) GetConnectorsExecute(r ApiGetConnectorsRequest) ( } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "", "") } else { var defaultValue int32 = 0 r.page = &defaultValue } if r.maxResults != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "", "") } else { var defaultValue int32 = 100 r.maxResults = &defaultValue diff --git a/internal/client/api_event_monitors.go b/internal/apiclient/api_event_monitors.go similarity index 99% rename from internal/client/api_event_monitors.go rename to internal/apiclient/api_event_monitors.go index 5c80d4c..815c9dd 100644 --- a/internal/client/api_event_monitors.go +++ b/internal/apiclient/api_event_monitors.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -336,7 +336,7 @@ func (a *EventMonitorsAPIService) DeleteEventMonitorExecute(r ApiDeleteEventMoni localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { @@ -612,13 +612,13 @@ func (a *EventMonitorsAPIService) GetEventMonitorsExecute(r ApiGetEventMonitorsR } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "", "") } else { var defaultValue int32 = 0 r.page = &defaultValue } if r.maxResults != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "", "") } else { var defaultValue int32 = 100 r.maxResults = &defaultValue @@ -804,7 +804,7 @@ func (a *EventMonitorsAPIService) UpdateEventMonitorExecute(r ApiUpdateEventMoni localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } // body params localVarPostBody = r.eventMonitorPostBody diff --git a/internal/client/api_lists.go b/internal/apiclient/api_lists.go similarity index 99% rename from internal/client/api_lists.go rename to internal/apiclient/api_lists.go index 78263df..ee0d979 100644 --- a/internal/client/api_lists.go +++ b/internal/apiclient/api_lists.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -365,7 +365,7 @@ func (a *ListsAPIService) DeleteListExecute(r ApiDeleteListRequest) (*http.Respo localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { @@ -789,19 +789,19 @@ func (a *ListsAPIService) GetListsExecute(r ApiGetListsRequest) (*Lists, *http.R } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "", "") } else { var defaultValue int32 = 0 r.page = &defaultValue } if r.kind != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "kind", r.kind, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "kind", r.kind, "", "") } if r.subkind != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "subkind", r.subkind, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "subkind", r.subkind, "", "") } if r.maxResults != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "", "") } else { var defaultValue int32 = 100 r.maxResults = &defaultValue @@ -1114,7 +1114,7 @@ func (a *ListsAPIService) UpdateListExecute(r ApiUpdateListRequest) (*List, *htt localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } // body params localVarPostBody = r.listPatchBody diff --git a/internal/client/api_log_bindings.go b/internal/apiclient/api_log_bindings.go similarity index 99% rename from internal/client/api_log_bindings.go rename to internal/apiclient/api_log_bindings.go index 9d3502d..ae50bd7 100644 --- a/internal/client/api_log_bindings.go +++ b/internal/apiclient/api_log_bindings.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -336,7 +336,7 @@ func (a *LogBindingsAPIService) DeleteLogBindingExecute(r ApiDeleteLogBindingReq localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { @@ -626,19 +626,19 @@ func (a *LogBindingsAPIService) GetLogBindingsExecute(r ApiGetLogBindingsRequest } if r.collectionId != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "collection_id", r.collectionId, "csv") + parameterAddToHeaderOrQuery(localVarQueryParams, "collection_id", r.collectionId, "", "csv") } if r.specId != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "spec_id", r.specId, "csv") + parameterAddToHeaderOrQuery(localVarQueryParams, "spec_id", r.specId, "", "csv") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "", "") } else { var defaultValue int32 = 0 r.page = &defaultValue } if r.maxResults != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "", "") } else { var defaultValue int32 = 100 r.maxResults = &defaultValue @@ -824,7 +824,7 @@ func (a *LogBindingsAPIService) UpdateLogBindingExecute(r ApiUpdateLogBindingReq localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } // body params localVarPostBody = r.logBindingPutBody diff --git a/internal/client/api_notification_templates.go b/internal/apiclient/api_notification_templates.go similarity index 99% rename from internal/client/api_notification_templates.go rename to internal/apiclient/api_notification_templates.go index 160f051..e859108 100644 --- a/internal/client/api_notification_templates.go +++ b/internal/apiclient/api_notification_templates.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -336,7 +336,7 @@ func (a *NotificationTemplatesAPIService) DeleteNotificationTemplateExecute(r Ap localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { @@ -612,13 +612,13 @@ func (a *NotificationTemplatesAPIService) GetNotificationTemplatesExecute(r ApiG } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "", "") } else { var defaultValue int32 = 0 r.page = &defaultValue } if r.maxResults != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "", "") } else { var defaultValue int32 = 100 r.maxResults = &defaultValue @@ -804,7 +804,7 @@ func (a *NotificationTemplatesAPIService) UpdateNotificationTemplateExecute(r Ap localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } // body params localVarPostBody = r.notificationTemplatePostBody diff --git a/internal/client/api_rules_dependencies.go b/internal/apiclient/api_rules_dependencies.go similarity index 99% rename from internal/client/api_rules_dependencies.go rename to internal/apiclient/api_rules_dependencies.go index 90b3d1b..15ccfec 100644 --- a/internal/client/api_rules_dependencies.go +++ b/internal/apiclient/api_rules_dependencies.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" diff --git a/internal/client/api_rules_scripts.go b/internal/apiclient/api_rules_scripts.go similarity index 84% rename from internal/client/api_rules_scripts.go rename to internal/apiclient/api_rules_scripts.go index 356df0c..efa38f6 100644 --- a/internal/client/api_rules_scripts.go +++ b/internal/apiclient/api_rules_scripts.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -83,21 +83,6 @@ type RulesScriptsAPI interface { // @return RulesScripts GetRulesScriptsExecute(r ApiGetRulesScriptsRequest) (*RulesScripts, *http.Response, error) - /* - RulesTest Test a rule - - Test a rule. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param orgId Organization ID - @return ApiRulesTestRequest - */ - RulesTest(ctx context.Context, orgId string) ApiRulesTestRequest - - // RulesTestExecute executes the request - // @return RulesTest - RulesTestExecute(r ApiRulesTestRequest) (*RulesTest, *http.Response, error) - /* UpdateRulesScript Update a rules script @@ -362,7 +347,7 @@ func (a *RulesScriptsAPIService) DeleteRulesScriptExecute(r ApiDeleteRulesScript localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { @@ -492,7 +477,7 @@ func (a *RulesScriptsAPIService) GetRulesScriptExecute(r ApiGetRulesScriptReques } if r.revision != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "revision", r.revision, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "revision", r.revision, "", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -589,6 +574,7 @@ type ApiGetRulesScriptsRequest struct { type_ *string excludeSrc *bool excludeRevisions *bool + isDisabled *string } // The page of results to return @@ -621,6 +607,12 @@ func (r ApiGetRulesScriptsRequest) ExcludeRevisions(excludeRevisions bool) ApiGe return r } +// Disabled status to filter results by +func (r ApiGetRulesScriptsRequest) IsDisabled(isDisabled string) ApiGetRulesScriptsRequest { + r.isDisabled = &isDisabled + return r +} + func (r ApiGetRulesScriptsRequest) Execute() (*RulesScripts, *http.Response, error) { return r.ApiService.GetRulesScriptsExecute(r) } @@ -669,32 +661,35 @@ func (a *RulesScriptsAPIService) GetRulesScriptsExecute(r ApiGetRulesScriptsRequ } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "", "") } else { var defaultValue int32 = 0 r.page = &defaultValue } if r.maxResults != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "", "") } else { var defaultValue int32 = 100 r.maxResults = &defaultValue } if r.type_ != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "", "") } if r.excludeSrc != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "exclude_src", r.excludeSrc, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude_src", r.excludeSrc, "", "") } else { var defaultValue bool = false r.excludeSrc = &defaultValue } if r.excludeRevisions != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "exclude_revisions", r.excludeRevisions, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "exclude_revisions", r.excludeRevisions, "", "") } else { var defaultValue bool = false r.excludeRevisions = &defaultValue } + if r.isDisabled != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "is_disabled", r.isDisabled, "", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -781,167 +776,26 @@ func (a *RulesScriptsAPIService) GetRulesScriptsExecute(r ApiGetRulesScriptsRequ return localVarReturnValue, localVarHTTPResponse, nil } -type ApiRulesTestRequest struct { - ctx context.Context - ApiService RulesScriptsAPI - orgId string - rulesTestPostBody *RulesTestPostBody +type ApiGetRulesScriptsSearchRequest struct { + ctx context.Context + ApiService RulesScriptsAPI + orgId string + search *string + maxResults *int32 } -// Request body for testing rules. -func (r ApiRulesTestRequest) RulesTestPostBody(rulesTestPostBody RulesTestPostBody) ApiRulesTestRequest { - r.rulesTestPostBody = &rulesTestPostBody +// Search string +func (r ApiGetRulesScriptsSearchRequest) Search(search string) ApiGetRulesScriptsSearchRequest { + r.search = &search return r } -func (r ApiRulesTestRequest) Execute() (*RulesTest, *http.Response, error) { - return r.ApiService.RulesTestExecute(r) -} - -/* -RulesTest Test a rule - -Test a rule. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param orgId Organization ID - @return ApiRulesTestRequest -*/ -func (a *RulesScriptsAPIService) RulesTest(ctx context.Context, orgId string) ApiRulesTestRequest { - return ApiRulesTestRequest{ - ApiService: a, - ctx: ctx, - orgId: orgId, - } +// The max number of results to return +func (r ApiGetRulesScriptsSearchRequest) MaxResults(maxResults int32) ApiGetRulesScriptsSearchRequest { + r.maxResults = &maxResults + return r } -// Execute executes the request -// -// @return RulesTest -func (a *RulesScriptsAPIService) RulesTestExecute(r ApiRulesTestRequest) (*RulesTest, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *RulesTest - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RulesScriptsAPIService.RulesTest") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/orgs/{org_id}/rules_test" - localVarPath = strings.Replace(localVarPath, "{"+"org_id"+"}", url.PathEscape(parameterValueToString(r.orgId, "orgId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if strlen(r.orgId) > 36 { - return localVarReturnValue, nil, reportError("orgId must have less than 36 elements") - } - if r.rulesTestPostBody == nil { - return localVarReturnValue, nil, reportError("rulesTestPostBody is required and must be specified") - } - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/security.impart.api.v0+json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.rulesTestPostBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v BasicError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v BasicError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 422 { - var v CompilationDiagnostics - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v BasicError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} type ApiUpdateRulesScriptRequest struct { ctx context.Context @@ -1038,7 +892,7 @@ func (a *RulesScriptsAPIService) UpdateRulesScriptExecute(r ApiUpdateRulesScript localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } // body params localVarPostBody = r.rulesScriptPostBody diff --git a/internal/client/api_rules_test_cases.go b/internal/apiclient/api_rules_test_cases.go similarity index 99% rename from internal/client/api_rules_test_cases.go rename to internal/apiclient/api_rules_test_cases.go index 9ee8267..95fe999 100644 --- a/internal/client/api_rules_test_cases.go +++ b/internal/apiclient/api_rules_test_cases.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -347,7 +347,7 @@ func (a *RulesTestCasesAPIService) DeleteRulesTestCaseExecute(r ApiDeleteRulesTe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { @@ -623,13 +623,13 @@ func (a *RulesTestCasesAPIService) GetRulesTestCasesExecute(r ApiGetRulesTestCas } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "", "") } else { var defaultValue int32 = 0 r.page = &defaultValue } if r.maxResults != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "max_results", r.maxResults, "", "") } else { var defaultValue int32 = 100 r.maxResults = &defaultValue @@ -816,7 +816,7 @@ func (a *RulesTestCasesAPIService) UpdateRulesTestCaseExecute(r ApiUpdateRulesTe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } // body params localVarPostBody = r.rulesTestCasePostBody diff --git a/internal/client/api_specs.go b/internal/apiclient/api_specs.go similarity index 99% rename from internal/client/api_specs.go rename to internal/apiclient/api_specs.go index 1c99a90..2ef1775 100644 --- a/internal/client/api_specs.go +++ b/internal/apiclient/api_specs.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -321,7 +321,7 @@ func (a *SpecsAPIService) DeleteSpecExecute(r ApiDeleteSpecRequest) (*http.Respo localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { @@ -451,7 +451,7 @@ func (a *SpecsAPIService) GetSpecExecute(r ApiGetSpecRequest) (*Spec, *http.Resp } if r.revision != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "revision", r.revision, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "revision", r.revision, "", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -654,7 +654,7 @@ func (a *SpecsAPIService) UpdateSpecExecute(r ApiUpdateSpecRequest) (*Spec, *htt localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.ifMatch != nil { - parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "If-Match", r.ifMatch, "", "") } // body params localVarPostBody = r.specPostBody diff --git a/internal/client/api_user.go b/internal/apiclient/api_user.go similarity index 99% rename from internal/client/api_user.go rename to internal/apiclient/api_user.go index 24c5b8f..4608476 100644 --- a/internal/client/api_user.go +++ b/internal/apiclient/api_user.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -20,6 +20,8 @@ import ( ) type UserAPI interface { + + /* GetTokenInfo Get token info diff --git a/internal/client/client.go b/internal/apiclient/client.go similarity index 96% rename from internal/client/client.go rename to internal/apiclient/client.go index 372cd2a..ceffd83 100644 --- a/internal/client/client.go +++ b/internal/apiclient/client.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" @@ -174,7 +174,7 @@ func parameterValueToString(obj interface{}, key string) string { // parameterAddToHeaderOrQuery adds the provided object to the request header or url query // supporting deep object syntax -func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { var v = reflect.ValueOf(obj) var value = "" if v == reflect.ValueOf(nil) { @@ -190,11 +190,11 @@ func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix stri if err != nil { return } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) return } if t, ok := obj.(time.Time); ok { - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), collectionType) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) return } value = v.Type().String() + " value" @@ -206,7 +206,11 @@ func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix stri var lenIndValue = indValue.Len() for i := 0; i < lenIndValue; i++ { var arrayValue = indValue.Index(i) - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) } return @@ -218,14 +222,14 @@ func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix stri iter := indValue.MapRange() for iter.Next() { k, v := iter.Key(), iter.Value() - parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) } return case reflect.Interface: fallthrough case reflect.Ptr: - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) return case reflect.Int, reflect.Int8, reflect.Int16, diff --git a/internal/client/configuration.go b/internal/apiclient/configuration.go similarity index 99% rename from internal/client/configuration.go rename to internal/apiclient/configuration.go index 9e322b0..497c4eb 100644 --- a/internal/client/configuration.go +++ b/internal/apiclient/configuration.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "context" @@ -97,7 +97,7 @@ func NewConfiguration() *Configuration { URL: "https://api.{environment}/v0", Description: "No description provided", Variables: map[string]ServerVariable{ - "environment": { + "environment": ServerVariable{ Description: "No description provided", DefaultValue: "impartsecurity.net", EnumValues: []string{ diff --git a/internal/client/model_api_binding.go b/internal/apiclient/model_api_binding.go similarity index 92% rename from internal/client/model_api_binding.go rename to internal/apiclient/model_api_binding.go index 859f7d4..2f75fe5 100644 --- a/internal/client/model_api_binding.go +++ b/internal/apiclient/model_api_binding.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" "time" @@ -56,7 +55,8 @@ type ApiBinding struct { // A list of headers which contain the forwarded HTTP protocol. The value may be HTTP, HTTPS, on/off, true/false, or 0/1. ForwardedProto []string `json:"forwarded_proto"` // A list of headers which contain the request ID. If no request ID is found a random one will be generated. - ForwardedId []string `json:"forwarded_id"` + ForwardedId []string `json:"forwarded_id"` + AdditionalProperties map[string]interface{} } type _ApiBinding ApiBinding @@ -532,6 +532,11 @@ func (o ApiBinding) ToMap() (map[string]interface{}, error) { toSerialize["forwarded_host"] = o.ForwardedHost toSerialize["forwarded_proto"] = o.ForwardedProto toSerialize["forwarded_id"] = o.ForwardedId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -575,9 +580,7 @@ func (o *ApiBinding) UnmarshalJSON(data []byte) (err error) { varApiBinding := _ApiBinding{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varApiBinding) + err = json.Unmarshal(data, &varApiBinding) if err != nil { return err @@ -585,6 +588,29 @@ func (o *ApiBinding) UnmarshalJSON(data []byte) (err error) { *o = ApiBinding(varApiBinding) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "disabled") + delete(additionalProperties, "spec_id") + delete(additionalProperties, "hostname") + delete(additionalProperties, "port") + delete(additionalProperties, "base_path") + delete(additionalProperties, "upstream_origin") + delete(additionalProperties, "observed_at") + delete(additionalProperties, "created_by") + delete(additionalProperties, "created_at") + delete(additionalProperties, "hops") + delete(additionalProperties, "use_forwarded") + delete(additionalProperties, "forwarded_for") + delete(additionalProperties, "forwarded_host") + delete(additionalProperties, "forwarded_proto") + delete(additionalProperties, "forwarded_id") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_api_binding_post_body.go b/internal/apiclient/model_api_binding_post_body.go similarity index 89% rename from internal/client/model_api_binding_post_body.go rename to internal/apiclient/model_api_binding_post_body.go index 470e142..0dd4826 100644 --- a/internal/client/model_api_binding_post_body.go +++ b/internal/apiclient/model_api_binding_post_body.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -22,19 +21,20 @@ var _ MappedNullable = &ApiBindingPostBody{} // ApiBindingPostBody struct for ApiBindingPostBody type ApiBindingPostBody struct { - Name string `json:"name"` - Disabled *bool `json:"disabled,omitempty"` - SpecId string `json:"spec_id"` - Hostname string `json:"hostname"` - Port int32 `json:"port"` - BasePath string `json:"base_path"` - UpstreamOrigin *string `json:"upstream_origin,omitempty"` - Hops *int32 `json:"hops,omitempty"` - UseForwarded *bool `json:"use_forwarded,omitempty"` - ForwardedFor []string `json:"forwarded_for,omitempty"` - ForwardedHost []string `json:"forwarded_host,omitempty"` - ForwardedProto []string `json:"forwarded_proto,omitempty"` - ForwardedId []string `json:"forwarded_id,omitempty"` + Name string `json:"name"` + Disabled *bool `json:"disabled,omitempty"` + SpecId string `json:"spec_id"` + Hostname string `json:"hostname"` + Port int32 `json:"port"` + BasePath string `json:"base_path"` + UpstreamOrigin *string `json:"upstream_origin,omitempty"` + Hops *int32 `json:"hops,omitempty"` + UseForwarded *bool `json:"use_forwarded,omitempty"` + ForwardedFor []string `json:"forwarded_for,omitempty"` + ForwardedHost []string `json:"forwarded_host,omitempty"` + ForwardedProto []string `json:"forwarded_proto,omitempty"` + ForwardedId []string `json:"forwarded_id,omitempty"` + AdditionalProperties map[string]interface{} } type _ApiBindingPostBody ApiBindingPostBody @@ -480,6 +480,11 @@ func (o ApiBindingPostBody) ToMap() (map[string]interface{}, error) { if !IsNil(o.ForwardedId) { toSerialize["forwarded_id"] = o.ForwardedId } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -511,9 +516,7 @@ func (o *ApiBindingPostBody) UnmarshalJSON(data []byte) (err error) { varApiBindingPostBody := _ApiBindingPostBody{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varApiBindingPostBody) + err = json.Unmarshal(data, &varApiBindingPostBody) if err != nil { return err @@ -521,6 +524,25 @@ func (o *ApiBindingPostBody) UnmarshalJSON(data []byte) (err error) { *o = ApiBindingPostBody(varApiBindingPostBody) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "disabled") + delete(additionalProperties, "spec_id") + delete(additionalProperties, "hostname") + delete(additionalProperties, "port") + delete(additionalProperties, "base_path") + delete(additionalProperties, "upstream_origin") + delete(additionalProperties, "hops") + delete(additionalProperties, "use_forwarded") + delete(additionalProperties, "forwarded_for") + delete(additionalProperties, "forwarded_host") + delete(additionalProperties, "forwarded_proto") + delete(additionalProperties, "forwarded_id") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_api_bindings.go b/internal/apiclient/model_api_bindings.go similarity index 88% rename from internal/client/model_api_bindings.go rename to internal/apiclient/model_api_bindings.go index 684f004..dcf3ff4 100644 --- a/internal/client/model_api_bindings.go +++ b/internal/apiclient/model_api_bindings.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -23,8 +22,9 @@ var _ MappedNullable = &ApiBindings{} // ApiBindings struct for ApiBindings type ApiBindings struct { // A list of API bindings. - Items []ApiBinding `json:"items"` - Meta CollectionMeta `json:"meta"` + Items []ApiBinding `json:"items"` + Meta CollectionMeta `json:"meta"` + AdditionalProperties map[string]interface{} } type _ApiBindings ApiBindings @@ -108,6 +108,11 @@ func (o ApiBindings) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["items"] = o.Items toSerialize["meta"] = o.Meta + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -136,9 +141,7 @@ func (o *ApiBindings) UnmarshalJSON(data []byte) (err error) { varApiBindings := _ApiBindings{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varApiBindings) + err = json.Unmarshal(data, &varApiBindings) if err != nil { return err @@ -146,6 +149,14 @@ func (o *ApiBindings) UnmarshalJSON(data []byte) (err error) { *o = ApiBindings(varApiBindings) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_api_test_post_body.go b/internal/apiclient/model_api_test_post_body.go similarity index 99% rename from internal/client/model_api_test_post_body.go rename to internal/apiclient/model_api_test_post_body.go index 62080bf..6952a39 100644 --- a/internal/client/model_api_test_post_body.go +++ b/internal/apiclient/model_api_test_post_body.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_basic_error.go b/internal/apiclient/model_basic_error.go similarity index 67% rename from internal/client/model_basic_error.go rename to internal/apiclient/model_basic_error.go index a2a3941..75a2406 100644 --- a/internal/client/model_basic_error.go +++ b/internal/apiclient/model_basic_error.go @@ -9,10 +9,11 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" + "fmt" ) // checks if the BasicError type satisfies the MappedNullable interface at compile time @@ -21,9 +22,12 @@ var _ MappedNullable = &BasicError{} // BasicError struct for BasicError type BasicError struct { // Output of the error message. - Message string `json:"message"` + Message string `json:"message"` + AdditionalProperties map[string]interface{} } +type _BasicError BasicError + // NewBasicError instantiates a new BasicError object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -77,9 +81,56 @@ func (o BasicError) MarshalJSON() ([]byte, error) { func (o BasicError) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } +func (o *BasicError) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBasicError := _BasicError{} + + err = json.Unmarshal(data, &varBasicError) + + if err != nil { + return err + } + + *o = BasicError(varBasicError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + type NullableBasicError struct { value *BasicError isSet bool diff --git a/internal/client/model_blocking_effect_type.go b/internal/apiclient/model_blocking_effect_type.go similarity index 99% rename from internal/client/model_blocking_effect_type.go rename to internal/apiclient/model_blocking_effect_type.go index e3ed124..bbfb1de 100644 --- a/internal/client/model_blocking_effect_type.go +++ b/internal/apiclient/model_blocking_effect_type.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_collection_meta.go b/internal/apiclient/model_collection_meta.go similarity index 89% rename from internal/client/model_collection_meta.go rename to internal/apiclient/model_collection_meta.go index e985dfb..3550d84 100644 --- a/internal/client/model_collection_meta.go +++ b/internal/apiclient/model_collection_meta.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -25,7 +24,8 @@ type CollectionMeta struct { // Total number of items available in the collection on the server. Total int64 `json:"total"` // Maximum number of items that can returned in the response. The actual number of items returned may be less than the specified max_results. - MaxResults int32 `json:"max_results"` + MaxResults int32 `json:"max_results"` + AdditionalProperties map[string]interface{} } type _CollectionMeta CollectionMeta @@ -109,6 +109,11 @@ func (o CollectionMeta) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["total"] = o.Total toSerialize["max_results"] = o.MaxResults + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -137,9 +142,7 @@ func (o *CollectionMeta) UnmarshalJSON(data []byte) (err error) { varCollectionMeta := _CollectionMeta{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varCollectionMeta) + err = json.Unmarshal(data, &varCollectionMeta) if err != nil { return err @@ -147,6 +150,14 @@ func (o *CollectionMeta) UnmarshalJSON(data []byte) (err error) { *o = CollectionMeta(varCollectionMeta) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "total") + delete(additionalProperties, "max_results") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_compilation_diagnostic.go b/internal/apiclient/model_compilation_diagnostic.go similarity index 87% rename from internal/client/model_compilation_diagnostic.go rename to internal/apiclient/model_compilation_diagnostic.go index 60f0b08..c510724 100644 --- a/internal/client/model_compilation_diagnostic.go +++ b/internal/apiclient/model_compilation_diagnostic.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -22,10 +21,11 @@ var _ MappedNullable = &CompilationDiagnostic{} // CompilationDiagnostic struct for CompilationDiagnostic type CompilationDiagnostic struct { - Code int32 `json:"code"` - Category int32 `json:"category"` - Message string `json:"message"` - Range CompilationDiagnosticRange `json:"range"` + Code int32 `json:"code"` + Category int32 `json:"category"` + Message string `json:"message"` + Range CompilationDiagnosticRange `json:"range"` + AdditionalProperties map[string]interface{} } type _CompilationDiagnostic CompilationDiagnostic @@ -161,6 +161,11 @@ func (o CompilationDiagnostic) ToMap() (map[string]interface{}, error) { toSerialize["category"] = o.Category toSerialize["message"] = o.Message toSerialize["range"] = o.Range + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -191,9 +196,7 @@ func (o *CompilationDiagnostic) UnmarshalJSON(data []byte) (err error) { varCompilationDiagnostic := _CompilationDiagnostic{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varCompilationDiagnostic) + err = json.Unmarshal(data, &varCompilationDiagnostic) if err != nil { return err @@ -201,6 +204,16 @@ func (o *CompilationDiagnostic) UnmarshalJSON(data []byte) (err error) { *o = CompilationDiagnostic(varCompilationDiagnostic) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "category") + delete(additionalProperties, "message") + delete(additionalProperties, "range") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_compilation_diagnostic_range.go b/internal/apiclient/model_compilation_diagnostic_range.go similarity index 89% rename from internal/client/model_compilation_diagnostic_range.go rename to internal/apiclient/model_compilation_diagnostic_range.go index 2639506..3d2dfbc 100644 --- a/internal/client/model_compilation_diagnostic_range.go +++ b/internal/apiclient/model_compilation_diagnostic_range.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -22,9 +21,10 @@ var _ MappedNullable = &CompilationDiagnosticRange{} // CompilationDiagnosticRange struct for CompilationDiagnosticRange type CompilationDiagnosticRange struct { - Start int32 `json:"start"` - End int32 `json:"end"` - Source string `json:"source"` + Start int32 `json:"start"` + End int32 `json:"end"` + Source string `json:"source"` + AdditionalProperties map[string]interface{} } type _CompilationDiagnosticRange CompilationDiagnosticRange @@ -134,6 +134,11 @@ func (o CompilationDiagnosticRange) ToMap() (map[string]interface{}, error) { toSerialize["start"] = o.Start toSerialize["end"] = o.End toSerialize["source"] = o.Source + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -163,9 +168,7 @@ func (o *CompilationDiagnosticRange) UnmarshalJSON(data []byte) (err error) { varCompilationDiagnosticRange := _CompilationDiagnosticRange{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varCompilationDiagnosticRange) + err = json.Unmarshal(data, &varCompilationDiagnosticRange) if err != nil { return err @@ -173,6 +176,15 @@ func (o *CompilationDiagnosticRange) UnmarshalJSON(data []byte) (err error) { *o = CompilationDiagnosticRange(varCompilationDiagnosticRange) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "start") + delete(additionalProperties, "end") + delete(additionalProperties, "source") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_compilation_diagnostics.go b/internal/apiclient/model_compilation_diagnostics.go similarity index 89% rename from internal/client/model_compilation_diagnostics.go rename to internal/apiclient/model_compilation_diagnostics.go index 0ec6e2e..467db32 100644 --- a/internal/client/model_compilation_diagnostics.go +++ b/internal/apiclient/model_compilation_diagnostics.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -22,8 +21,9 @@ var _ MappedNullable = &CompilationDiagnostics{} // CompilationDiagnostics struct for CompilationDiagnostics type CompilationDiagnostics struct { - Message string `json:"message"` - Diagnostics []CompilationDiagnostic `json:"diagnostics,omitempty"` + Message string `json:"message"` + Diagnostics []CompilationDiagnostic `json:"diagnostics,omitempty"` + AdditionalProperties map[string]interface{} } type _CompilationDiagnostics CompilationDiagnostics @@ -116,6 +116,11 @@ func (o CompilationDiagnostics) ToMap() (map[string]interface{}, error) { if !IsNil(o.Diagnostics) { toSerialize["diagnostics"] = o.Diagnostics } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -143,9 +148,7 @@ func (o *CompilationDiagnostics) UnmarshalJSON(data []byte) (err error) { varCompilationDiagnostics := _CompilationDiagnostics{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varCompilationDiagnostics) + err = json.Unmarshal(data, &varCompilationDiagnostics) if err != nil { return err @@ -153,6 +156,14 @@ func (o *CompilationDiagnostics) UnmarshalJSON(data []byte) (err error) { *o = CompilationDiagnostics(varCompilationDiagnostics) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + delete(additionalProperties, "diagnostics") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_connector.go b/internal/apiclient/model_connector.go similarity index 90% rename from internal/client/model_connector.go rename to internal/apiclient/model_connector.go index c9c5128..d552b76 100644 --- a/internal/client/model_connector.go +++ b/internal/apiclient/model_connector.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -31,7 +30,8 @@ type Connector struct { // A boolean flag to indicate whether the connector has been authenticated. IsConnected bool `json:"is_connected"` // A list of connector destinations. - Destinations []ConnectorDestination `json:"destinations"` + Destinations []ConnectorDestination `json:"destinations"` + AdditionalProperties map[string]interface{} } type _Connector Connector @@ -193,6 +193,11 @@ func (o Connector) ToMap() (map[string]interface{}, error) { toSerialize["connector_type_id"] = o.ConnectorTypeId toSerialize["is_connected"] = o.IsConnected toSerialize["destinations"] = o.Destinations + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -224,9 +229,7 @@ func (o *Connector) UnmarshalJSON(data []byte) (err error) { varConnector := _Connector{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varConnector) + err = json.Unmarshal(data, &varConnector) if err != nil { return err @@ -234,6 +237,17 @@ func (o *Connector) UnmarshalJSON(data []byte) (err error) { *o = Connector(varConnector) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "connector_type_id") + delete(additionalProperties, "is_connected") + delete(additionalProperties, "destinations") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_connector_destination.go b/internal/apiclient/model_connector_destination.go similarity index 90% rename from internal/client/model_connector_destination.go rename to internal/apiclient/model_connector_destination.go index 42e1cb0..449564a 100644 --- a/internal/client/model_connector_destination.go +++ b/internal/apiclient/model_connector_destination.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -25,7 +24,8 @@ type ConnectorDestination struct { // The ID for a connector destination. Id string `json:"id"` // The name of the connector destination. - Name string `json:"name"` + Name string `json:"name"` + AdditionalProperties map[string]interface{} } type _ConnectorDestination ConnectorDestination @@ -109,6 +109,11 @@ func (o ConnectorDestination) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["id"] = o.Id toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -137,9 +142,7 @@ func (o *ConnectorDestination) UnmarshalJSON(data []byte) (err error) { varConnectorDestination := _ConnectorDestination{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varConnectorDestination) + err = json.Unmarshal(data, &varConnectorDestination) if err != nil { return err @@ -147,6 +150,14 @@ func (o *ConnectorDestination) UnmarshalJSON(data []byte) (err error) { *o = ConnectorDestination(varConnectorDestination) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_connector_destinations.go b/internal/apiclient/model_connector_destinations.go similarity index 89% rename from internal/client/model_connector_destinations.go rename to internal/apiclient/model_connector_destinations.go index cc53133..4fb5798 100644 --- a/internal/client/model_connector_destinations.go +++ b/internal/apiclient/model_connector_destinations.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -23,7 +22,8 @@ var _ MappedNullable = &ConnectorDestinations{} // ConnectorDestinations struct for ConnectorDestinations type ConnectorDestinations struct { // A list of connector destinations. - Items []ConnectorDestination `json:"items"` + Items []ConnectorDestination `json:"items"` + AdditionalProperties map[string]interface{} } type _ConnectorDestinations ConnectorDestinations @@ -81,6 +81,11 @@ func (o ConnectorDestinations) MarshalJSON() ([]byte, error) { func (o ConnectorDestinations) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["items"] = o.Items + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -108,9 +113,7 @@ func (o *ConnectorDestinations) UnmarshalJSON(data []byte) (err error) { varConnectorDestinations := _ConnectorDestinations{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varConnectorDestinations) + err = json.Unmarshal(data, &varConnectorDestinations) if err != nil { return err @@ -118,6 +121,13 @@ func (o *ConnectorDestinations) UnmarshalJSON(data []byte) (err error) { *o = ConnectorDestinations(varConnectorDestinations) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_connector_notification_post_body.go b/internal/apiclient/model_connector_notification_post_body.go similarity index 73% rename from internal/client/model_connector_notification_post_body.go rename to internal/apiclient/model_connector_notification_post_body.go index d845525..1718285 100644 --- a/internal/client/model_connector_notification_post_body.go +++ b/internal/apiclient/model_connector_notification_post_body.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -25,9 +24,10 @@ type ConnectorNotificationPostBody struct { // The text payload to be sent in the notification. Payload string `json:"payload"` // The text for the subject of the message payload. - Subject string `json:"subject"` + Subject *string `json:"subject,omitempty"` // An array of ids for where the notification should be sent. - Destination []string `json:"destination"` + Destination []string `json:"destination,omitempty"` + AdditionalProperties map[string]interface{} } type _ConnectorNotificationPostBody ConnectorNotificationPostBody @@ -36,11 +36,9 @@ type _ConnectorNotificationPostBody ConnectorNotificationPostBody // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewConnectorNotificationPostBody(payload string, subject string, destination []string) *ConnectorNotificationPostBody { +func NewConnectorNotificationPostBody(payload string) *ConnectorNotificationPostBody { this := ConnectorNotificationPostBody{} this.Payload = payload - this.Subject = subject - this.Destination = destination return &this } @@ -76,50 +74,66 @@ func (o *ConnectorNotificationPostBody) SetPayload(v string) { o.Payload = v } -// GetSubject returns the Subject field value +// GetSubject returns the Subject field value if set, zero value otherwise. func (o *ConnectorNotificationPostBody) GetSubject() string { - if o == nil { + if o == nil || IsNil(o.Subject) { var ret string return ret } - - return o.Subject + return *o.Subject } -// GetSubjectOk returns a tuple with the Subject field value +// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConnectorNotificationPostBody) GetSubjectOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Subject) { return nil, false } - return &o.Subject, true + return o.Subject, true +} + +// HasSubject returns a boolean if a field has been set. +func (o *ConnectorNotificationPostBody) HasSubject() bool { + if o != nil && !IsNil(o.Subject) { + return true + } + + return false } -// SetSubject sets field value +// SetSubject gets a reference to the given string and assigns it to the Subject field. func (o *ConnectorNotificationPostBody) SetSubject(v string) { - o.Subject = v + o.Subject = &v } -// GetDestination returns the Destination field value +// GetDestination returns the Destination field value if set, zero value otherwise. func (o *ConnectorNotificationPostBody) GetDestination() []string { - if o == nil { + if o == nil || IsNil(o.Destination) { var ret []string return ret } - return o.Destination } -// GetDestinationOk returns a tuple with the Destination field value +// GetDestinationOk returns a tuple with the Destination field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConnectorNotificationPostBody) GetDestinationOk() ([]string, bool) { - if o == nil { + if o == nil || IsNil(o.Destination) { return nil, false } return o.Destination, true } -// SetDestination sets field value +// HasDestination returns a boolean if a field has been set. +func (o *ConnectorNotificationPostBody) HasDestination() bool { + if o != nil && !IsNil(o.Destination) { + return true + } + + return false +} + +// SetDestination gets a reference to the given []string and assigns it to the Destination field. func (o *ConnectorNotificationPostBody) SetDestination(v []string) { o.Destination = v } @@ -135,8 +149,17 @@ func (o ConnectorNotificationPostBody) MarshalJSON() ([]byte, error) { func (o ConnectorNotificationPostBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["payload"] = o.Payload - toSerialize["subject"] = o.Subject - toSerialize["destination"] = o.Destination + if !IsNil(o.Subject) { + toSerialize["subject"] = o.Subject + } + if !IsNil(o.Destination) { + toSerialize["destination"] = o.Destination + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -146,8 +169,6 @@ func (o *ConnectorNotificationPostBody) UnmarshalJSON(data []byte) (err error) { // that every required field exists as a key in the generic map. requiredProperties := []string{ "payload", - "subject", - "destination", } allProperties := make(map[string]interface{}) @@ -166,9 +187,7 @@ func (o *ConnectorNotificationPostBody) UnmarshalJSON(data []byte) (err error) { varConnectorNotificationPostBody := _ConnectorNotificationPostBody{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varConnectorNotificationPostBody) + err = json.Unmarshal(data, &varConnectorNotificationPostBody) if err != nil { return err @@ -176,6 +195,15 @@ func (o *ConnectorNotificationPostBody) UnmarshalJSON(data []byte) (err error) { *o = ConnectorNotificationPostBody(varConnectorNotificationPostBody) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "payload") + delete(additionalProperties, "subject") + delete(additionalProperties, "destination") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_connector_post_body.go b/internal/apiclient/model_connector_post_body.go similarity index 90% rename from internal/client/model_connector_post_body.go rename to internal/apiclient/model_connector_post_body.go index 963ea56..a1a02e4 100644 --- a/internal/client/model_connector_post_body.go +++ b/internal/apiclient/model_connector_post_body.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -27,7 +26,8 @@ type ConnectorPostBody struct { // The ID of the connector type. ConnectorTypeId string `json:"connector_type_id"` // A JSON blob of the fields that will be used to configure the connector - Config string `json:"config"` + Config string `json:"config"` + AdditionalProperties map[string]interface{} } type _ConnectorPostBody ConnectorPostBody @@ -137,6 +137,11 @@ func (o ConnectorPostBody) ToMap() (map[string]interface{}, error) { toSerialize["name"] = o.Name toSerialize["connector_type_id"] = o.ConnectorTypeId toSerialize["config"] = o.Config + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -166,9 +171,7 @@ func (o *ConnectorPostBody) UnmarshalJSON(data []byte) (err error) { varConnectorPostBody := _ConnectorPostBody{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varConnectorPostBody) + err = json.Unmarshal(data, &varConnectorPostBody) if err != nil { return err @@ -176,6 +179,15 @@ func (o *ConnectorPostBody) UnmarshalJSON(data []byte) (err error) { *o = ConnectorPostBody(varConnectorPostBody) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "connector_type_id") + delete(additionalProperties, "config") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_connector_put_body.go b/internal/apiclient/model_connector_put_body.go similarity index 89% rename from internal/client/model_connector_put_body.go rename to internal/apiclient/model_connector_put_body.go index b37e333..3a29194 100644 --- a/internal/client/model_connector_put_body.go +++ b/internal/apiclient/model_connector_put_body.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -25,7 +24,8 @@ type ConnectorPutBody struct { // The name of the connector and what it represents. Name string `json:"name"` // A list of connector destinations. - Destinations []ConnectorDestination `json:"destinations"` + Destinations []ConnectorDestination `json:"destinations"` + AdditionalProperties map[string]interface{} } type _ConnectorPutBody ConnectorPutBody @@ -109,6 +109,11 @@ func (o ConnectorPutBody) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["name"] = o.Name toSerialize["destinations"] = o.Destinations + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -137,9 +142,7 @@ func (o *ConnectorPutBody) UnmarshalJSON(data []byte) (err error) { varConnectorPutBody := _ConnectorPutBody{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varConnectorPutBody) + err = json.Unmarshal(data, &varConnectorPutBody) if err != nil { return err @@ -147,6 +150,14 @@ func (o *ConnectorPutBody) UnmarshalJSON(data []byte) (err error) { *o = ConnectorPutBody(varConnectorPutBody) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "destinations") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_connector_type.go b/internal/apiclient/model_connector_type.go similarity index 89% rename from internal/client/model_connector_type.go rename to internal/apiclient/model_connector_type.go index 29c5a1b..62a5841 100644 --- a/internal/client/model_connector_type.go +++ b/internal/apiclient/model_connector_type.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -27,7 +26,8 @@ type ConnectorType struct { // The name of the connector. Name string `json:"name"` // A JSON schema for the connector configuration. - ConfigSchema string `json:"config_schema"` + ConfigSchema string `json:"config_schema"` + AdditionalProperties map[string]interface{} } type _ConnectorType ConnectorType @@ -137,6 +137,11 @@ func (o ConnectorType) ToMap() (map[string]interface{}, error) { toSerialize["id"] = o.Id toSerialize["name"] = o.Name toSerialize["config_schema"] = o.ConfigSchema + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -166,9 +171,7 @@ func (o *ConnectorType) UnmarshalJSON(data []byte) (err error) { varConnectorType := _ConnectorType{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varConnectorType) + err = json.Unmarshal(data, &varConnectorType) if err != nil { return err @@ -176,6 +179,15 @@ func (o *ConnectorType) UnmarshalJSON(data []byte) (err error) { *o = ConnectorType(varConnectorType) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "config_schema") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_connector_types.go b/internal/apiclient/model_connector_types.go similarity index 88% rename from internal/client/model_connector_types.go rename to internal/apiclient/model_connector_types.go index 5edde4b..ef02817 100644 --- a/internal/client/model_connector_types.go +++ b/internal/apiclient/model_connector_types.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -23,8 +22,9 @@ var _ MappedNullable = &ConnectorTypes{} // ConnectorTypes struct for ConnectorTypes type ConnectorTypes struct { // A list of connector types. - Items []ConnectorType `json:"items"` - Meta CollectionMeta `json:"meta"` + Items []ConnectorType `json:"items"` + Meta CollectionMeta `json:"meta"` + AdditionalProperties map[string]interface{} } type _ConnectorTypes ConnectorTypes @@ -108,6 +108,11 @@ func (o ConnectorTypes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["items"] = o.Items toSerialize["meta"] = o.Meta + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -136,9 +141,7 @@ func (o *ConnectorTypes) UnmarshalJSON(data []byte) (err error) { varConnectorTypes := _ConnectorTypes{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varConnectorTypes) + err = json.Unmarshal(data, &varConnectorTypes) if err != nil { return err @@ -146,6 +149,14 @@ func (o *ConnectorTypes) UnmarshalJSON(data []byte) (err error) { *o = ConnectorTypes(varConnectorTypes) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_connectors.go b/internal/apiclient/model_connectors.go similarity index 88% rename from internal/client/model_connectors.go rename to internal/apiclient/model_connectors.go index ef64dd1..402a450 100644 --- a/internal/client/model_connectors.go +++ b/internal/apiclient/model_connectors.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -23,8 +22,9 @@ var _ MappedNullable = &Connectors{} // Connectors struct for Connectors type Connectors struct { // A list of connectors. - Items []Connector `json:"items"` - Meta CollectionMeta `json:"meta"` + Items []Connector `json:"items"` + Meta CollectionMeta `json:"meta"` + AdditionalProperties map[string]interface{} } type _Connectors Connectors @@ -108,6 +108,11 @@ func (o Connectors) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["items"] = o.Items toSerialize["meta"] = o.Meta + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -136,9 +141,7 @@ func (o *Connectors) UnmarshalJSON(data []byte) (err error) { varConnectors := _Connectors{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varConnectors) + err = json.Unmarshal(data, &varConnectors) if err != nil { return err @@ -146,6 +149,14 @@ func (o *Connectors) UnmarshalJSON(data []byte) (err error) { *o = Connectors(varConnectors) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_event_monitor.go b/internal/apiclient/model_event_monitor.go similarity index 92% rename from internal/client/model_event_monitor.go rename to internal/apiclient/model_event_monitor.go index 040bcaf..ae59506 100644 --- a/internal/client/model_event_monitor.go +++ b/internal/apiclient/model_event_monitor.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" "time" @@ -41,6 +40,7 @@ type EventMonitor struct { UpdatedAt NullableTime `json:"updated_at"` // The ids of the notification templates that the monitor is associated with. NotificationTemplateIds []string `json:"notification_template_ids"` + AdditionalProperties map[string]interface{} } type _EventMonitor EventMonitor @@ -310,6 +310,11 @@ func (o EventMonitor) ToMap() (map[string]interface{}, error) { toSerialize["updated_by"] = o.UpdatedBy.Get() toSerialize["updated_at"] = o.UpdatedAt.Get() toSerialize["notification_template_ids"] = o.NotificationTemplateIds + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -345,9 +350,7 @@ func (o *EventMonitor) UnmarshalJSON(data []byte) (err error) { varEventMonitor := _EventMonitor{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varEventMonitor) + err = json.Unmarshal(data, &varEventMonitor) if err != nil { return err @@ -355,6 +358,21 @@ func (o *EventMonitor) UnmarshalJSON(data []byte) (err error) { *o = EventMonitor(varEventMonitor) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "description") + delete(additionalProperties, "conditions") + delete(additionalProperties, "created_by") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_by") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "notification_template_ids") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_event_monitor_condition.go b/internal/apiclient/model_event_monitor_condition.go similarity index 87% rename from internal/client/model_event_monitor_condition.go rename to internal/apiclient/model_event_monitor_condition.go index 6a28956..44d2192 100644 --- a/internal/client/model_event_monitor_condition.go +++ b/internal/apiclient/model_event_monitor_condition.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -22,15 +21,16 @@ var _ MappedNullable = &EventMonitorCondition{} // EventMonitorCondition struct for EventMonitorCondition type EventMonitorCondition struct { - // The number of times a condition can be met before it triggers its monitor. + // The number of times a condition must be met before the monitor is triggered. Threshold int32 `json:"threshold"` - // How the condition should compare values (less than or greater than) + // How condition values are compared to the threshold (less than, greater than, equal to) Comparator string `json:"comparator"` // The time offset from now() in the past in milliseconds. Delay int64 `json:"delay"` - // Indicates how far in the future from delay we will be looking in milliseconds. - TimePeriod int64 `json:"time_period"` - Details EventMonitorConditionDetails `json:"details"` + // The amount of time, in milliseconds, during which the conditions must be met. + TimePeriod int64 `json:"time_period"` + Details EventMonitorConditionDetails `json:"details"` + AdditionalProperties map[string]interface{} } type _EventMonitorCondition EventMonitorCondition @@ -192,6 +192,11 @@ func (o EventMonitorCondition) ToMap() (map[string]interface{}, error) { toSerialize["delay"] = o.Delay toSerialize["time_period"] = o.TimePeriod toSerialize["details"] = o.Details + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -223,9 +228,7 @@ func (o *EventMonitorCondition) UnmarshalJSON(data []byte) (err error) { varEventMonitorCondition := _EventMonitorCondition{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varEventMonitorCondition) + err = json.Unmarshal(data, &varEventMonitorCondition) if err != nil { return err @@ -233,6 +236,17 @@ func (o *EventMonitorCondition) UnmarshalJSON(data []byte) (err error) { *o = EventMonitorCondition(varEventMonitorCondition) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "threshold") + delete(additionalProperties, "comparator") + delete(additionalProperties, "delay") + delete(additionalProperties, "time_period") + delete(additionalProperties, "details") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_event_monitor_condition_details.go b/internal/apiclient/model_event_monitor_condition_details.go similarity index 92% rename from internal/client/model_event_monitor_condition_details.go rename to internal/apiclient/model_event_monitor_condition_details.go index 7550c65..a86fc27 100644 --- a/internal/client/model_event_monitor_condition_details.go +++ b/internal/apiclient/model_event_monitor_condition_details.go @@ -9,11 +9,13 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" "fmt" + + "gopkg.in/validator.v2" ) // EventMonitorConditionDetails - struct for EventMonitorConditionDetails @@ -47,7 +49,11 @@ func (dst *EventMonitorConditionDetails) UnmarshalJSON(data []byte) error { if string(jsonEventMonitorConditionEvent) == "{}" { // empty struct dst.EventMonitorConditionEvent = nil } else { - match++ + if err = validator.Validate(dst.EventMonitorConditionEvent); err != nil { + dst.EventMonitorConditionEvent = nil + } else { + match++ + } } } else { dst.EventMonitorConditionEvent = nil @@ -60,7 +66,11 @@ func (dst *EventMonitorConditionDetails) UnmarshalJSON(data []byte) error { if string(jsonEventMonitorConditionMetric) == "{}" { // empty struct dst.EventMonitorConditionMetric = nil } else { - match++ + if err = validator.Validate(dst.EventMonitorConditionMetric); err != nil { + dst.EventMonitorConditionMetric = nil + } else { + match++ + } } } else { dst.EventMonitorConditionMetric = nil diff --git a/internal/client/model_event_monitor_condition_event.go b/internal/apiclient/model_event_monitor_condition_event.go similarity index 93% rename from internal/client/model_event_monitor_condition_event.go rename to internal/apiclient/model_event_monitor_condition_event.go index d1771e9..c41a687 100644 --- a/internal/client/model_event_monitor_condition_event.go +++ b/internal/apiclient/model_event_monitor_condition_event.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -35,7 +34,8 @@ type EventMonitorConditionEvent struct { // A slug of the entity type that actor represents ActorType *string `json:"actor_type,omitempty"` // A slug of the entity type that subject represents - SubjectType *string `json:"subject_type,omitempty"` + SubjectType *string `json:"subject_type,omitempty"` + AdditionalProperties map[string]interface{} } type _EventMonitorConditionEvent EventMonitorConditionEvent @@ -303,6 +303,11 @@ func (o EventMonitorConditionEvent) ToMap() (map[string]interface{}, error) { if !IsNil(o.SubjectType) { toSerialize["subject_type"] = o.SubjectType } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -330,9 +335,7 @@ func (o *EventMonitorConditionEvent) UnmarshalJSON(data []byte) (err error) { varEventMonitorConditionEvent := _EventMonitorConditionEvent{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varEventMonitorConditionEvent) + err = json.Unmarshal(data, &varEventMonitorConditionEvent) if err != nil { return err @@ -340,6 +343,19 @@ func (o *EventMonitorConditionEvent) UnmarshalJSON(data []byte) (err error) { *o = EventMonitorConditionEvent(varEventMonitorConditionEvent) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "type") + delete(additionalProperties, "action") + delete(additionalProperties, "subject") + delete(additionalProperties, "source") + delete(additionalProperties, "actor") + delete(additionalProperties, "actor_type") + delete(additionalProperties, "subject_type") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_event_monitor_condition_metric.go b/internal/apiclient/model_event_monitor_condition_metric.go similarity index 92% rename from internal/client/model_event_monitor_condition_metric.go rename to internal/apiclient/model_event_monitor_condition_metric.go index ce965f8..96c44d7 100644 --- a/internal/client/model_event_monitor_condition_metric.go +++ b/internal/apiclient/model_event_monitor_condition_metric.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -31,7 +30,8 @@ type EventMonitorConditionMetric struct { // The endpoint IDs to filter for. EndpointId []string `json:"endpoint_id,omitempty"` // The collection IDs to filter for. - CollectionId []string `json:"collection_id,omitempty"` + CollectionId []string `json:"collection_id,omitempty"` + AdditionalProperties map[string]interface{} } type _EventMonitorConditionMetric EventMonitorConditionMetric @@ -229,6 +229,11 @@ func (o EventMonitorConditionMetric) ToMap() (map[string]interface{}, error) { if !IsNil(o.CollectionId) { toSerialize["collection_id"] = o.CollectionId } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -256,9 +261,7 @@ func (o *EventMonitorConditionMetric) UnmarshalJSON(data []byte) (err error) { varEventMonitorConditionMetric := _EventMonitorConditionMetric{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varEventMonitorConditionMetric) + err = json.Unmarshal(data, &varEventMonitorConditionMetric) if err != nil { return err @@ -266,6 +269,17 @@ func (o *EventMonitorConditionMetric) UnmarshalJSON(data []byte) (err error) { *o = EventMonitorConditionMetric(varEventMonitorConditionMetric) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "type") + delete(additionalProperties, "tag") + delete(additionalProperties, "spec_id") + delete(additionalProperties, "endpoint_id") + delete(additionalProperties, "collection_id") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_event_monitor_condition_post_body.go b/internal/apiclient/model_event_monitor_condition_post_body.go similarity index 87% rename from internal/client/model_event_monitor_condition_post_body.go rename to internal/apiclient/model_event_monitor_condition_post_body.go index 9816cbc..ca8b6a4 100644 --- a/internal/client/model_event_monitor_condition_post_body.go +++ b/internal/apiclient/model_event_monitor_condition_post_body.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -22,15 +21,16 @@ var _ MappedNullable = &EventMonitorConditionPostBody{} // EventMonitorConditionPostBody struct for EventMonitorConditionPostBody type EventMonitorConditionPostBody struct { - // The number of times a condition can be met before it triggers its monitor. + // The number of times a condition must be met before the monitor is triggered. Threshold int32 `json:"threshold"` - // How the condition should compare values (less than or greater than) + // How condition values are compared to the threshold (less than, greater than, equal to) Comparator string `json:"comparator"` // The time offset from now() in the past in milliseconds. Delay int64 `json:"delay"` - // Indicates how far in the future from delay we will be looking in milliseconds. - TimePeriod int64 `json:"time_period"` - Details EventMonitorConditionDetails `json:"details"` + // The amount of time, in milliseconds, during which the conditions must be met. + TimePeriod int64 `json:"time_period"` + Details EventMonitorConditionDetails `json:"details"` + AdditionalProperties map[string]interface{} } type _EventMonitorConditionPostBody EventMonitorConditionPostBody @@ -192,6 +192,11 @@ func (o EventMonitorConditionPostBody) ToMap() (map[string]interface{}, error) { toSerialize["delay"] = o.Delay toSerialize["time_period"] = o.TimePeriod toSerialize["details"] = o.Details + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -223,9 +228,7 @@ func (o *EventMonitorConditionPostBody) UnmarshalJSON(data []byte) (err error) { varEventMonitorConditionPostBody := _EventMonitorConditionPostBody{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varEventMonitorConditionPostBody) + err = json.Unmarshal(data, &varEventMonitorConditionPostBody) if err != nil { return err @@ -233,6 +236,17 @@ func (o *EventMonitorConditionPostBody) UnmarshalJSON(data []byte) (err error) { *o = EventMonitorConditionPostBody(varEventMonitorConditionPostBody) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "threshold") + delete(additionalProperties, "comparator") + delete(additionalProperties, "delay") + delete(additionalProperties, "time_period") + delete(additionalProperties, "details") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_event_monitor_post_body.go b/internal/apiclient/model_event_monitor_post_body.go similarity index 92% rename from internal/client/model_event_monitor_post_body.go rename to internal/apiclient/model_event_monitor_post_body.go index 3aa8351..29c61af 100644 --- a/internal/client/model_event_monitor_post_body.go +++ b/internal/apiclient/model_event_monitor_post_body.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -30,6 +29,7 @@ type EventMonitorPostBody struct { Conditions []EventMonitorConditionPostBody `json:"conditions"` // The ids of the notification templates that the monitor is associated with. NotificationTemplateIds []string `json:"notification_template_ids"` + AdditionalProperties map[string]interface{} } type _EventMonitorPostBody EventMonitorPostBody @@ -165,6 +165,11 @@ func (o EventMonitorPostBody) ToMap() (map[string]interface{}, error) { toSerialize["description"] = o.Description toSerialize["conditions"] = o.Conditions toSerialize["notification_template_ids"] = o.NotificationTemplateIds + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -195,9 +200,7 @@ func (o *EventMonitorPostBody) UnmarshalJSON(data []byte) (err error) { varEventMonitorPostBody := _EventMonitorPostBody{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varEventMonitorPostBody) + err = json.Unmarshal(data, &varEventMonitorPostBody) if err != nil { return err @@ -205,6 +208,16 @@ func (o *EventMonitorPostBody) UnmarshalJSON(data []byte) (err error) { *o = EventMonitorPostBody(varEventMonitorPostBody) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "description") + delete(additionalProperties, "conditions") + delete(additionalProperties, "notification_template_ids") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_event_monitors.go b/internal/apiclient/model_event_monitors.go similarity index 88% rename from internal/client/model_event_monitors.go rename to internal/apiclient/model_event_monitors.go index de6781a..51ffa38 100644 --- a/internal/client/model_event_monitors.go +++ b/internal/apiclient/model_event_monitors.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -23,8 +22,9 @@ var _ MappedNullable = &EventMonitors{} // EventMonitors struct for EventMonitors type EventMonitors struct { // A list of event monitors. - Items []EventMonitor `json:"items"` - Meta CollectionMeta `json:"meta"` + Items []EventMonitor `json:"items"` + Meta CollectionMeta `json:"meta"` + AdditionalProperties map[string]interface{} } type _EventMonitors EventMonitors @@ -108,6 +108,11 @@ func (o EventMonitors) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["items"] = o.Items toSerialize["meta"] = o.Meta + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -136,9 +141,7 @@ func (o *EventMonitors) UnmarshalJSON(data []byte) (err error) { varEventMonitors := _EventMonitors{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varEventMonitors) + err = json.Unmarshal(data, &varEventMonitors) if err != nil { return err @@ -146,6 +149,14 @@ func (o *EventMonitors) UnmarshalJSON(data []byte) (err error) { *o = EventMonitors(varEventMonitors) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_inspector_req_msg.go b/internal/apiclient/model_inspector_req_msg.go similarity index 93% rename from internal/client/model_inspector_req_msg.go rename to internal/apiclient/model_inspector_req_msg.go index 85eae9f..3eb5b6b 100644 --- a/internal/client/model_inspector_req_msg.go +++ b/internal/apiclient/model_inspector_req_msg.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -39,7 +38,8 @@ type InspectorReqMsg struct { // The HTTP request cookie values. Each value should have a corresponding cookie_keys at the matching index. CookieValues []string `json:"cookie_values,omitempty"` // The address of the client. This will usually be a load balancer address. - RemoteAddr *string `json:"remote_addr,omitempty"` + RemoteAddr *string `json:"remote_addr,omitempty"` + AdditionalProperties map[string]interface{} } type _InspectorReqMsg InspectorReqMsg @@ -368,6 +368,11 @@ func (o InspectorReqMsg) ToMap() (map[string]interface{}, error) { if !IsNil(o.RemoteAddr) { toSerialize["remote_addr"] = o.RemoteAddr } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -396,9 +401,7 @@ func (o *InspectorReqMsg) UnmarshalJSON(data []byte) (err error) { varInspectorReqMsg := _InspectorReqMsg{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varInspectorReqMsg) + err = json.Unmarshal(data, &varInspectorReqMsg) if err != nil { return err @@ -406,6 +409,21 @@ func (o *InspectorReqMsg) UnmarshalJSON(data []byte) (err error) { *o = InspectorReqMsg(varInspectorReqMsg) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "url") + delete(additionalProperties, "method") + delete(additionalProperties, "truncated_body") + delete(additionalProperties, "body") + delete(additionalProperties, "header_keys") + delete(additionalProperties, "header_values") + delete(additionalProperties, "cookie_keys") + delete(additionalProperties, "cookie_values") + delete(additionalProperties, "remote_addr") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_inspector_req_msg_response.go b/internal/apiclient/model_inspector_req_msg_response.go similarity index 93% rename from internal/client/model_inspector_req_msg_response.go rename to internal/apiclient/model_inspector_req_msg_response.go index 857bca0..1bf7fcc 100644 --- a/internal/client/model_inspector_req_msg_response.go +++ b/internal/apiclient/model_inspector_req_msg_response.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -37,7 +36,8 @@ type InspectorReqMsgResponse struct { // HTTP header keys to delete from the response. DeletedHeaderKeys []string `json:"deleted_header_keys,omitempty"` // Tags to apply. - Tags []string `json:"tags,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} } type _InspectorReqMsgResponse InspectorReqMsgResponse @@ -340,6 +340,11 @@ func (o InspectorReqMsgResponse) ToMap() (map[string]interface{}, error) { if !IsNil(o.Tags) { toSerialize["tags"] = o.Tags } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -367,9 +372,7 @@ func (o *InspectorReqMsgResponse) UnmarshalJSON(data []byte) (err error) { varInspectorReqMsgResponse := _InspectorReqMsgResponse{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varInspectorReqMsgResponse) + err = json.Unmarshal(data, &varInspectorReqMsgResponse) if err != nil { return err @@ -377,6 +380,20 @@ func (o *InspectorReqMsgResponse) UnmarshalJSON(data []byte) (err error) { *o = InspectorReqMsgResponse(varInspectorReqMsgResponse) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "block") + delete(additionalProperties, "status_code") + delete(additionalProperties, "redirect_url") + delete(additionalProperties, "additional_header_keys") + delete(additionalProperties, "additional_header_values") + delete(additionalProperties, "deleted_header_keys") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_inspector_res_msg.go b/internal/apiclient/model_inspector_res_msg.go similarity index 92% rename from internal/client/model_inspector_res_msg.go rename to internal/apiclient/model_inspector_res_msg.go index dd00c55..a220044 100644 --- a/internal/client/model_inspector_res_msg.go +++ b/internal/apiclient/model_inspector_res_msg.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -31,7 +30,8 @@ type InspectorResMsg struct { // The HTTP response header values. Each value should have a corresponding header_keys at the matching index. HeaderValues []string `json:"header_values,omitempty"` // The HTTP status code. - StatusCode int32 `json:"status_code"` + StatusCode int32 `json:"status_code"` + AdditionalProperties map[string]interface{} } type _InspectorResMsg InspectorResMsg @@ -229,6 +229,11 @@ func (o InspectorResMsg) ToMap() (map[string]interface{}, error) { toSerialize["header_values"] = o.HeaderValues } toSerialize["status_code"] = o.StatusCode + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -256,9 +261,7 @@ func (o *InspectorResMsg) UnmarshalJSON(data []byte) (err error) { varInspectorResMsg := _InspectorResMsg{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varInspectorResMsg) + err = json.Unmarshal(data, &varInspectorResMsg) if err != nil { return err @@ -266,6 +269,17 @@ func (o *InspectorResMsg) UnmarshalJSON(data []byte) (err error) { *o = InspectorResMsg(varInspectorResMsg) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "truncated_body") + delete(additionalProperties, "body") + delete(additionalProperties, "header_keys") + delete(additionalProperties, "header_values") + delete(additionalProperties, "status_code") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_inspector_res_msg_response.go b/internal/apiclient/model_inspector_res_msg_response.go similarity index 93% rename from internal/client/model_inspector_res_msg_response.go rename to internal/apiclient/model_inspector_res_msg_response.go index 553a588..2a064b8 100644 --- a/internal/client/model_inspector_res_msg_response.go +++ b/internal/apiclient/model_inspector_res_msg_response.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -37,7 +36,8 @@ type InspectorResMsgResponse struct { // HTTP header keys to delete from the response. DeletedHeaderKeys []string `json:"deleted_header_keys,omitempty"` // Tags to apply. - Tags []string `json:"tags,omitempty"` + Tags []string `json:"tags,omitempty"` + AdditionalProperties map[string]interface{} } type _InspectorResMsgResponse InspectorResMsgResponse @@ -340,6 +340,11 @@ func (o InspectorResMsgResponse) ToMap() (map[string]interface{}, error) { if !IsNil(o.Tags) { toSerialize["tags"] = o.Tags } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -367,9 +372,7 @@ func (o *InspectorResMsgResponse) UnmarshalJSON(data []byte) (err error) { varInspectorResMsgResponse := _InspectorResMsgResponse{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varInspectorResMsgResponse) + err = json.Unmarshal(data, &varInspectorResMsgResponse) if err != nil { return err @@ -377,6 +380,20 @@ func (o *InspectorResMsgResponse) UnmarshalJSON(data []byte) (err error) { *o = InspectorResMsgResponse(varInspectorResMsgResponse) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "block") + delete(additionalProperties, "status_code") + delete(additionalProperties, "redirect_url") + delete(additionalProperties, "additional_header_keys") + delete(additionalProperties, "additional_header_values") + delete(additionalProperties, "deleted_header_keys") + delete(additionalProperties, "tags") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_list.go b/internal/apiclient/model_list.go similarity index 99% rename from internal/client/model_list.go rename to internal/apiclient/model_list.go index 8f423fb..14fa6c3 100644 --- a/internal/client/model_list.go +++ b/internal/apiclient/model_list.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_list_functionality.go b/internal/apiclient/model_list_functionality.go similarity index 97% rename from internal/client/model_list_functionality.go rename to internal/apiclient/model_list_functionality.go index efce33e..e041244 100644 --- a/internal/client/model_list_functionality.go +++ b/internal/apiclient/model_list_functionality.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" @@ -23,14 +23,12 @@ type ListFunctionality string const ( ADD ListFunctionality = "add" ADD_REMOVE ListFunctionality = "add/remove" - NONE ListFunctionality = "none" ) // All allowed values of ListFunctionality enum var AllowedListFunctionalityEnumValues = []ListFunctionality{ "add", "add/remove", - "none", } func (v *ListFunctionality) UnmarshalJSON(src []byte) error { diff --git a/internal/client/model_list_items_inner.go b/internal/apiclient/model_list_items_inner.go similarity index 99% rename from internal/client/model_list_items_inner.go rename to internal/apiclient/model_list_items_inner.go index f928512..89fff6a 100644 --- a/internal/client/model_list_items_inner.go +++ b/internal/apiclient/model_list_items_inner.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_list_kind.go b/internal/apiclient/model_list_kind.go similarity index 99% rename from internal/client/model_list_kind.go rename to internal/apiclient/model_list_kind.go index 3e7ec0f..a1b4009 100644 --- a/internal/client/model_list_kind.go +++ b/internal/apiclient/model_list_kind.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_list_patch_body.go b/internal/apiclient/model_list_patch_body.go similarity index 99% rename from internal/client/model_list_patch_body.go rename to internal/apiclient/model_list_patch_body.go index 832b0c3..49f8180 100644 --- a/internal/client/model_list_patch_body.go +++ b/internal/apiclient/model_list_patch_body.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_list_post_body.go b/internal/apiclient/model_list_post_body.go similarity index 99% rename from internal/client/model_list_post_body.go rename to internal/apiclient/model_list_post_body.go index 1195154..b425d78 100644 --- a/internal/client/model_list_post_body.go +++ b/internal/apiclient/model_list_post_body.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_list_subkind.go b/internal/apiclient/model_list_subkind.go similarity index 99% rename from internal/client/model_list_subkind.go rename to internal/apiclient/model_list_subkind.go index 9be02e3..79ed66c 100644 --- a/internal/client/model_list_subkind.go +++ b/internal/apiclient/model_list_subkind.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_lists.go b/internal/apiclient/model_lists.go similarity index 99% rename from internal/client/model_lists.go rename to internal/apiclient/model_lists.go index beaea1e..1209954 100644 --- a/internal/client/model_lists.go +++ b/internal/apiclient/model_lists.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_lists_items_inner.go b/internal/apiclient/model_lists_items_inner.go similarity index 99% rename from internal/client/model_lists_items_inner.go rename to internal/apiclient/model_lists_items_inner.go index 9822b4f..42862fc 100644 --- a/internal/client/model_lists_items_inner.go +++ b/internal/apiclient/model_lists_items_inner.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_log_binding.go b/internal/apiclient/model_log_binding.go similarity index 91% rename from internal/client/model_log_binding.go rename to internal/apiclient/model_log_binding.go index 8f84fe6..37074cc 100644 --- a/internal/client/model_log_binding.go +++ b/internal/apiclient/model_log_binding.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" "time" @@ -38,7 +37,8 @@ type LogBinding struct { // ID of the member that created the Logq binding. CreatedBy string `json:"created_by"` // The date the log binding was created. - CreatedAt time.Time `json:"created_at"` + CreatedAt time.Time `json:"created_at"` + AdditionalProperties map[string]interface{} } type _LogBinding LogBinding @@ -278,6 +278,11 @@ func (o LogBinding) ToMap() (map[string]interface{}, error) { toSerialize["spec_id"] = o.SpecId toSerialize["created_by"] = o.CreatedBy toSerialize["created_at"] = o.CreatedAt + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -312,9 +317,7 @@ func (o *LogBinding) UnmarshalJSON(data []byte) (err error) { varLogBinding := _LogBinding{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varLogBinding) + err = json.Unmarshal(data, &varLogBinding) if err != nil { return err @@ -322,6 +325,20 @@ func (o *LogBinding) UnmarshalJSON(data []byte) (err error) { *o = LogBinding(varLogBinding) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "logstream_id") + delete(additionalProperties, "pattern_type") + delete(additionalProperties, "pattern") + delete(additionalProperties, "spec_id") + delete(additionalProperties, "created_by") + delete(additionalProperties, "created_at") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_log_binding_post_body.go b/internal/apiclient/model_log_binding_post_body.go similarity index 88% rename from internal/client/model_log_binding_post_body.go rename to internal/apiclient/model_log_binding_post_body.go index b02a624..d4d6e33 100644 --- a/internal/client/model_log_binding_post_body.go +++ b/internal/apiclient/model_log_binding_post_body.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -22,11 +21,12 @@ var _ MappedNullable = &LogBindingPostBody{} // LogBindingPostBody struct for LogBindingPostBody type LogBindingPostBody struct { - Name string `json:"name"` - SpecId string `json:"spec_id"` - LogstreamId *string `json:"logstream_id,omitempty"` - Pattern string `json:"pattern"` - PatternType string `json:"pattern_type"` + Name string `json:"name"` + SpecId string `json:"spec_id"` + LogstreamId *string `json:"logstream_id,omitempty"` + Pattern string `json:"pattern"` + PatternType string `json:"pattern_type"` + AdditionalProperties map[string]interface{} } type _LogBindingPostBody LogBindingPostBody @@ -197,6 +197,11 @@ func (o LogBindingPostBody) ToMap() (map[string]interface{}, error) { } toSerialize["pattern"] = o.Pattern toSerialize["pattern_type"] = o.PatternType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -227,9 +232,7 @@ func (o *LogBindingPostBody) UnmarshalJSON(data []byte) (err error) { varLogBindingPostBody := _LogBindingPostBody{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varLogBindingPostBody) + err = json.Unmarshal(data, &varLogBindingPostBody) if err != nil { return err @@ -237,6 +240,17 @@ func (o *LogBindingPostBody) UnmarshalJSON(data []byte) (err error) { *o = LogBindingPostBody(varLogBindingPostBody) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "spec_id") + delete(additionalProperties, "logstream_id") + delete(additionalProperties, "pattern") + delete(additionalProperties, "pattern_type") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_log_binding_put_body.go b/internal/apiclient/model_log_binding_put_body.go similarity index 88% rename from internal/client/model_log_binding_put_body.go rename to internal/apiclient/model_log_binding_put_body.go index c3d6bc6..49157b8 100644 --- a/internal/client/model_log_binding_put_body.go +++ b/internal/apiclient/model_log_binding_put_body.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -22,11 +21,12 @@ var _ MappedNullable = &LogBindingPutBody{} // LogBindingPutBody struct for LogBindingPutBody type LogBindingPutBody struct { - Name string `json:"name"` - SpecId string `json:"spec_id"` - LogstreamId string `json:"logstream_id"` - Pattern string `json:"pattern"` - PatternType string `json:"pattern_type"` + Name string `json:"name"` + SpecId string `json:"spec_id"` + LogstreamId string `json:"logstream_id"` + Pattern string `json:"pattern"` + PatternType string `json:"pattern_type"` + AdditionalProperties map[string]interface{} } type _LogBindingPutBody LogBindingPutBody @@ -188,6 +188,11 @@ func (o LogBindingPutBody) ToMap() (map[string]interface{}, error) { toSerialize["logstream_id"] = o.LogstreamId toSerialize["pattern"] = o.Pattern toSerialize["pattern_type"] = o.PatternType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -219,9 +224,7 @@ func (o *LogBindingPutBody) UnmarshalJSON(data []byte) (err error) { varLogBindingPutBody := _LogBindingPutBody{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varLogBindingPutBody) + err = json.Unmarshal(data, &varLogBindingPutBody) if err != nil { return err @@ -229,6 +232,17 @@ func (o *LogBindingPutBody) UnmarshalJSON(data []byte) (err error) { *o = LogBindingPutBody(varLogBindingPutBody) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "spec_id") + delete(additionalProperties, "logstream_id") + delete(additionalProperties, "pattern") + delete(additionalProperties, "pattern_type") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_log_bindings.go b/internal/apiclient/model_log_bindings.go similarity index 88% rename from internal/client/model_log_bindings.go rename to internal/apiclient/model_log_bindings.go index 34d2564..32394fa 100644 --- a/internal/client/model_log_bindings.go +++ b/internal/apiclient/model_log_bindings.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -23,8 +22,9 @@ var _ MappedNullable = &LogBindings{} // LogBindings struct for LogBindings type LogBindings struct { // A list of log bindings. - Items []LogBinding `json:"items"` - Meta CollectionMeta `json:"meta"` + Items []LogBinding `json:"items"` + Meta CollectionMeta `json:"meta"` + AdditionalProperties map[string]interface{} } type _LogBindings LogBindings @@ -108,6 +108,11 @@ func (o LogBindings) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["items"] = o.Items toSerialize["meta"] = o.Meta + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -136,9 +141,7 @@ func (o *LogBindings) UnmarshalJSON(data []byte) (err error) { varLogBindings := _LogBindings{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varLogBindings) + err = json.Unmarshal(data, &varLogBindings) if err != nil { return err @@ -146,6 +149,14 @@ func (o *LogBindings) UnmarshalJSON(data []byte) (err error) { *o = LogBindings(varLogBindings) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_notification_template.go b/internal/apiclient/model_notification_template.go similarity index 92% rename from internal/client/model_notification_template.go rename to internal/apiclient/model_notification_template.go index 8014732..ecb2d4c 100644 --- a/internal/client/model_notification_template.go +++ b/internal/apiclient/model_notification_template.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" "time" @@ -42,7 +41,8 @@ type NotificationTemplate struct { // ID of the member who last updated the notification template. UpdatedBy NullableString `json:"updated_by"` // The date of when the notification template was last updated. - UpdatedAt NullableTime `json:"updated_at"` + UpdatedAt NullableTime `json:"updated_at"` + AdditionalProperties map[string]interface{} } type _NotificationTemplate NotificationTemplate @@ -338,6 +338,11 @@ func (o NotificationTemplate) ToMap() (map[string]interface{}, error) { toSerialize["created_at"] = o.CreatedAt toSerialize["updated_by"] = o.UpdatedBy.Get() toSerialize["updated_at"] = o.UpdatedAt.Get() + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -374,9 +379,7 @@ func (o *NotificationTemplate) UnmarshalJSON(data []byte) (err error) { varNotificationTemplate := _NotificationTemplate{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varNotificationTemplate) + err = json.Unmarshal(data, &varNotificationTemplate) if err != nil { return err @@ -384,6 +387,22 @@ func (o *NotificationTemplate) UnmarshalJSON(data []byte) (err error) { *o = NotificationTemplate(varNotificationTemplate) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "connector_id") + delete(additionalProperties, "name") + delete(additionalProperties, "payload") + delete(additionalProperties, "subject") + delete(additionalProperties, "destination") + delete(additionalProperties, "created_by") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_by") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_notification_template_post_body.go b/internal/apiclient/model_notification_template_post_body.go similarity index 66% rename from internal/client/model_notification_template_post_body.go rename to internal/apiclient/model_notification_template_post_body.go index fe8c952..bbe1e96 100644 --- a/internal/client/model_notification_template_post_body.go +++ b/internal/apiclient/model_notification_template_post_body.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -29,9 +28,12 @@ type NotificationTemplatePostBody struct { // The text payload to be sent in a notification. Payload string `json:"payload"` // The text for the subject of the message payload. - Subject string `json:"subject"` + Subject *string `json:"subject,omitempty"` // An array of ids for where the notification should be sent. - Destination []string `json:"destination"` + Destination []string `json:"destination,omitempty"` + // The payload to sign using a predefined hmac key. (Ex. \"{{timeTriggered}}.{{URL}}.{{REQUEST_BODY}}\") + HmacPayloadToSign *string `json:"hmac_payload_to_sign,omitempty"` + AdditionalProperties map[string]interface{} } type _NotificationTemplatePostBody NotificationTemplatePostBody @@ -40,13 +42,11 @@ type _NotificationTemplatePostBody NotificationTemplatePostBody // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewNotificationTemplatePostBody(connectorId string, name string, payload string, subject string, destination []string) *NotificationTemplatePostBody { +func NewNotificationTemplatePostBody(connectorId string, name string, payload string) *NotificationTemplatePostBody { this := NotificationTemplatePostBody{} this.ConnectorId = connectorId this.Name = name this.Payload = payload - this.Subject = subject - this.Destination = destination return &this } @@ -130,54 +130,102 @@ func (o *NotificationTemplatePostBody) SetPayload(v string) { o.Payload = v } -// GetSubject returns the Subject field value +// GetSubject returns the Subject field value if set, zero value otherwise. func (o *NotificationTemplatePostBody) GetSubject() string { - if o == nil { + if o == nil || IsNil(o.Subject) { var ret string return ret } - - return o.Subject + return *o.Subject } -// GetSubjectOk returns a tuple with the Subject field value +// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *NotificationTemplatePostBody) GetSubjectOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Subject) { return nil, false } - return &o.Subject, true + return o.Subject, true +} + +// HasSubject returns a boolean if a field has been set. +func (o *NotificationTemplatePostBody) HasSubject() bool { + if o != nil && !IsNil(o.Subject) { + return true + } + + return false } -// SetSubject sets field value +// SetSubject gets a reference to the given string and assigns it to the Subject field. func (o *NotificationTemplatePostBody) SetSubject(v string) { - o.Subject = v + o.Subject = &v } -// GetDestination returns the Destination field value +// GetDestination returns the Destination field value if set, zero value otherwise. func (o *NotificationTemplatePostBody) GetDestination() []string { - if o == nil { + if o == nil || IsNil(o.Destination) { var ret []string return ret } - return o.Destination } -// GetDestinationOk returns a tuple with the Destination field value +// GetDestinationOk returns a tuple with the Destination field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *NotificationTemplatePostBody) GetDestinationOk() ([]string, bool) { - if o == nil { + if o == nil || IsNil(o.Destination) { return nil, false } return o.Destination, true } -// SetDestination sets field value +// HasDestination returns a boolean if a field has been set. +func (o *NotificationTemplatePostBody) HasDestination() bool { + if o != nil && !IsNil(o.Destination) { + return true + } + + return false +} + +// SetDestination gets a reference to the given []string and assigns it to the Destination field. func (o *NotificationTemplatePostBody) SetDestination(v []string) { o.Destination = v } +// GetHmacPayloadToSign returns the HmacPayloadToSign field value if set, zero value otherwise. +func (o *NotificationTemplatePostBody) GetHmacPayloadToSign() string { + if o == nil || IsNil(o.HmacPayloadToSign) { + var ret string + return ret + } + return *o.HmacPayloadToSign +} + +// GetHmacPayloadToSignOk returns a tuple with the HmacPayloadToSign field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotificationTemplatePostBody) GetHmacPayloadToSignOk() (*string, bool) { + if o == nil || IsNil(o.HmacPayloadToSign) { + return nil, false + } + return o.HmacPayloadToSign, true +} + +// HasHmacPayloadToSign returns a boolean if a field has been set. +func (o *NotificationTemplatePostBody) HasHmacPayloadToSign() bool { + if o != nil && !IsNil(o.HmacPayloadToSign) { + return true + } + + return false +} + +// SetHmacPayloadToSign gets a reference to the given string and assigns it to the HmacPayloadToSign field. +func (o *NotificationTemplatePostBody) SetHmacPayloadToSign(v string) { + o.HmacPayloadToSign = &v +} + func (o NotificationTemplatePostBody) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -191,8 +239,20 @@ func (o NotificationTemplatePostBody) ToMap() (map[string]interface{}, error) { toSerialize["connector_id"] = o.ConnectorId toSerialize["name"] = o.Name toSerialize["payload"] = o.Payload - toSerialize["subject"] = o.Subject - toSerialize["destination"] = o.Destination + if !IsNil(o.Subject) { + toSerialize["subject"] = o.Subject + } + if !IsNil(o.Destination) { + toSerialize["destination"] = o.Destination + } + if !IsNil(o.HmacPayloadToSign) { + toSerialize["hmac_payload_to_sign"] = o.HmacPayloadToSign + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -204,8 +264,6 @@ func (o *NotificationTemplatePostBody) UnmarshalJSON(data []byte) (err error) { "connector_id", "name", "payload", - "subject", - "destination", } allProperties := make(map[string]interface{}) @@ -224,9 +282,7 @@ func (o *NotificationTemplatePostBody) UnmarshalJSON(data []byte) (err error) { varNotificationTemplatePostBody := _NotificationTemplatePostBody{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varNotificationTemplatePostBody) + err = json.Unmarshal(data, &varNotificationTemplatePostBody) if err != nil { return err @@ -234,6 +290,18 @@ func (o *NotificationTemplatePostBody) UnmarshalJSON(data []byte) (err error) { *o = NotificationTemplatePostBody(varNotificationTemplatePostBody) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "connector_id") + delete(additionalProperties, "name") + delete(additionalProperties, "payload") + delete(additionalProperties, "subject") + delete(additionalProperties, "destination") + delete(additionalProperties, "hmac_payload_to_sign") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_notification_templates.go b/internal/apiclient/model_notification_templates.go similarity index 88% rename from internal/client/model_notification_templates.go rename to internal/apiclient/model_notification_templates.go index e591012..a61b3d3 100644 --- a/internal/client/model_notification_templates.go +++ b/internal/apiclient/model_notification_templates.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -23,8 +22,9 @@ var _ MappedNullable = &NotificationTemplates{} // NotificationTemplates struct for NotificationTemplates type NotificationTemplates struct { // A list of notification templates. - Items []NotificationTemplate `json:"items"` - Meta CollectionMeta `json:"meta"` + Items []NotificationTemplate `json:"items"` + Meta CollectionMeta `json:"meta"` + AdditionalProperties map[string]interface{} } type _NotificationTemplates NotificationTemplates @@ -108,6 +108,11 @@ func (o NotificationTemplates) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["items"] = o.Items toSerialize["meta"] = o.Meta + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -136,9 +141,7 @@ func (o *NotificationTemplates) UnmarshalJSON(data []byte) (err error) { varNotificationTemplates := _NotificationTemplates{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varNotificationTemplates) + err = json.Unmarshal(data, &varNotificationTemplates) if err != nil { return err @@ -146,6 +149,14 @@ func (o *NotificationTemplates) UnmarshalJSON(data []byte) (err error) { *o = NotificationTemplates(varNotificationTemplates) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_problem_response.go b/internal/apiclient/model_problem_response.go similarity index 99% rename from internal/client/model_problem_response.go rename to internal/apiclient/model_problem_response.go index 0b6a82c..545e06b 100644 --- a/internal/client/model_problem_response.go +++ b/internal/apiclient/model_problem_response.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_revision.go b/internal/apiclient/model_revision.go similarity index 89% rename from internal/client/model_revision.go rename to internal/apiclient/model_revision.go index fcd1c81..e4e756a 100644 --- a/internal/client/model_revision.go +++ b/internal/apiclient/model_revision.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" "time" @@ -26,7 +25,8 @@ type Revision struct { Revision int32 `json:"revision"` CreatedBy string `json:"created_by"` // The date and time in [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339) format. - CreatedAt time.Time `json:"created_at"` + CreatedAt time.Time `json:"created_at"` + AdditionalProperties map[string]interface{} } type _Revision Revision @@ -136,6 +136,11 @@ func (o Revision) ToMap() (map[string]interface{}, error) { toSerialize["revision"] = o.Revision toSerialize["created_by"] = o.CreatedBy toSerialize["created_at"] = o.CreatedAt + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -165,9 +170,7 @@ func (o *Revision) UnmarshalJSON(data []byte) (err error) { varRevision := _Revision{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varRevision) + err = json.Unmarshal(data, &varRevision) if err != nil { return err @@ -175,6 +178,15 @@ func (o *Revision) UnmarshalJSON(data []byte) (err error) { *o = Revision(varRevision) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "revision") + delete(additionalProperties, "created_by") + delete(additionalProperties, "created_at") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_rules_dependencies_put_body_inner.go b/internal/apiclient/model_rules_dependencies_put_body_inner.go similarity index 90% rename from internal/client/model_rules_dependencies_put_body_inner.go rename to internal/apiclient/model_rules_dependencies_put_body_inner.go index 2e03c29..a21288a 100644 --- a/internal/client/model_rules_dependencies_put_body_inner.go +++ b/internal/apiclient/model_rules_dependencies_put_body_inner.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -25,7 +24,8 @@ type RulesDependenciesPutBodyInner struct { // The rule ID. RuleId string `json:"rule_id"` // The IDs of the rule dependencies. - Dependencies []string `json:"dependencies"` + Dependencies []string `json:"dependencies"` + AdditionalProperties map[string]interface{} } type _RulesDependenciesPutBodyInner RulesDependenciesPutBodyInner @@ -109,6 +109,11 @@ func (o RulesDependenciesPutBodyInner) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["rule_id"] = o.RuleId toSerialize["dependencies"] = o.Dependencies + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -137,9 +142,7 @@ func (o *RulesDependenciesPutBodyInner) UnmarshalJSON(data []byte) (err error) { varRulesDependenciesPutBodyInner := _RulesDependenciesPutBodyInner{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varRulesDependenciesPutBodyInner) + err = json.Unmarshal(data, &varRulesDependenciesPutBodyInner) if err != nil { return err @@ -147,6 +150,14 @@ func (o *RulesDependenciesPutBodyInner) UnmarshalJSON(data []byte) (err error) { *o = RulesDependenciesPutBodyInner(varRulesDependenciesPutBodyInner) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "rule_id") + delete(additionalProperties, "dependencies") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_rules_script.go b/internal/apiclient/model_rules_script.go similarity index 99% rename from internal/client/model_rules_script.go rename to internal/apiclient/model_rules_script.go index 22aa960..0e2befd 100644 --- a/internal/client/model_rules_script.go +++ b/internal/apiclient/model_rules_script.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_script_post_body.go b/internal/apiclient/model_rules_script_post_body.go similarity index 87% rename from internal/client/model_rules_script_post_body.go rename to internal/apiclient/model_rules_script_post_body.go index 758f3c1..f676b98 100644 --- a/internal/client/model_rules_script_post_body.go +++ b/internal/apiclient/model_rules_script_post_body.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" @@ -26,6 +26,7 @@ type RulesScriptPostBody struct { Disabled bool `json:"disabled"` BlockingEffect *BlockingEffectType `json:"blocking_effect,omitempty"` Src string `json:"src"` + Lang *string `json:"lang,omitempty"` AdditionalProperties map[string]interface{} } @@ -39,7 +40,11 @@ func NewRulesScriptPostBody(name string, disabled bool, src string) *RulesScript this := RulesScriptPostBody{} this.Name = name this.Disabled = disabled + var blockingEffect BlockingEffectType = BLOCK + this.BlockingEffect = &blockingEffect this.Src = src + var lang string = "assemblyscript" + this.Lang = &lang return &this } @@ -50,6 +55,8 @@ func NewRulesScriptPostBodyWithDefaults() *RulesScriptPostBody { this := RulesScriptPostBody{} var blockingEffect BlockingEffectType = BLOCK this.BlockingEffect = &blockingEffect + var lang string = "assemblyscript" + this.Lang = &lang return &this } @@ -189,6 +196,38 @@ func (o *RulesScriptPostBody) SetSrc(v string) { o.Src = v } +// GetLang returns the Lang field value if set, zero value otherwise. +func (o *RulesScriptPostBody) GetLang() string { + if o == nil || IsNil(o.Lang) { + var ret string + return ret + } + return *o.Lang +} + +// GetLangOk returns a tuple with the Lang field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesScriptPostBody) GetLangOk() (*string, bool) { + if o == nil || IsNil(o.Lang) { + return nil, false + } + return o.Lang, true +} + +// HasLang returns a boolean if a field has been set. +func (o *RulesScriptPostBody) HasLang() bool { + if o != nil && !IsNil(o.Lang) { + return true + } + + return false +} + +// SetLang gets a reference to the given string and assigns it to the Lang field. +func (o *RulesScriptPostBody) SetLang(v string) { + o.Lang = &v +} + func (o RulesScriptPostBody) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -208,6 +247,9 @@ func (o RulesScriptPostBody) ToMap() (map[string]interface{}, error) { toSerialize["blocking_effect"] = o.BlockingEffect } toSerialize["src"] = o.Src + if !IsNil(o.Lang) { + toSerialize["lang"] = o.Lang + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -258,6 +300,7 @@ func (o *RulesScriptPostBody) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "disabled") delete(additionalProperties, "blocking_effect") delete(additionalProperties, "src") + delete(additionalProperties, "lang") o.AdditionalProperties = additionalProperties } diff --git a/internal/client/model_rules_scripts.go b/internal/apiclient/model_rules_scripts.go similarity index 88% rename from internal/client/model_rules_scripts.go rename to internal/apiclient/model_rules_scripts.go index 9f60759..ee46e07 100644 --- a/internal/client/model_rules_scripts.go +++ b/internal/apiclient/model_rules_scripts.go @@ -9,10 +9,9 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( - "bytes" "encoding/json" "fmt" ) @@ -22,8 +21,9 @@ var _ MappedNullable = &RulesScripts{} // RulesScripts struct for RulesScripts type RulesScripts struct { - Items []RulesScript `json:"items"` - Meta CollectionMeta `json:"meta"` + Items []RulesScript `json:"items"` + Meta CollectionMeta `json:"meta"` + AdditionalProperties map[string]interface{} } type _RulesScripts RulesScripts @@ -107,6 +107,11 @@ func (o RulesScripts) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["items"] = o.Items toSerialize["meta"] = o.Meta + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } @@ -135,9 +140,7 @@ func (o *RulesScripts) UnmarshalJSON(data []byte) (err error) { varRulesScripts := _RulesScripts{} - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varRulesScripts) + err = json.Unmarshal(data, &varRulesScripts) if err != nil { return err @@ -145,6 +148,14 @@ func (o *RulesScripts) UnmarshalJSON(data []byte) (err error) { *o = RulesScripts(varRulesScripts) + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "meta") + o.AdditionalProperties = additionalProperties + } + return err } diff --git a/internal/client/model_rules_test_case.go b/internal/apiclient/model_rules_test_case.go similarity index 91% rename from internal/client/model_rules_test_case.go rename to internal/apiclient/model_rules_test_case.go index 3d84de3..6d32b8d 100644 --- a/internal/client/model_rules_test_case.go +++ b/internal/apiclient/model_rules_test_case.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" @@ -28,6 +28,8 @@ type RulesTestCase struct { Name string `json:"name"` // The description of the test case. Description string `json:"description"` + // Whether the test case is required to pass when creating or updating rules. + Required bool `json:"required"` // The messages of the test case. Messages []RulesTestCaseMessagesInner `json:"messages"` // Assertions for the test case. @@ -49,11 +51,12 @@ type _RulesTestCase RulesTestCase // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewRulesTestCase(id string, name string, description string, messages []RulesTestCaseMessagesInner, assertions []RulesTestCaseAssertion, createdBy string, createdAt time.Time, updatedBy NullableString, updatedAt NullableTime) *RulesTestCase { +func NewRulesTestCase(id string, name string, description string, required bool, messages []RulesTestCaseMessagesInner, assertions []RulesTestCaseAssertion, createdBy string, createdAt time.Time, updatedBy NullableString, updatedAt NullableTime) *RulesTestCase { this := RulesTestCase{} this.Id = id this.Name = name this.Description = description + this.Required = required this.Messages = messages this.Assertions = assertions this.CreatedBy = createdBy @@ -68,6 +71,8 @@ func NewRulesTestCase(id string, name string, description string, messages []Rul // but it doesn't guarantee that properties required by API are set func NewRulesTestCaseWithDefaults() *RulesTestCase { this := RulesTestCase{} + var required bool = false + this.Required = required return &this } @@ -143,6 +148,30 @@ func (o *RulesTestCase) SetDescription(v string) { o.Description = v } +// GetRequired returns the Required field value +func (o *RulesTestCase) GetRequired() bool { + if o == nil { + var ret bool + return ret + } + + return o.Required +} + +// GetRequiredOk returns a tuple with the Required field value +// and a boolean to check if the value has been set. +func (o *RulesTestCase) GetRequiredOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Required, true +} + +// SetRequired sets field value +func (o *RulesTestCase) SetRequired(v bool) { + o.Required = v +} + // GetMessages returns the Messages field value func (o *RulesTestCase) GetMessages() []RulesTestCaseMessagesInner { if o == nil { @@ -304,6 +333,7 @@ func (o RulesTestCase) ToMap() (map[string]interface{}, error) { toSerialize["id"] = o.Id toSerialize["name"] = o.Name toSerialize["description"] = o.Description + toSerialize["required"] = o.Required toSerialize["messages"] = o.Messages toSerialize["assertions"] = o.Assertions toSerialize["created_by"] = o.CreatedBy @@ -326,6 +356,7 @@ func (o *RulesTestCase) UnmarshalJSON(data []byte) (err error) { "id", "name", "description", + "required", "messages", "assertions", "created_by", @@ -364,6 +395,7 @@ func (o *RulesTestCase) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "id") delete(additionalProperties, "name") delete(additionalProperties, "description") + delete(additionalProperties, "required") delete(additionalProperties, "messages") delete(additionalProperties, "assertions") delete(additionalProperties, "created_by") diff --git a/internal/client/model_rules_test_case_assertion.go b/internal/apiclient/model_rules_test_case_assertion.go similarity index 99% rename from internal/client/model_rules_test_case_assertion.go rename to internal/apiclient/model_rules_test_case_assertion.go index f62c41d..27d3f53 100644 --- a/internal/client/model_rules_test_case_assertion.go +++ b/internal/apiclient/model_rules_test_case_assertion.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_assertion_block.go b/internal/apiclient/model_rules_test_case_assertion_block.go similarity index 99% rename from internal/client/model_rules_test_case_assertion_block.go rename to internal/apiclient/model_rules_test_case_assertion_block.go index dbfa4a8..1b123c6 100644 --- a/internal/client/model_rules_test_case_assertion_block.go +++ b/internal/apiclient/model_rules_test_case_assertion_block.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_assertion_condition_default.go b/internal/apiclient/model_rules_test_case_assertion_condition_default.go similarity index 99% rename from internal/client/model_rules_test_case_assertion_condition_default.go rename to internal/apiclient/model_rules_test_case_assertion_condition_default.go index 6ffc28c..33db921 100644 --- a/internal/client/model_rules_test_case_assertion_condition_default.go +++ b/internal/apiclient/model_rules_test_case_assertion_condition_default.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_assertion_condition_presence.go b/internal/apiclient/model_rules_test_case_assertion_condition_presence.go similarity index 99% rename from internal/client/model_rules_test_case_assertion_condition_presence.go rename to internal/apiclient/model_rules_test_case_assertion_condition_presence.go index 23906fb..37e6eca 100644 --- a/internal/client/model_rules_test_case_assertion_condition_presence.go +++ b/internal/apiclient/model_rules_test_case_assertion_condition_presence.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_assertion_output.go b/internal/apiclient/model_rules_test_case_assertion_output.go similarity index 99% rename from internal/client/model_rules_test_case_assertion_output.go rename to internal/apiclient/model_rules_test_case_assertion_output.go index 6dfe173..20c2924 100644 --- a/internal/client/model_rules_test_case_assertion_output.go +++ b/internal/apiclient/model_rules_test_case_assertion_output.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_assertion_status_code.go b/internal/apiclient/model_rules_test_case_assertion_status_code.go similarity index 99% rename from internal/client/model_rules_test_case_assertion_status_code.go rename to internal/apiclient/model_rules_test_case_assertion_status_code.go index 7dd45a0..3938b68 100644 --- a/internal/client/model_rules_test_case_assertion_status_code.go +++ b/internal/apiclient/model_rules_test_case_assertion_status_code.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_assertion_tags.go b/internal/apiclient/model_rules_test_case_assertion_tags.go similarity index 99% rename from internal/client/model_rules_test_case_assertion_tags.go rename to internal/apiclient/model_rules_test_case_assertion_tags.go index e71796e..24e4cc9 100644 --- a/internal/client/model_rules_test_case_assertion_tags.go +++ b/internal/apiclient/model_rules_test_case_assertion_tags.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_message_definition_position.go b/internal/apiclient/model_rules_test_case_message_definition_position.go similarity index 99% rename from internal/client/model_rules_test_case_message_definition_position.go rename to internal/apiclient/model_rules_test_case_message_definition_position.go index 54a0fb5..6909b50 100644 --- a/internal/client/model_rules_test_case_message_definition_position.go +++ b/internal/apiclient/model_rules_test_case_message_definition_position.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_messages_inner.go b/internal/apiclient/model_rules_test_case_messages_inner.go similarity index 99% rename from internal/client/model_rules_test_case_messages_inner.go rename to internal/apiclient/model_rules_test_case_messages_inner.go index 24f1d8a..ba055d1 100644 --- a/internal/client/model_rules_test_case_messages_inner.go +++ b/internal/apiclient/model_rules_test_case_messages_inner.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_post_body.go b/internal/apiclient/model_rules_test_case_post_body.go similarity index 86% rename from internal/client/model_rules_test_case_post_body.go rename to internal/apiclient/model_rules_test_case_post_body.go index 12f623e..89f4fe9 100644 --- a/internal/client/model_rules_test_case_post_body.go +++ b/internal/apiclient/model_rules_test_case_post_body.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" @@ -25,6 +25,8 @@ type RulesTestCasePostBody struct { Name string `json:"name"` // The description of the test case Description *string `json:"description,omitempty"` + // Whether the test case is required to pass when creating or updating rules. + Required *bool `json:"required,omitempty"` // The messages of the test case. Messages []RulesTestCaseMessagesInner `json:"messages"` // Assertions for the test case. @@ -41,6 +43,8 @@ type _RulesTestCasePostBody RulesTestCasePostBody func NewRulesTestCasePostBody(name string, messages []RulesTestCaseMessagesInner) *RulesTestCasePostBody { this := RulesTestCasePostBody{} this.Name = name + var required bool = false + this.Required = &required this.Messages = messages return &this } @@ -50,6 +54,8 @@ func NewRulesTestCasePostBody(name string, messages []RulesTestCaseMessagesInner // but it doesn't guarantee that properties required by API are set func NewRulesTestCasePostBodyWithDefaults() *RulesTestCasePostBody { this := RulesTestCasePostBody{} + var required bool = false + this.Required = &required return &this } @@ -109,6 +115,38 @@ func (o *RulesTestCasePostBody) SetDescription(v string) { o.Description = &v } +// GetRequired returns the Required field value if set, zero value otherwise. +func (o *RulesTestCasePostBody) GetRequired() bool { + if o == nil || IsNil(o.Required) { + var ret bool + return ret + } + return *o.Required +} + +// GetRequiredOk returns a tuple with the Required field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCasePostBody) GetRequiredOk() (*bool, bool) { + if o == nil || IsNil(o.Required) { + return nil, false + } + return o.Required, true +} + +// HasRequired returns a boolean if a field has been set. +func (o *RulesTestCasePostBody) HasRequired() bool { + if o != nil && !IsNil(o.Required) { + return true + } + + return false +} + +// SetRequired gets a reference to the given bool and assigns it to the Required field. +func (o *RulesTestCasePostBody) SetRequired(v bool) { + o.Required = &v +} + // GetMessages returns the Messages field value func (o *RulesTestCasePostBody) GetMessages() []RulesTestCaseMessagesInner { if o == nil { @@ -179,6 +217,9 @@ func (o RulesTestCasePostBody) ToMap() (map[string]interface{}, error) { if !IsNil(o.Description) { toSerialize["description"] = o.Description } + if !IsNil(o.Required) { + toSerialize["required"] = o.Required + } toSerialize["messages"] = o.Messages if !IsNil(o.Assertions) { toSerialize["assertions"] = o.Assertions @@ -229,6 +270,7 @@ func (o *RulesTestCasePostBody) UnmarshalJSON(data []byte) (err error) { if err = json.Unmarshal(data, &additionalProperties); err == nil { delete(additionalProperties, "name") delete(additionalProperties, "description") + delete(additionalProperties, "required") delete(additionalProperties, "messages") delete(additionalProperties, "assertions") o.AdditionalProperties = additionalProperties diff --git a/internal/apiclient/model_rules_test_case_run_post_body.go b/internal/apiclient/model_rules_test_case_run_post_body.go new file mode 100644 index 0000000..847c926 --- /dev/null +++ b/internal/apiclient/model_rules_test_case_run_post_body.go @@ -0,0 +1,320 @@ +/* +Impart Security v0 REST API + +Imparts v0 REST API. + +API version: 0.0.0 +Contact: support@impart.security +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "fmt" +) + +// checks if the RulesTestCaseRunPostBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RulesTestCaseRunPostBody{} + +// RulesTestCaseRunPostBody struct for RulesTestCaseRunPostBody +type RulesTestCaseRunPostBody struct { + // The messages of the test case. + Messages []RulesTestCaseMessagesInner `json:"messages"` + // Assertions for the test case. + Assertions []RulesTestCaseAssertion `json:"assertions,omitempty"` + // Define rule overrides for a test run. + EnabledOverrides []RulesTestCaseRunPostBodyEnabledOverridesInner `json:"enabled_overrides,omitempty"` + // A list of rule ids that should be disabled for the test run. + DisabledOverrides []RulesTestCaseRunPostBodyDisabledOverridesInner `json:"disabled_overrides,omitempty"` + // A list of rule ids that should have their blocking effect overridden for the test run. + BlockingEffectOverrides []RulesTestCaseRunPostBodyBlockingEffectOverridesInner `json:"blocking_effect_overrides,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _RulesTestCaseRunPostBody RulesTestCaseRunPostBody + +// NewRulesTestCaseRunPostBody instantiates a new RulesTestCaseRunPostBody object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRulesTestCaseRunPostBody(messages []RulesTestCaseMessagesInner) *RulesTestCaseRunPostBody { + this := RulesTestCaseRunPostBody{} + this.Messages = messages + return &this +} + +// NewRulesTestCaseRunPostBodyWithDefaults instantiates a new RulesTestCaseRunPostBody object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRulesTestCaseRunPostBodyWithDefaults() *RulesTestCaseRunPostBody { + this := RulesTestCaseRunPostBody{} + return &this +} + +// GetMessages returns the Messages field value +func (o *RulesTestCaseRunPostBody) GetMessages() []RulesTestCaseMessagesInner { + if o == nil { + var ret []RulesTestCaseMessagesInner + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBody) GetMessagesOk() ([]RulesTestCaseMessagesInner, bool) { + if o == nil { + return nil, false + } + return o.Messages, true +} + +// SetMessages sets field value +func (o *RulesTestCaseRunPostBody) SetMessages(v []RulesTestCaseMessagesInner) { + o.Messages = v +} + +// GetAssertions returns the Assertions field value if set, zero value otherwise. +func (o *RulesTestCaseRunPostBody) GetAssertions() []RulesTestCaseAssertion { + if o == nil || IsNil(o.Assertions) { + var ret []RulesTestCaseAssertion + return ret + } + return o.Assertions +} + +// GetAssertionsOk returns a tuple with the Assertions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBody) GetAssertionsOk() ([]RulesTestCaseAssertion, bool) { + if o == nil || IsNil(o.Assertions) { + return nil, false + } + return o.Assertions, true +} + +// HasAssertions returns a boolean if a field has been set. +func (o *RulesTestCaseRunPostBody) HasAssertions() bool { + if o != nil && !IsNil(o.Assertions) { + return true + } + + return false +} + +// SetAssertions gets a reference to the given []RulesTestCaseAssertion and assigns it to the Assertions field. +func (o *RulesTestCaseRunPostBody) SetAssertions(v []RulesTestCaseAssertion) { + o.Assertions = v +} + +// GetEnabledOverrides returns the EnabledOverrides field value if set, zero value otherwise. +func (o *RulesTestCaseRunPostBody) GetEnabledOverrides() []RulesTestCaseRunPostBodyEnabledOverridesInner { + if o == nil || IsNil(o.EnabledOverrides) { + var ret []RulesTestCaseRunPostBodyEnabledOverridesInner + return ret + } + return o.EnabledOverrides +} + +// GetEnabledOverridesOk returns a tuple with the EnabledOverrides field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBody) GetEnabledOverridesOk() ([]RulesTestCaseRunPostBodyEnabledOverridesInner, bool) { + if o == nil || IsNil(o.EnabledOverrides) { + return nil, false + } + return o.EnabledOverrides, true +} + +// HasEnabledOverrides returns a boolean if a field has been set. +func (o *RulesTestCaseRunPostBody) HasEnabledOverrides() bool { + if o != nil && !IsNil(o.EnabledOverrides) { + return true + } + + return false +} + +// SetEnabledOverrides gets a reference to the given []RulesTestCaseRunPostBodyEnabledOverridesInner and assigns it to the EnabledOverrides field. +func (o *RulesTestCaseRunPostBody) SetEnabledOverrides(v []RulesTestCaseRunPostBodyEnabledOverridesInner) { + o.EnabledOverrides = v +} + +// GetDisabledOverrides returns the DisabledOverrides field value if set, zero value otherwise. +func (o *RulesTestCaseRunPostBody) GetDisabledOverrides() []RulesTestCaseRunPostBodyDisabledOverridesInner { + if o == nil || IsNil(o.DisabledOverrides) { + var ret []RulesTestCaseRunPostBodyDisabledOverridesInner + return ret + } + return o.DisabledOverrides +} + +// GetDisabledOverridesOk returns a tuple with the DisabledOverrides field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBody) GetDisabledOverridesOk() ([]RulesTestCaseRunPostBodyDisabledOverridesInner, bool) { + if o == nil || IsNil(o.DisabledOverrides) { + return nil, false + } + return o.DisabledOverrides, true +} + +// HasDisabledOverrides returns a boolean if a field has been set. +func (o *RulesTestCaseRunPostBody) HasDisabledOverrides() bool { + if o != nil && !IsNil(o.DisabledOverrides) { + return true + } + + return false +} + +// SetDisabledOverrides gets a reference to the given []RulesTestCaseRunPostBodyDisabledOverridesInner and assigns it to the DisabledOverrides field. +func (o *RulesTestCaseRunPostBody) SetDisabledOverrides(v []RulesTestCaseRunPostBodyDisabledOverridesInner) { + o.DisabledOverrides = v +} + +// GetBlockingEffectOverrides returns the BlockingEffectOverrides field value if set, zero value otherwise. +func (o *RulesTestCaseRunPostBody) GetBlockingEffectOverrides() []RulesTestCaseRunPostBodyBlockingEffectOverridesInner { + if o == nil || IsNil(o.BlockingEffectOverrides) { + var ret []RulesTestCaseRunPostBodyBlockingEffectOverridesInner + return ret + } + return o.BlockingEffectOverrides +} + +// GetBlockingEffectOverridesOk returns a tuple with the BlockingEffectOverrides field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBody) GetBlockingEffectOverridesOk() ([]RulesTestCaseRunPostBodyBlockingEffectOverridesInner, bool) { + if o == nil || IsNil(o.BlockingEffectOverrides) { + return nil, false + } + return o.BlockingEffectOverrides, true +} + +// HasBlockingEffectOverrides returns a boolean if a field has been set. +func (o *RulesTestCaseRunPostBody) HasBlockingEffectOverrides() bool { + if o != nil && !IsNil(o.BlockingEffectOverrides) { + return true + } + + return false +} + +// SetBlockingEffectOverrides gets a reference to the given []RulesTestCaseRunPostBodyBlockingEffectOverridesInner and assigns it to the BlockingEffectOverrides field. +func (o *RulesTestCaseRunPostBody) SetBlockingEffectOverrides(v []RulesTestCaseRunPostBodyBlockingEffectOverridesInner) { + o.BlockingEffectOverrides = v +} + +func (o RulesTestCaseRunPostBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RulesTestCaseRunPostBody) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["messages"] = o.Messages + if !IsNil(o.Assertions) { + toSerialize["assertions"] = o.Assertions + } + if !IsNil(o.EnabledOverrides) { + toSerialize["enabled_overrides"] = o.EnabledOverrides + } + if !IsNil(o.DisabledOverrides) { + toSerialize["disabled_overrides"] = o.DisabledOverrides + } + if !IsNil(o.BlockingEffectOverrides) { + toSerialize["blocking_effect_overrides"] = o.BlockingEffectOverrides + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RulesTestCaseRunPostBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "messages", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varRulesTestCaseRunPostBody := _RulesTestCaseRunPostBody{} + + err = json.Unmarshal(data, &varRulesTestCaseRunPostBody) + + if err != nil { + return err + } + + *o = RulesTestCaseRunPostBody(varRulesTestCaseRunPostBody) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "messages") + delete(additionalProperties, "assertions") + delete(additionalProperties, "enabled_overrides") + delete(additionalProperties, "disabled_overrides") + delete(additionalProperties, "blocking_effect_overrides") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRulesTestCaseRunPostBody struct { + value *RulesTestCaseRunPostBody + isSet bool +} + +func (v NullableRulesTestCaseRunPostBody) Get() *RulesTestCaseRunPostBody { + return v.value +} + +func (v *NullableRulesTestCaseRunPostBody) Set(val *RulesTestCaseRunPostBody) { + v.value = val + v.isSet = true +} + +func (v NullableRulesTestCaseRunPostBody) IsSet() bool { + return v.isSet +} + +func (v *NullableRulesTestCaseRunPostBody) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRulesTestCaseRunPostBody(val *RulesTestCaseRunPostBody) *NullableRulesTestCaseRunPostBody { + return &NullableRulesTestCaseRunPostBody{value: val, isSet: true} +} + +func (v NullableRulesTestCaseRunPostBody) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRulesTestCaseRunPostBody) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/apiclient/model_rules_test_case_run_post_body_blocking_effect_overrides_inner.go b/internal/apiclient/model_rules_test_case_run_post_body_blocking_effect_overrides_inner.go new file mode 100644 index 0000000..b25c9a5 --- /dev/null +++ b/internal/apiclient/model_rules_test_case_run_post_body_blocking_effect_overrides_inner.go @@ -0,0 +1,195 @@ +/* +Impart Security v0 REST API + +Imparts v0 REST API. + +API version: 0.0.0 +Contact: support@impart.security +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the RulesTestCaseRunPostBodyBlockingEffectOverridesInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RulesTestCaseRunPostBodyBlockingEffectOverridesInner{} + +// RulesTestCaseRunPostBodyBlockingEffectOverridesInner struct for RulesTestCaseRunPostBodyBlockingEffectOverridesInner +type RulesTestCaseRunPostBodyBlockingEffectOverridesInner struct { + RuleId *string `json:"rule_id,omitempty"` + BlockingEffect *BlockingEffectType `json:"blocking_effect,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _RulesTestCaseRunPostBodyBlockingEffectOverridesInner RulesTestCaseRunPostBodyBlockingEffectOverridesInner + +// NewRulesTestCaseRunPostBodyBlockingEffectOverridesInner instantiates a new RulesTestCaseRunPostBodyBlockingEffectOverridesInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRulesTestCaseRunPostBodyBlockingEffectOverridesInner() *RulesTestCaseRunPostBodyBlockingEffectOverridesInner { + this := RulesTestCaseRunPostBodyBlockingEffectOverridesInner{} + var blockingEffect BlockingEffectType = BLOCK + this.BlockingEffect = &blockingEffect + return &this +} + +// NewRulesTestCaseRunPostBodyBlockingEffectOverridesInnerWithDefaults instantiates a new RulesTestCaseRunPostBodyBlockingEffectOverridesInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRulesTestCaseRunPostBodyBlockingEffectOverridesInnerWithDefaults() *RulesTestCaseRunPostBodyBlockingEffectOverridesInner { + this := RulesTestCaseRunPostBodyBlockingEffectOverridesInner{} + var blockingEffect BlockingEffectType = BLOCK + this.BlockingEffect = &blockingEffect + return &this +} + +// GetRuleId returns the RuleId field value if set, zero value otherwise. +func (o *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) GetRuleId() string { + if o == nil || IsNil(o.RuleId) { + var ret string + return ret + } + return *o.RuleId +} + +// GetRuleIdOk returns a tuple with the RuleId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) GetRuleIdOk() (*string, bool) { + if o == nil || IsNil(o.RuleId) { + return nil, false + } + return o.RuleId, true +} + +// HasRuleId returns a boolean if a field has been set. +func (o *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) HasRuleId() bool { + if o != nil && !IsNil(o.RuleId) { + return true + } + + return false +} + +// SetRuleId gets a reference to the given string and assigns it to the RuleId field. +func (o *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) SetRuleId(v string) { + o.RuleId = &v +} + +// GetBlockingEffect returns the BlockingEffect field value if set, zero value otherwise. +func (o *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) GetBlockingEffect() BlockingEffectType { + if o == nil || IsNil(o.BlockingEffect) { + var ret BlockingEffectType + return ret + } + return *o.BlockingEffect +} + +// GetBlockingEffectOk returns a tuple with the BlockingEffect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) GetBlockingEffectOk() (*BlockingEffectType, bool) { + if o == nil || IsNil(o.BlockingEffect) { + return nil, false + } + return o.BlockingEffect, true +} + +// HasBlockingEffect returns a boolean if a field has been set. +func (o *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) HasBlockingEffect() bool { + if o != nil && !IsNil(o.BlockingEffect) { + return true + } + + return false +} + +// SetBlockingEffect gets a reference to the given BlockingEffectType and assigns it to the BlockingEffect field. +func (o *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) SetBlockingEffect(v BlockingEffectType) { + o.BlockingEffect = &v +} + +func (o RulesTestCaseRunPostBodyBlockingEffectOverridesInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RulesTestCaseRunPostBodyBlockingEffectOverridesInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.RuleId) { + toSerialize["rule_id"] = o.RuleId + } + if !IsNil(o.BlockingEffect) { + toSerialize["blocking_effect"] = o.BlockingEffect + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) UnmarshalJSON(data []byte) (err error) { + varRulesTestCaseRunPostBodyBlockingEffectOverridesInner := _RulesTestCaseRunPostBodyBlockingEffectOverridesInner{} + + err = json.Unmarshal(data, &varRulesTestCaseRunPostBodyBlockingEffectOverridesInner) + + if err != nil { + return err + } + + *o = RulesTestCaseRunPostBodyBlockingEffectOverridesInner(varRulesTestCaseRunPostBodyBlockingEffectOverridesInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "rule_id") + delete(additionalProperties, "blocking_effect") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner struct { + value *RulesTestCaseRunPostBodyBlockingEffectOverridesInner + isSet bool +} + +func (v NullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner) Get() *RulesTestCaseRunPostBodyBlockingEffectOverridesInner { + return v.value +} + +func (v *NullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner) Set(val *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) { + v.value = val + v.isSet = true +} + +func (v NullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner(val *RulesTestCaseRunPostBodyBlockingEffectOverridesInner) *NullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner { + return &NullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner{value: val, isSet: true} +} + +func (v NullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRulesTestCaseRunPostBodyBlockingEffectOverridesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/apiclient/model_rules_test_case_run_post_body_disabled_overrides_inner.go b/internal/apiclient/model_rules_test_case_run_post_body_disabled_overrides_inner.go new file mode 100644 index 0000000..c0ecefa --- /dev/null +++ b/internal/apiclient/model_rules_test_case_run_post_body_disabled_overrides_inner.go @@ -0,0 +1,154 @@ +/* +Impart Security v0 REST API + +Imparts v0 REST API. + +API version: 0.0.0 +Contact: support@impart.security +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the RulesTestCaseRunPostBodyDisabledOverridesInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RulesTestCaseRunPostBodyDisabledOverridesInner{} + +// RulesTestCaseRunPostBodyDisabledOverridesInner struct for RulesTestCaseRunPostBodyDisabledOverridesInner +type RulesTestCaseRunPostBodyDisabledOverridesInner struct { + RuleId *string `json:"rule_id,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _RulesTestCaseRunPostBodyDisabledOverridesInner RulesTestCaseRunPostBodyDisabledOverridesInner + +// NewRulesTestCaseRunPostBodyDisabledOverridesInner instantiates a new RulesTestCaseRunPostBodyDisabledOverridesInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRulesTestCaseRunPostBodyDisabledOverridesInner() *RulesTestCaseRunPostBodyDisabledOverridesInner { + this := RulesTestCaseRunPostBodyDisabledOverridesInner{} + return &this +} + +// NewRulesTestCaseRunPostBodyDisabledOverridesInnerWithDefaults instantiates a new RulesTestCaseRunPostBodyDisabledOverridesInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRulesTestCaseRunPostBodyDisabledOverridesInnerWithDefaults() *RulesTestCaseRunPostBodyDisabledOverridesInner { + this := RulesTestCaseRunPostBodyDisabledOverridesInner{} + return &this +} + +// GetRuleId returns the RuleId field value if set, zero value otherwise. +func (o *RulesTestCaseRunPostBodyDisabledOverridesInner) GetRuleId() string { + if o == nil || IsNil(o.RuleId) { + var ret string + return ret + } + return *o.RuleId +} + +// GetRuleIdOk returns a tuple with the RuleId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBodyDisabledOverridesInner) GetRuleIdOk() (*string, bool) { + if o == nil || IsNil(o.RuleId) { + return nil, false + } + return o.RuleId, true +} + +// HasRuleId returns a boolean if a field has been set. +func (o *RulesTestCaseRunPostBodyDisabledOverridesInner) HasRuleId() bool { + if o != nil && !IsNil(o.RuleId) { + return true + } + + return false +} + +// SetRuleId gets a reference to the given string and assigns it to the RuleId field. +func (o *RulesTestCaseRunPostBodyDisabledOverridesInner) SetRuleId(v string) { + o.RuleId = &v +} + +func (o RulesTestCaseRunPostBodyDisabledOverridesInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RulesTestCaseRunPostBodyDisabledOverridesInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.RuleId) { + toSerialize["rule_id"] = o.RuleId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RulesTestCaseRunPostBodyDisabledOverridesInner) UnmarshalJSON(data []byte) (err error) { + varRulesTestCaseRunPostBodyDisabledOverridesInner := _RulesTestCaseRunPostBodyDisabledOverridesInner{} + + err = json.Unmarshal(data, &varRulesTestCaseRunPostBodyDisabledOverridesInner) + + if err != nil { + return err + } + + *o = RulesTestCaseRunPostBodyDisabledOverridesInner(varRulesTestCaseRunPostBodyDisabledOverridesInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "rule_id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRulesTestCaseRunPostBodyDisabledOverridesInner struct { + value *RulesTestCaseRunPostBodyDisabledOverridesInner + isSet bool +} + +func (v NullableRulesTestCaseRunPostBodyDisabledOverridesInner) Get() *RulesTestCaseRunPostBodyDisabledOverridesInner { + return v.value +} + +func (v *NullableRulesTestCaseRunPostBodyDisabledOverridesInner) Set(val *RulesTestCaseRunPostBodyDisabledOverridesInner) { + v.value = val + v.isSet = true +} + +func (v NullableRulesTestCaseRunPostBodyDisabledOverridesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableRulesTestCaseRunPostBodyDisabledOverridesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRulesTestCaseRunPostBodyDisabledOverridesInner(val *RulesTestCaseRunPostBodyDisabledOverridesInner) *NullableRulesTestCaseRunPostBodyDisabledOverridesInner { + return &NullableRulesTestCaseRunPostBodyDisabledOverridesInner{value: val, isSet: true} +} + +func (v NullableRulesTestCaseRunPostBodyDisabledOverridesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRulesTestCaseRunPostBodyDisabledOverridesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/apiclient/model_rules_test_case_run_post_body_enabled_overrides_inner.go b/internal/apiclient/model_rules_test_case_run_post_body_enabled_overrides_inner.go new file mode 100644 index 0000000..8856a0c --- /dev/null +++ b/internal/apiclient/model_rules_test_case_run_post_body_enabled_overrides_inner.go @@ -0,0 +1,191 @@ +/* +Impart Security v0 REST API + +Imparts v0 REST API. + +API version: 0.0.0 +Contact: support@impart.security +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the RulesTestCaseRunPostBodyEnabledOverridesInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RulesTestCaseRunPostBodyEnabledOverridesInner{} + +// RulesTestCaseRunPostBodyEnabledOverridesInner struct for RulesTestCaseRunPostBodyEnabledOverridesInner +type RulesTestCaseRunPostBodyEnabledOverridesInner struct { + RuleId *string `json:"rule_id,omitempty"` + Src *string `json:"src,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _RulesTestCaseRunPostBodyEnabledOverridesInner RulesTestCaseRunPostBodyEnabledOverridesInner + +// NewRulesTestCaseRunPostBodyEnabledOverridesInner instantiates a new RulesTestCaseRunPostBodyEnabledOverridesInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRulesTestCaseRunPostBodyEnabledOverridesInner() *RulesTestCaseRunPostBodyEnabledOverridesInner { + this := RulesTestCaseRunPostBodyEnabledOverridesInner{} + return &this +} + +// NewRulesTestCaseRunPostBodyEnabledOverridesInnerWithDefaults instantiates a new RulesTestCaseRunPostBodyEnabledOverridesInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRulesTestCaseRunPostBodyEnabledOverridesInnerWithDefaults() *RulesTestCaseRunPostBodyEnabledOverridesInner { + this := RulesTestCaseRunPostBodyEnabledOverridesInner{} + return &this +} + +// GetRuleId returns the RuleId field value if set, zero value otherwise. +func (o *RulesTestCaseRunPostBodyEnabledOverridesInner) GetRuleId() string { + if o == nil || IsNil(o.RuleId) { + var ret string + return ret + } + return *o.RuleId +} + +// GetRuleIdOk returns a tuple with the RuleId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBodyEnabledOverridesInner) GetRuleIdOk() (*string, bool) { + if o == nil || IsNil(o.RuleId) { + return nil, false + } + return o.RuleId, true +} + +// HasRuleId returns a boolean if a field has been set. +func (o *RulesTestCaseRunPostBodyEnabledOverridesInner) HasRuleId() bool { + if o != nil && !IsNil(o.RuleId) { + return true + } + + return false +} + +// SetRuleId gets a reference to the given string and assigns it to the RuleId field. +func (o *RulesTestCaseRunPostBodyEnabledOverridesInner) SetRuleId(v string) { + o.RuleId = &v +} + +// GetSrc returns the Src field value if set, zero value otherwise. +func (o *RulesTestCaseRunPostBodyEnabledOverridesInner) GetSrc() string { + if o == nil || IsNil(o.Src) { + var ret string + return ret + } + return *o.Src +} + +// GetSrcOk returns a tuple with the Src field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RulesTestCaseRunPostBodyEnabledOverridesInner) GetSrcOk() (*string, bool) { + if o == nil || IsNil(o.Src) { + return nil, false + } + return o.Src, true +} + +// HasSrc returns a boolean if a field has been set. +func (o *RulesTestCaseRunPostBodyEnabledOverridesInner) HasSrc() bool { + if o != nil && !IsNil(o.Src) { + return true + } + + return false +} + +// SetSrc gets a reference to the given string and assigns it to the Src field. +func (o *RulesTestCaseRunPostBodyEnabledOverridesInner) SetSrc(v string) { + o.Src = &v +} + +func (o RulesTestCaseRunPostBodyEnabledOverridesInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RulesTestCaseRunPostBodyEnabledOverridesInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.RuleId) { + toSerialize["rule_id"] = o.RuleId + } + if !IsNil(o.Src) { + toSerialize["src"] = o.Src + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RulesTestCaseRunPostBodyEnabledOverridesInner) UnmarshalJSON(data []byte) (err error) { + varRulesTestCaseRunPostBodyEnabledOverridesInner := _RulesTestCaseRunPostBodyEnabledOverridesInner{} + + err = json.Unmarshal(data, &varRulesTestCaseRunPostBodyEnabledOverridesInner) + + if err != nil { + return err + } + + *o = RulesTestCaseRunPostBodyEnabledOverridesInner(varRulesTestCaseRunPostBodyEnabledOverridesInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "rule_id") + delete(additionalProperties, "src") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRulesTestCaseRunPostBodyEnabledOverridesInner struct { + value *RulesTestCaseRunPostBodyEnabledOverridesInner + isSet bool +} + +func (v NullableRulesTestCaseRunPostBodyEnabledOverridesInner) Get() *RulesTestCaseRunPostBodyEnabledOverridesInner { + return v.value +} + +func (v *NullableRulesTestCaseRunPostBodyEnabledOverridesInner) Set(val *RulesTestCaseRunPostBodyEnabledOverridesInner) { + v.value = val + v.isSet = true +} + +func (v NullableRulesTestCaseRunPostBodyEnabledOverridesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableRulesTestCaseRunPostBodyEnabledOverridesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRulesTestCaseRunPostBodyEnabledOverridesInner(val *RulesTestCaseRunPostBodyEnabledOverridesInner) *NullableRulesTestCaseRunPostBodyEnabledOverridesInner { + return &NullableRulesTestCaseRunPostBodyEnabledOverridesInner{value: val, isSet: true} +} + +func (v NullableRulesTestCaseRunPostBodyEnabledOverridesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRulesTestCaseRunPostBodyEnabledOverridesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/client/model_rules_test_case_run_result_assertions_inner.go b/internal/apiclient/model_rules_test_case_run_result_assertions_inner.go similarity index 99% rename from internal/client/model_rules_test_case_run_result_assertions_inner.go rename to internal/apiclient/model_rules_test_case_run_result_assertions_inner.go index 1c47854..aa2ad0f 100644 --- a/internal/client/model_rules_test_case_run_result_assertions_inner.go +++ b/internal/apiclient/model_rules_test_case_run_result_assertions_inner.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_case_run_result_assertions_inner_results_inner.go b/internal/apiclient/model_rules_test_case_run_result_assertions_inner_results_inner.go similarity index 99% rename from internal/client/model_rules_test_case_run_result_assertions_inner_results_inner.go rename to internal/apiclient/model_rules_test_case_run_result_assertions_inner_results_inner.go index 6a2f4ec..260c549 100644 --- a/internal/client/model_rules_test_case_run_result_assertions_inner_results_inner.go +++ b/internal/apiclient/model_rules_test_case_run_result_assertions_inner_results_inner.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_rules_test_cases.go b/internal/apiclient/model_rules_test_cases.go similarity index 99% rename from internal/client/model_rules_test_cases.go rename to internal/apiclient/model_rules_test_cases.go index 1453a45..f997f00 100644 --- a/internal/client/model_rules_test_cases.go +++ b/internal/apiclient/model_rules_test_cases.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" diff --git a/internal/client/model_spec.go b/internal/apiclient/model_spec.go similarity index 73% rename from internal/client/model_spec.go rename to internal/apiclient/model_spec.go index 3ff9665..6acdfc1 100644 --- a/internal/client/model_spec.go +++ b/internal/apiclient/model_spec.go @@ -9,10 +9,11 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" + "fmt" "time" ) @@ -27,12 +28,12 @@ type Spec struct { Name string `json:"name"` // A specification in base64 encoding. Can be Swagger 2.0 or OAS 3.0. Spec string `json:"spec"` - // A learning spec in base64 encoding. - LearningSpec string `json:"learning_spec"` // The current revision of the spec. Revision int32 `json:"revision"` + // A list of revisions for a spec. + Revisions []Revision `json:"revisions"` // The analysis score for a spec. - Score NullableFloat32 `json:"score,omitempty"` + Score NullableFloat32 `json:"score"` // ID of the member who created the spec. CreatedBy string `json:"created_by"` // The date the spec was created. @@ -40,20 +41,24 @@ type Spec struct { // ID of the member who last updated the spec. UpdatedBy NullableString `json:"updated_by"` // The date of when the spec was last updated. - UpdatedAt NullableTime `json:"updated_at"` + UpdatedAt NullableTime `json:"updated_at"` + AdditionalProperties map[string]interface{} } +type _Spec Spec + // NewSpec instantiates a new Spec object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSpec(id string, name string, spec string, learningSpec string, revision int32, createdBy string, createdAt time.Time, updatedBy NullableString, updatedAt NullableTime) *Spec { +func NewSpec(id string, name string, spec string, revision int32, revisions []Revision, score NullableFloat32, createdBy string, createdAt time.Time, updatedBy NullableString, updatedAt NullableTime) *Spec { this := Spec{} this.Id = id this.Name = name this.Spec = spec - this.LearningSpec = learningSpec this.Revision = revision + this.Revisions = revisions + this.Score = score this.CreatedBy = createdBy this.CreatedAt = createdAt this.UpdatedBy = updatedBy @@ -141,64 +146,66 @@ func (o *Spec) SetSpec(v string) { o.Spec = v } -// GetLearningSpec returns the LearningSpec field value -func (o *Spec) GetLearningSpec() string { +// GetRevision returns the Revision field value +func (o *Spec) GetRevision() int32 { if o == nil { - var ret string + var ret int32 return ret } - return o.LearningSpec + return o.Revision } -// GetLearningSpecOk returns a tuple with the LearningSpec field value +// GetRevisionOk returns a tuple with the Revision field value // and a boolean to check if the value has been set. -func (o *Spec) GetLearningSpecOk() (*string, bool) { +func (o *Spec) GetRevisionOk() (*int32, bool) { if o == nil { return nil, false } - return &o.LearningSpec, true + return &o.Revision, true } -// SetLearningSpec sets field value -func (o *Spec) SetLearningSpec(v string) { - o.LearningSpec = v +// SetRevision sets field value +func (o *Spec) SetRevision(v int32) { + o.Revision = v } -// GetRevision returns the Revision field value -func (o *Spec) GetRevision() int32 { +// GetRevisions returns the Revisions field value +func (o *Spec) GetRevisions() []Revision { if o == nil { - var ret int32 + var ret []Revision return ret } - return o.Revision + return o.Revisions } -// GetRevisionOk returns a tuple with the Revision field value +// GetRevisionsOk returns a tuple with the Revisions field value // and a boolean to check if the value has been set. -func (o *Spec) GetRevisionOk() (*int32, bool) { +func (o *Spec) GetRevisionsOk() ([]Revision, bool) { if o == nil { return nil, false } - return &o.Revision, true + return o.Revisions, true } -// SetRevision sets field value -func (o *Spec) SetRevision(v int32) { - o.Revision = v +// SetRevisions sets field value +func (o *Spec) SetRevisions(v []Revision) { + o.Revisions = v } -// GetScore returns the Score field value if set, zero value otherwise (both if not set or set to explicit null). +// GetScore returns the Score field value +// If the value is explicit nil, the zero value for float32 will be returned func (o *Spec) GetScore() float32 { - if o == nil || IsNil(o.Score.Get()) { + if o == nil || o.Score.Get() == nil { var ret float32 return ret } + return *o.Score.Get() } -// GetScoreOk returns a tuple with the Score field value if set, nil otherwise +// GetScoreOk returns a tuple with the Score field value // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Spec) GetScoreOk() (*float32, bool) { @@ -208,30 +215,11 @@ func (o *Spec) GetScoreOk() (*float32, bool) { return o.Score.Get(), o.Score.IsSet() } -// HasScore returns a boolean if a field has been set. -func (o *Spec) HasScore() bool { - if o != nil && o.Score.IsSet() { - return true - } - - return false -} - -// SetScore gets a reference to the given NullableFloat32 and assigns it to the Score field. +// SetScore sets field value func (o *Spec) SetScore(v float32) { o.Score.Set(&v) } -// SetScoreNil sets the value for Score to be an explicit nil -func (o *Spec) SetScoreNil() { - o.Score.Set(nil) -} - -// UnsetScore ensures that no value is present for Score, not even an explicit nil -func (o *Spec) UnsetScore() { - o.Score.Unset() -} - // GetCreatedBy returns the CreatedBy field value func (o *Spec) GetCreatedBy() string { if o == nil { @@ -345,18 +333,81 @@ func (o Spec) ToMap() (map[string]interface{}, error) { toSerialize["id"] = o.Id toSerialize["name"] = o.Name toSerialize["spec"] = o.Spec - toSerialize["learning_spec"] = o.LearningSpec toSerialize["revision"] = o.Revision - if o.Score.IsSet() { - toSerialize["score"] = o.Score.Get() - } + toSerialize["revisions"] = o.Revisions + toSerialize["score"] = o.Score.Get() toSerialize["created_by"] = o.CreatedBy toSerialize["created_at"] = o.CreatedAt toSerialize["updated_by"] = o.UpdatedBy.Get() toSerialize["updated_at"] = o.UpdatedAt.Get() + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } +func (o *Spec) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "spec", + "revision", + "revisions", + "score", + "created_by", + "created_at", + "updated_by", + "updated_at", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSpec := _Spec{} + + err = json.Unmarshal(data, &varSpec) + + if err != nil { + return err + } + + *o = Spec(varSpec) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "spec") + delete(additionalProperties, "revision") + delete(additionalProperties, "revisions") + delete(additionalProperties, "score") + delete(additionalProperties, "created_by") + delete(additionalProperties, "created_at") + delete(additionalProperties, "updated_by") + delete(additionalProperties, "updated_at") + o.AdditionalProperties = additionalProperties + } + + return err +} + type NullableSpec struct { value *Spec isSet bool diff --git a/internal/client/model_spec_post_body.go b/internal/apiclient/model_spec_post_body.go similarity index 72% rename from internal/client/model_spec_post_body.go rename to internal/apiclient/model_spec_post_body.go index 11a66d9..f9778e1 100644 --- a/internal/client/model_spec_post_body.go +++ b/internal/apiclient/model_spec_post_body.go @@ -9,10 +9,11 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" + "fmt" ) // checks if the SpecPostBody type satisfies the MappedNullable interface at compile time @@ -23,9 +24,12 @@ type SpecPostBody struct { // The name of a spec. Name string `json:"name"` // A specification. Can be Swagger 2.0 or OAS 3.0. Must be base64 encoded. - Spec *string `json:"spec,omitempty"` + Spec *string `json:"spec,omitempty"` + AdditionalProperties map[string]interface{} } +type _SpecPostBody SpecPostBody + // NewSpecPostBody instantiates a new SpecPostBody object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -114,9 +118,57 @@ func (o SpecPostBody) ToMap() (map[string]interface{}, error) { if !IsNil(o.Spec) { toSerialize["spec"] = o.Spec } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } +func (o *SpecPostBody) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSpecPostBody := _SpecPostBody{} + + err = json.Unmarshal(data, &varSpecPostBody) + + if err != nil { + return err + } + + *o = SpecPostBody(varSpecPostBody) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "spec") + o.AdditionalProperties = additionalProperties + } + + return err +} + type NullableSpecPostBody struct { value *SpecPostBody isSet bool diff --git a/internal/client/model_token_info.go b/internal/apiclient/model_token_info.go similarity index 70% rename from internal/client/model_token_info.go rename to internal/apiclient/model_token_info.go index 23b3283..a8fed19 100644 --- a/internal/client/model_token_info.go +++ b/internal/apiclient/model_token_info.go @@ -9,10 +9,11 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "encoding/json" + "fmt" ) // checks if the TokenInfo type satisfies the MappedNullable interface at compile time @@ -23,9 +24,12 @@ type TokenInfo struct { // ID of the user. UserId string `json:"user_id"` // ID of the org. - OrgId string `json:"org_id"` + OrgId string `json:"org_id"` + AdditionalProperties map[string]interface{} } +type _TokenInfo TokenInfo + // NewTokenInfo instantiates a new TokenInfo object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -105,9 +109,58 @@ func (o TokenInfo) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["user_id"] = o.UserId toSerialize["org_id"] = o.OrgId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return toSerialize, nil } +func (o *TokenInfo) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "user_id", + "org_id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varTokenInfo := _TokenInfo{} + + err = json.Unmarshal(data, &varTokenInfo) + + if err != nil { + return err + } + + *o = TokenInfo(varTokenInfo) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "user_id") + delete(additionalProperties, "org_id") + o.AdditionalProperties = additionalProperties + } + + return err +} + type NullableTokenInfo struct { value *TokenInfo isSet bool diff --git a/internal/client/response.go b/internal/apiclient/response.go similarity index 98% rename from internal/client/response.go rename to internal/apiclient/response.go index f6d3999..2a10001 100644 --- a/internal/client/response.go +++ b/internal/apiclient/response.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "net/http" diff --git a/internal/client/utils.go b/internal/apiclient/utils.go similarity index 99% rename from internal/client/utils.go rename to internal/apiclient/utils.go index d232205..11650cb 100644 --- a/internal/client/utils.go +++ b/internal/apiclient/utils.go @@ -9,7 +9,7 @@ Contact: support@impart.security // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package client +package apiclient import ( "bytes" diff --git a/internal/client/model_rules_test_.go b/internal/client/model_rules_test_.go deleted file mode 100644 index 4113e4a..0000000 --- a/internal/client/model_rules_test_.go +++ /dev/null @@ -1,242 +0,0 @@ -/* -Impart Security v0 REST API - -Imparts v0 REST API. - -API version: 0.0.0 -Contact: support@impart.security -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the RulesTest type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &RulesTest{} - -// RulesTest struct for RulesTest -type RulesTest struct { - // The duration of time taken to execute the rules on the test input in microseconds. - Duration int32 `json:"duration"` - ReqResponse InspectorResMsgResponse `json:"req_response"` - ResResponse InspectorReqMsgResponse `json:"res_response"` - Output []RulesTestOutputInner `json:"output"` -} - -type _RulesTest RulesTest - -// NewRulesTest instantiates a new RulesTest object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewRulesTest(duration int32, reqResponse InspectorResMsgResponse, resResponse InspectorReqMsgResponse, output []RulesTestOutputInner) *RulesTest { - this := RulesTest{} - this.Duration = duration - this.ReqResponse = reqResponse - this.ResResponse = resResponse - this.Output = output - return &this -} - -// NewRulesTestWithDefaults instantiates a new RulesTest object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewRulesTestWithDefaults() *RulesTest { - this := RulesTest{} - return &this -} - -// GetDuration returns the Duration field value -func (o *RulesTest) GetDuration() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value -// and a boolean to check if the value has been set. -func (o *RulesTest) GetDurationOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Duration, true -} - -// SetDuration sets field value -func (o *RulesTest) SetDuration(v int32) { - o.Duration = v -} - -// GetReqResponse returns the ReqResponse field value -func (o *RulesTest) GetReqResponse() InspectorResMsgResponse { - if o == nil { - var ret InspectorResMsgResponse - return ret - } - - return o.ReqResponse -} - -// GetReqResponseOk returns a tuple with the ReqResponse field value -// and a boolean to check if the value has been set. -func (o *RulesTest) GetReqResponseOk() (*InspectorResMsgResponse, bool) { - if o == nil { - return nil, false - } - return &o.ReqResponse, true -} - -// SetReqResponse sets field value -func (o *RulesTest) SetReqResponse(v InspectorResMsgResponse) { - o.ReqResponse = v -} - -// GetResResponse returns the ResResponse field value -func (o *RulesTest) GetResResponse() InspectorReqMsgResponse { - if o == nil { - var ret InspectorReqMsgResponse - return ret - } - - return o.ResResponse -} - -// GetResResponseOk returns a tuple with the ResResponse field value -// and a boolean to check if the value has been set. -func (o *RulesTest) GetResResponseOk() (*InspectorReqMsgResponse, bool) { - if o == nil { - return nil, false - } - return &o.ResResponse, true -} - -// SetResResponse sets field value -func (o *RulesTest) SetResResponse(v InspectorReqMsgResponse) { - o.ResResponse = v -} - -// GetOutput returns the Output field value -func (o *RulesTest) GetOutput() []RulesTestOutputInner { - if o == nil { - var ret []RulesTestOutputInner - return ret - } - - return o.Output -} - -// GetOutputOk returns a tuple with the Output field value -// and a boolean to check if the value has been set. -func (o *RulesTest) GetOutputOk() ([]RulesTestOutputInner, bool) { - if o == nil { - return nil, false - } - return o.Output, true -} - -// SetOutput sets field value -func (o *RulesTest) SetOutput(v []RulesTestOutputInner) { - o.Output = v -} - -func (o RulesTest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o RulesTest) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["duration"] = o.Duration - toSerialize["req_response"] = o.ReqResponse - toSerialize["res_response"] = o.ResResponse - toSerialize["output"] = o.Output - return toSerialize, nil -} - -func (o *RulesTest) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "duration", - "req_response", - "res_response", - "output", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varRulesTest := _RulesTest{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varRulesTest) - - if err != nil { - return err - } - - *o = RulesTest(varRulesTest) - - return err -} - -type NullableRulesTest struct { - value *RulesTest - isSet bool -} - -func (v NullableRulesTest) Get() *RulesTest { - return v.value -} - -func (v *NullableRulesTest) Set(val *RulesTest) { - v.value = val - v.isSet = true -} - -func (v NullableRulesTest) IsSet() bool { - return v.isSet -} - -func (v *NullableRulesTest) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableRulesTest(val *RulesTest) *NullableRulesTest { - return &NullableRulesTest{value: val, isSet: true} -} - -func (v NullableRulesTest) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableRulesTest) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/internal/client/model_rules_test_output_inner.go b/internal/client/model_rules_test_output_inner.go deleted file mode 100644 index f757061..0000000 --- a/internal/client/model_rules_test_output_inner.go +++ /dev/null @@ -1,216 +0,0 @@ -/* -Impart Security v0 REST API - -Imparts v0 REST API. - -API version: 0.0.0 -Contact: support@impart.security -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the RulesTestOutputInner type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &RulesTestOutputInner{} - -// RulesTestOutputInner struct for RulesTestOutputInner -type RulesTestOutputInner struct { - // The message. - Message string `json:"message"` - // The timestamp, this is the time since the start of the test in microseconds. - Timestamp int32 `json:"timestamp"` - // The destination of the message. Either \"stderr\" or \"stdout\". - Destination string `json:"destination"` -} - -type _RulesTestOutputInner RulesTestOutputInner - -// NewRulesTestOutputInner instantiates a new RulesTestOutputInner object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewRulesTestOutputInner(message string, timestamp int32, destination string) *RulesTestOutputInner { - this := RulesTestOutputInner{} - this.Message = message - this.Timestamp = timestamp - this.Destination = destination - return &this -} - -// NewRulesTestOutputInnerWithDefaults instantiates a new RulesTestOutputInner object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewRulesTestOutputInnerWithDefaults() *RulesTestOutputInner { - this := RulesTestOutputInner{} - return &this -} - -// GetMessage returns the Message field value -func (o *RulesTestOutputInner) GetMessage() string { - if o == nil { - var ret string - return ret - } - - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *RulesTestOutputInner) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value -func (o *RulesTestOutputInner) SetMessage(v string) { - o.Message = v -} - -// GetTimestamp returns the Timestamp field value -func (o *RulesTestOutputInner) GetTimestamp() int32 { - if o == nil { - var ret int32 - return ret - } - - return o.Timestamp -} - -// GetTimestampOk returns a tuple with the Timestamp field value -// and a boolean to check if the value has been set. -func (o *RulesTestOutputInner) GetTimestampOk() (*int32, bool) { - if o == nil { - return nil, false - } - return &o.Timestamp, true -} - -// SetTimestamp sets field value -func (o *RulesTestOutputInner) SetTimestamp(v int32) { - o.Timestamp = v -} - -// GetDestination returns the Destination field value -func (o *RulesTestOutputInner) GetDestination() string { - if o == nil { - var ret string - return ret - } - - return o.Destination -} - -// GetDestinationOk returns a tuple with the Destination field value -// and a boolean to check if the value has been set. -func (o *RulesTestOutputInner) GetDestinationOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Destination, true -} - -// SetDestination sets field value -func (o *RulesTestOutputInner) SetDestination(v string) { - o.Destination = v -} - -func (o RulesTestOutputInner) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o RulesTestOutputInner) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["message"] = o.Message - toSerialize["timestamp"] = o.Timestamp - toSerialize["destination"] = o.Destination - return toSerialize, nil -} - -func (o *RulesTestOutputInner) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "message", - "timestamp", - "destination", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varRulesTestOutputInner := _RulesTestOutputInner{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varRulesTestOutputInner) - - if err != nil { - return err - } - - *o = RulesTestOutputInner(varRulesTestOutputInner) - - return err -} - -type NullableRulesTestOutputInner struct { - value *RulesTestOutputInner - isSet bool -} - -func (v NullableRulesTestOutputInner) Get() *RulesTestOutputInner { - return v.value -} - -func (v *NullableRulesTestOutputInner) Set(val *RulesTestOutputInner) { - v.value = val - v.isSet = true -} - -func (v NullableRulesTestOutputInner) IsSet() bool { - return v.isSet -} - -func (v *NullableRulesTestOutputInner) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableRulesTestOutputInner(val *RulesTestOutputInner) *NullableRulesTestOutputInner { - return &NullableRulesTestOutputInner{value: val, isSet: true} -} - -func (v NullableRulesTestOutputInner) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableRulesTestOutputInner) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/internal/client/model_rules_test_post_body.go b/internal/client/model_rules_test_post_body.go deleted file mode 100644 index 0e9be6a..0000000 --- a/internal/client/model_rules_test_post_body.go +++ /dev/null @@ -1,257 +0,0 @@ -/* -Impart Security v0 REST API - -Imparts v0 REST API. - -API version: 0.0.0 -Contact: support@impart.security -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "bytes" - "encoding/json" - "fmt" -) - -// checks if the RulesTestPostBody type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &RulesTestPostBody{} - -// RulesTestPostBody struct for RulesTestPostBody -type RulesTestPostBody struct { - Req InspectorReqMsg `json:"req"` - Res InspectorResMsg `json:"res"` - RuleId *string `json:"rule_id,omitempty"` - Src *string `json:"src,omitempty"` -} - -type _RulesTestPostBody RulesTestPostBody - -// NewRulesTestPostBody instantiates a new RulesTestPostBody object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewRulesTestPostBody(req InspectorReqMsg, res InspectorResMsg) *RulesTestPostBody { - this := RulesTestPostBody{} - this.Req = req - this.Res = res - return &this -} - -// NewRulesTestPostBodyWithDefaults instantiates a new RulesTestPostBody object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewRulesTestPostBodyWithDefaults() *RulesTestPostBody { - this := RulesTestPostBody{} - return &this -} - -// GetReq returns the Req field value -func (o *RulesTestPostBody) GetReq() InspectorReqMsg { - if o == nil { - var ret InspectorReqMsg - return ret - } - - return o.Req -} - -// GetReqOk returns a tuple with the Req field value -// and a boolean to check if the value has been set. -func (o *RulesTestPostBody) GetReqOk() (*InspectorReqMsg, bool) { - if o == nil { - return nil, false - } - return &o.Req, true -} - -// SetReq sets field value -func (o *RulesTestPostBody) SetReq(v InspectorReqMsg) { - o.Req = v -} - -// GetRes returns the Res field value -func (o *RulesTestPostBody) GetRes() InspectorResMsg { - if o == nil { - var ret InspectorResMsg - return ret - } - - return o.Res -} - -// GetResOk returns a tuple with the Res field value -// and a boolean to check if the value has been set. -func (o *RulesTestPostBody) GetResOk() (*InspectorResMsg, bool) { - if o == nil { - return nil, false - } - return &o.Res, true -} - -// SetRes sets field value -func (o *RulesTestPostBody) SetRes(v InspectorResMsg) { - o.Res = v -} - -// GetRuleId returns the RuleId field value if set, zero value otherwise. -func (o *RulesTestPostBody) GetRuleId() string { - if o == nil || IsNil(o.RuleId) { - var ret string - return ret - } - return *o.RuleId -} - -// GetRuleIdOk returns a tuple with the RuleId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RulesTestPostBody) GetRuleIdOk() (*string, bool) { - if o == nil || IsNil(o.RuleId) { - return nil, false - } - return o.RuleId, true -} - -// HasRuleId returns a boolean if a field has been set. -func (o *RulesTestPostBody) HasRuleId() bool { - if o != nil && !IsNil(o.RuleId) { - return true - } - - return false -} - -// SetRuleId gets a reference to the given string and assigns it to the RuleId field. -func (o *RulesTestPostBody) SetRuleId(v string) { - o.RuleId = &v -} - -// GetSrc returns the Src field value if set, zero value otherwise. -func (o *RulesTestPostBody) GetSrc() string { - if o == nil || IsNil(o.Src) { - var ret string - return ret - } - return *o.Src -} - -// GetSrcOk returns a tuple with the Src field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RulesTestPostBody) GetSrcOk() (*string, bool) { - if o == nil || IsNil(o.Src) { - return nil, false - } - return o.Src, true -} - -// HasSrc returns a boolean if a field has been set. -func (o *RulesTestPostBody) HasSrc() bool { - if o != nil && !IsNil(o.Src) { - return true - } - - return false -} - -// SetSrc gets a reference to the given string and assigns it to the Src field. -func (o *RulesTestPostBody) SetSrc(v string) { - o.Src = &v -} - -func (o RulesTestPostBody) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o RulesTestPostBody) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["req"] = o.Req - toSerialize["res"] = o.Res - if !IsNil(o.RuleId) { - toSerialize["rule_id"] = o.RuleId - } - if !IsNil(o.Src) { - toSerialize["src"] = o.Src - } - return toSerialize, nil -} - -func (o *RulesTestPostBody) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "req", - "res", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err - } - - for _, requiredProperty := range requiredProperties { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varRulesTestPostBody := _RulesTestPostBody{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - - err = decoder.Decode(&varRulesTestPostBody) - - if err != nil { - return err - } - - *o = RulesTestPostBody(varRulesTestPostBody) - - return err -} - -type NullableRulesTestPostBody struct { - value *RulesTestPostBody - isSet bool -} - -func (v NullableRulesTestPostBody) Get() *RulesTestPostBody { - return v.value -} - -func (v *NullableRulesTestPostBody) Set(val *RulesTestPostBody) { - v.value = val - v.isSet = true -} - -func (v NullableRulesTestPostBody) IsSet() bool { - return v.isSet -} - -func (v *NullableRulesTestPostBody) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableRulesTestPostBody(val *RulesTestPostBody) *NullableRulesTestPostBody { - return &NullableRulesTestPostBody{value: val, isSet: true} -} - -func (v NullableRulesTestPostBody) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableRulesTestPostBody) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/internal/provider/api_binding_resource.go b/internal/provider/api_binding_resource.go index d192488..434811d 100644 --- a/internal/provider/api_binding_resource.go +++ b/internal/provider/api_binding_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. diff --git a/internal/provider/connector_data_source.go b/internal/provider/connector_data_source.go index 6e79705..6debc89 100644 --- a/internal/provider/connector_data_source.go +++ b/internal/provider/connector_data_source.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. diff --git a/internal/provider/list_resource.go b/internal/provider/list_resource.go index e92d760..c864c16 100644 --- a/internal/provider/list_resource.go +++ b/internal/provider/list_resource.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" "go4.org/netipx" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. @@ -104,7 +104,7 @@ func (r *ListResource) Schema(_ context.Context, _ resource.SchemaRequest, resp }, }, "functionality": schema.StringAttribute{ - Description: "The list functionality. Allowed values are add, add/remove, none.", + Description: "The list functionality. Allowed values are add, add/remove.", Optional: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), @@ -446,10 +446,10 @@ func (r *ListResource) ValidateConfig(ctx context.Context, req resource.Validate ) } - if plan.Items != nil && (*functionality != openapiclient.ADD_REMOVE && *functionality != openapiclient.NONE) { + if plan.Items != nil && (*functionality != openapiclient.ADD_REMOVE) { resp.Diagnostics.AddError( "Configuration Error: Ivalid value", - "List items can only be set with add/remove or none functionality", + "List items can only be set with add/remove functionality", ) } } diff --git a/internal/provider/log_binding_resource.go b/internal/provider/log_binding_resource.go index 1812ece..e375a99 100644 --- a/internal/provider/log_binding_resource.go +++ b/internal/provider/log_binding_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. diff --git a/internal/provider/monitor_resource.go b/internal/provider/monitor_resource.go index 3ff40d8..a0152ca 100644 --- a/internal/provider/monitor_resource.go +++ b/internal/provider/monitor_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. diff --git a/internal/provider/notification_template_resource.go b/internal/provider/notification_template_resource.go index e54fb45..d98d567 100644 --- a/internal/provider/notification_template_resource.go +++ b/internal/provider/notification_template_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. @@ -119,10 +119,14 @@ func (r *notificationTemplateResource) Create(ctx context.Context, req resource. ConnectorId: plan.ConnectorID.ValueString(), Name: plan.Name.ValueString(), Payload: plan.Payload.ValueString(), - Subject: plan.Subject.ValueString(), Destination: plan.Destination, } + if !plan.Subject.IsNull() { + subject := plan.Subject.ValueString() + postBody.Subject = &subject + } + notificationTemplateResponse, _, err := r.client.NotificationTemplatesAPI.CreateNotificationTemplate(ctx, r.client.OrgID).NotificationTemplatePostBody(postBody).Execute() if err != nil { message := err.Error() @@ -216,10 +220,14 @@ func (r *notificationTemplateResource) Update(ctx context.Context, req resource. ConnectorId: plan.ConnectorID.ValueString(), Name: plan.Name.ValueString(), Payload: plan.Payload.ValueString(), - Subject: plan.Subject.ValueString(), Destination: plan.Destination, } + if !plan.Subject.IsNull() { + subject := plan.Subject.ValueString() + postBody.Subject = &subject + } + notificationTemplateRequest := r.client.NotificationTemplatesAPI.UpdateNotificationTemplate(ctx, r.client.OrgID, plan.ID.ValueString()). NotificationTemplatePostBody(postBody) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 6876aed..3a9334a 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. diff --git a/internal/provider/rule_script_dependencies_resource.go b/internal/provider/rule_script_dependencies_resource.go index 2733243..09cbc46 100644 --- a/internal/provider/rule_script_dependencies_resource.go +++ b/internal/provider/rule_script_dependencies_resource.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. diff --git a/internal/provider/rule_script_resource.go b/internal/provider/rule_script_resource.go index 2819362..8d205f7 100644 --- a/internal/provider/rule_script_resource.go +++ b/internal/provider/rule_script_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. @@ -222,13 +222,16 @@ func (r *ruleScriptResource) Create(ctx context.Context, req resource.CreateRequ // Map response body to model plan.ID = types.StringValue(ruleResponse.Id) plan.Name = types.StringValue(ruleResponse.Name) - plan.Description = types.StringValue(ruleResponse.Description) plan.Disabled = types.BoolValue(ruleResponse.Disabled) if !(plan.BlockingEffect.IsNull() && string(ruleResponse.BlockingEffect) == string(openapiclient.BLOCK)) { plan.BlockingEffect = types.StringValue(string(ruleResponse.BlockingEffect)) } + if !plan.Description.IsNull() || ruleResponse.Description != "" { + plan.Description = types.StringValue(ruleResponse.Description) + } + // Set state to fully populated data diags = resp.State.Set(ctx, plan) resp.Diagnostics.Append(diags...) @@ -271,17 +274,19 @@ func (r *ruleScriptResource) Read(ctx context.Context, req resource.ReadRequest, // Map response body to model newState := ruleScriptResourceModel{ - ID: types.StringValue(ruleResponse.Id), - Name: types.StringValue(ruleResponse.Name), - SourceFile: state.SourceFile, - Description: types.StringValue(ruleResponse.Description), - Disabled: types.BoolValue(ruleResponse.Disabled), + ID: types.StringValue(ruleResponse.Id), + Name: types.StringValue(ruleResponse.Name), + SourceFile: state.SourceFile, + Disabled: types.BoolValue(ruleResponse.Disabled), } // ignore blocking effect value if it was not explicitly set if !(state.BlockingEffect.IsNull() && string(ruleResponse.BlockingEffect) == string(openapiclient.BLOCK)) { newState.BlockingEffect = types.StringValue(string(ruleResponse.BlockingEffect)) } + if !state.Description.IsNull() || ruleResponse.Description != "" { + newState.Description = types.StringValue(ruleResponse.Description) + } // track hash only if user originally set source_hash or content if !state.SourceHash.IsNull() || !state.Content.IsNull() { @@ -398,7 +403,7 @@ func (r *ruleScriptResource) Update(ctx context.Context, req resource.UpdateRequ SourceHash: plan.SourceHash, } - if !plan.Description.IsNull() { + if !plan.Description.IsNull() || ruleResponse.Description != "" { state.Description = types.StringValue(ruleResponse.Description) } diff --git a/internal/provider/rule_test_case_resource.go b/internal/provider/rule_test_case_resource.go index 430229f..3cd81e4 100644 --- a/internal/provider/rule_test_case_resource.go +++ b/internal/provider/rule_test_case_resource.go @@ -21,7 +21,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) var ( @@ -72,6 +72,7 @@ type ruleTestCaseModel struct { ID types.String `tfsdk:"id"` Name types.String `tfsdk:"name"` Description types.String `tfsdk:"description"` + Required types.Bool `tfsdk:"required"` Messages []messageModel `tfsdk:"messages"` Assertions []assertionModel `tfsdk:"assertions"` } @@ -130,6 +131,10 @@ func (r ruleTestcaseResource) Schema(_ context.Context, _ resource.SchemaRequest Description: "The description of the test case.", Optional: true, }, + "required": schema.BoolAttribute{ + Description: "Sets if test case required to pass on update.", + Optional: true, + }, "messages": schema.ListNestedAttribute{ Description: "The messages of the test case.", Required: true, @@ -159,21 +164,33 @@ func (r ruleTestcaseResource) Schema(_ context.Context, _ resource.SchemaRequest Description: "The HTTP request header keys.", Optional: true, ElementType: types.StringType, + Validators: []validator.List{ + listvalidator.SizeAtLeast(1), + }, }, "header_values": schema.ListAttribute{ Description: "The HTTP request header values.", Optional: true, ElementType: types.StringType, + Validators: []validator.List{ + listvalidator.SizeAtLeast(1), + }, }, "cookie_keys": schema.ListAttribute{ Description: "The HTTP request cookie keys.", Optional: true, ElementType: types.StringType, + Validators: []validator.List{ + listvalidator.SizeAtLeast(1), + }, }, "cookie_values": schema.ListAttribute{ Description: "The HTTP request cookie values.", Optional: true, ElementType: types.StringType, + Validators: []validator.List{ + listvalidator.SizeAtLeast(1), + }, }, "remote_addr": schema.StringAttribute{ Description: "The remote address of the request.", @@ -197,11 +214,17 @@ func (r ruleTestcaseResource) Schema(_ context.Context, _ resource.SchemaRequest Description: "The HTTP response header keys.", Optional: true, ElementType: types.StringType, + Validators: []validator.List{ + listvalidator.SizeAtLeast(1), + }, }, "header_values": schema.ListAttribute{ Description: "The HTTP response header values.", Optional: true, ElementType: types.StringType, + Validators: []validator.List{ + listvalidator.SizeAtLeast(1), + }, }, "status_code": schema.Int32Attribute{ Description: "The HTTP response status code.", @@ -497,11 +520,17 @@ func toRulesTestCasePostBody(plan ruleTestCaseModel) (openapiclient.RulesTestCas Name: plan.Name.ValueString(), Messages: make([]openapiclient.RulesTestCaseMessagesInner, 0, len(plan.Messages)), } + if !plan.Description.IsNull() { description := plan.Description.ValueString() postBody.Description = &description } + if !plan.Required.IsNull() { + required := plan.Required.ValueBool() + postBody.Required = &required + } + if len(plan.Messages) == 0 { return postBody, nil } @@ -664,11 +693,19 @@ func toRulesTestCasePostBody(plan ruleTestCaseModel) (openapiclient.RulesTestCas func toRuleTestCaseModel(ruleTestCaseResponse *openapiclient.RulesTestCase, plan ruleTestCaseModel) ruleTestCaseModel { testCaseModel := ruleTestCaseModel{ - ID: types.StringValue(ruleTestCaseResponse.Id), - Name: types.StringValue(ruleTestCaseResponse.Name), - Description: types.StringValue(ruleTestCaseResponse.Description), - Messages: make([]messageModel, 0, len(ruleTestCaseResponse.Messages)), + ID: types.StringValue(ruleTestCaseResponse.Id), + Name: types.StringValue(ruleTestCaseResponse.Name), + Messages: make([]messageModel, 0, len(ruleTestCaseResponse.Messages)), } + + if !plan.Required.IsNull() || ruleTestCaseResponse.Required { + testCaseModel.Required = plan.Required + } + + if !plan.Description.IsNull() || ruleTestCaseResponse.Description != "" { + testCaseModel.Description = types.StringValue(ruleTestCaseResponse.Description) + } + for i, message := range ruleTestCaseResponse.Messages { messageModel := messageModel{ Count: types.Int32Value(message.Count), diff --git a/internal/provider/spec_data_source.go b/internal/provider/spec_data_source.go index 2fc7dba..ec932d1 100644 --- a/internal/provider/spec_data_source.go +++ b/internal/provider/spec_data_source.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. diff --git a/internal/provider/spec_resource.go b/internal/provider/spec_resource.go index 6d27649..750e050 100644 --- a/internal/provider/spec_resource.go +++ b/internal/provider/spec_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) // Ensure the implementation satisfies the expected interfaces. diff --git a/internal/provider/test_case_run_resource.go b/internal/provider/test_case_run_resource.go index 2b97679..e56dc37 100644 --- a/internal/provider/test_case_run_resource.go +++ b/internal/provider/test_case_run_resource.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" - openapiclient "github.com/impart-security/terraform-provider-impart/internal/client" + openapiclient "github.com/impart-security/terraform-provider-impart/internal/apiclient" ) var (