From bfb6c6b79b2ae255ce2715233a57a7611cf77ad3 Mon Sep 17 00:00:00 2001 From: 1riatsila1 Date: Wed, 2 Oct 2024 16:11:23 +0200 Subject: [PATCH] feat: client | network group assignment alignment and test --- .../.openapi-generator/FILES | 4 +- pkg/config-api-client/README.md | 4 +- .../api/.openapi.source.yaml | 32 +-- pkg/config-api-client/api/openapi.yaml | 50 ++--- pkg/config-api-client/api_configuration.go | 10 +- pkg/config-api-client/client.go | 4 +- pkg/config-api-client/configuration.go | 2 +- .../docs/ConfigurationAPI.md | 6 +- .../NetworkGroupAssignmentsGetResponse.md | 72 +++++++ pkg/config-api-client/model_error_detail.go | 2 +- pkg/config-api-client/model_error_response.go | 2 +- pkg/config-api-client/model_group.go | 2 +- .../model_groups_get_item.go | 2 +- .../model_groups_get_response.go | 2 +- .../model_groups_post_request.go | 2 +- .../model_groups_post_response.go | 2 +- pkg/config-api-client/model_issue.go | 2 +- pkg/config-api-client/model_issue_subject.go | 2 +- ..._network_group_assignments_get_response.go | 185 ++++++++++++++++++ .../model_network_group_assignments_item.go | 2 +- .../model_pagination_details.go | 2 +- pkg/config-api-client/model_parent.go | 2 +- pkg/config-api-client/model_sensor.go | 2 +- .../model_sensor_group_assignment_response.go | 2 +- .../model_sensor_group_assignments_item.go | 2 +- ...l_sensor_group_assignments_post_request.go | 2 +- ...model_sensor_group_assignments_response.go | 2 +- .../model_wired_networks_item.go | 2 +- .../model_wired_networks_response.go | 2 +- .../model_wireless_networks_item.go | 2 +- .../model_wireless_networks_response.go | 2 +- pkg/config-api-client/response.go | 2 +- .../test/api_configuration_test.go | 131 +++++++++---- pkg/config-api-client/utils.go | 2 +- 34 files changed, 426 insertions(+), 120 deletions(-) create mode 100644 pkg/config-api-client/docs/NetworkGroupAssignmentsGetResponse.md create mode 100644 pkg/config-api-client/model_network_group_assignments_get_response.go diff --git a/pkg/config-api-client/.openapi-generator/FILES b/pkg/config-api-client/.openapi-generator/FILES index a9d471a3..ba5ba7a4 100644 --- a/pkg/config-api-client/.openapi-generator/FILES +++ b/pkg/config-api-client/.openapi-generator/FILES @@ -13,8 +13,8 @@ docs/GroupsPostRequest.md docs/GroupsPostResponse.md docs/Issue.md docs/IssueSubject.md +docs/NetworkGroupAssignmentsGetResponse.md docs/NetworkGroupAssignmentsItem.md -docs/NetworkGroupAssignmentsResponse.md docs/PaginationDetails.md docs/Parent.md docs/Sensor.md @@ -37,8 +37,8 @@ model_groups_post_request.go model_groups_post_response.go model_issue.go model_issue_subject.go +model_network_group_assignments_get_response.go model_network_group_assignments_item.go -model_network_group_assignments_response.go model_pagination_details.go model_parent.go model_sensor.go diff --git a/pkg/config-api-client/README.md b/pkg/config-api-client/README.md index 04282baa..e1ae0c23 100644 --- a/pkg/config-api-client/README.md +++ b/pkg/config-api-client/README.md @@ -5,7 +5,7 @@ Nice description goes here ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.14.0 +- API version: 1.15.0 - Package version: 1.0.0 - Generator version: 7.9.0-SNAPSHOT - Build package: org.openapitools.codegen.languages.GoClientCodegen @@ -99,8 +99,8 @@ Class | Method | HTTP request | Description - [GroupsPostResponse](docs/GroupsPostResponse.md) - [Issue](docs/Issue.md) - [IssueSubject](docs/IssueSubject.md) + - [NetworkGroupAssignmentsGetResponse](docs/NetworkGroupAssignmentsGetResponse.md) - [NetworkGroupAssignmentsItem](docs/NetworkGroupAssignmentsItem.md) - - [NetworkGroupAssignmentsResponse](docs/NetworkGroupAssignmentsResponse.md) - [PaginationDetails](docs/PaginationDetails.md) - [Parent](docs/Parent.md) - [Sensor](docs/Sensor.md) diff --git a/pkg/config-api-client/api/.openapi.source.yaml b/pkg/config-api-client/api/.openapi.source.yaml index efb154aa..72c6de43 100644 --- a/pkg/config-api-client/api/.openapi.source.yaml +++ b/pkg/config-api-client/api/.openapi.source.yaml @@ -9,7 +9,7 @@ info: email: support@capenetworks.com license: name: No idea, but we need something - version: 1.14.0 + version: 1.15.0 servers: - url: https://api.capenetworks.com - url: https://api.staging.capedev.io @@ -143,7 +143,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/NetworkGroupAssignmentsResponse' + $ref: '#/components/schemas/NetworkGroupAssignmentsGetResponse' 4XX: description: Client Error content: @@ -528,6 +528,20 @@ components: - header - query.parameter title: IssueSubject + NetworkGroupAssignmentsGetResponse: + type: object + properties: + network_group_assignments: + type: array + items: + $ref: '#/components/schemas/NetworkGroupAssignmentsItem' + title: Network Group Assignments + pagination: + $ref: '#/components/schemas/PaginationDetails' + required: + - network_group_assignments + - pagination + title: NetworkGroupAssignmentsGetResponse NetworkGroupAssignmentsItem: type: object properties: @@ -545,20 +559,6 @@ components: - group_uid - network_uid title: NetworkGroupAssignmentsItem - NetworkGroupAssignmentsResponse: - type: object - properties: - network_group_assignments: - type: array - items: - $ref: '#/components/schemas/NetworkGroupAssignmentsItem' - title: Network Group Assignments - pagination: - $ref: '#/components/schemas/PaginationDetails' - required: - - network_group_assignments - - pagination - title: NetworkGroupAssignmentsResponse PaginationDetails: type: object properties: diff --git a/pkg/config-api-client/api/openapi.yaml b/pkg/config-api-client/api/openapi.yaml index 0b17ec02..685ac928 100644 --- a/pkg/config-api-client/api/openapi.yaml +++ b/pkg/config-api-client/api/openapi.yaml @@ -9,7 +9,7 @@ info: name: "No idea, but we need something" termsOfService: http://we.dont.care.yet.com/term-of-service title: Configuration Api - version: 1.14.0 + version: 1.15.0 servers: - url: https://api.capenetworks.com - url: https://api.staging.capedev.io @@ -150,7 +150,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/NetworkGroupAssignmentsResponse' + $ref: '#/components/schemas/NetworkGroupAssignmentsGetResponse' description: Successful Response "4XX": content: @@ -590,28 +590,7 @@ components: - query.parameter title: IssueSubject type: string - NetworkGroupAssignmentsItem: - example: - group_uid: group_uid - uid: uid - network_uid: network_uid - properties: - uid: - title: Uid - type: string - group_uid: - title: Group Uid - type: string - network_uid: - title: Network Uid - type: string - required: - - group_uid - - network_uid - - uid - title: NetworkGroupAssignmentsItem - type: object - NetworkGroupAssignmentsResponse: + NetworkGroupAssignmentsGetResponse: example: pagination: next: next @@ -637,7 +616,28 @@ components: required: - network_group_assignments - pagination - title: NetworkGroupAssignmentsResponse + title: NetworkGroupAssignmentsGetResponse + type: object + NetworkGroupAssignmentsItem: + example: + group_uid: group_uid + uid: uid + network_uid: network_uid + properties: + uid: + title: Uid + type: string + group_uid: + title: Group Uid + type: string + network_uid: + title: Network Uid + type: string + required: + - group_uid + - network_uid + - uid + title: NetworkGroupAssignmentsItem type: object PaginationDetails: example: diff --git a/pkg/config-api-client/api_configuration.go b/pkg/config-api-client/api_configuration.go index f8f60503..2b0dff5e 100644 --- a/pkg/config-api-client/api_configuration.go +++ b/pkg/config-api-client/api_configuration.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ @@ -45,7 +45,7 @@ func (r ApiGetUxiV1alpha1NetworkGroupAssignmentsGetRequest) Limit(limit int32) A return r } -func (r ApiGetUxiV1alpha1NetworkGroupAssignmentsGetRequest) Execute() (*NetworkGroupAssignmentsResponse, *http.Response, error) { +func (r ApiGetUxiV1alpha1NetworkGroupAssignmentsGetRequest) Execute() (*NetworkGroupAssignmentsGetResponse, *http.Response, error) { return r.ApiService.GetUxiV1alpha1NetworkGroupAssignmentsGetExecute(r) } @@ -66,13 +66,13 @@ func (a *ConfigurationAPIService) GetUxiV1alpha1NetworkGroupAssignmentsGet(ctx c // Execute executes the request // -// @return NetworkGroupAssignmentsResponse -func (a *ConfigurationAPIService) GetUxiV1alpha1NetworkGroupAssignmentsGetExecute(r ApiGetUxiV1alpha1NetworkGroupAssignmentsGetRequest) (*NetworkGroupAssignmentsResponse, *http.Response, error) { +// @return NetworkGroupAssignmentsGetResponse +func (a *ConfigurationAPIService) GetUxiV1alpha1NetworkGroupAssignmentsGetExecute(r ApiGetUxiV1alpha1NetworkGroupAssignmentsGetRequest) (*NetworkGroupAssignmentsGetResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *NetworkGroupAssignmentsResponse + localVarReturnValue *NetworkGroupAssignmentsGetResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.GetUxiV1alpha1NetworkGroupAssignmentsGet") diff --git a/pkg/config-api-client/client.go b/pkg/config-api-client/client.go index 5086d84e..cd2e6982 100644 --- a/pkg/config-api-client/client.go +++ b/pkg/config-api-client/client.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ @@ -41,7 +41,7 @@ var ( queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) -// APIClient manages communication with the Configuration Api API v1.14.0 +// APIClient manages communication with the Configuration Api API v1.15.0 // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration diff --git a/pkg/config-api-client/configuration.go b/pkg/config-api-client/configuration.go index 2265e5d4..b2ed96f2 100644 --- a/pkg/config-api-client/configuration.go +++ b/pkg/config-api-client/configuration.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/docs/ConfigurationAPI.md b/pkg/config-api-client/docs/ConfigurationAPI.md index 225215ca..75bae8b1 100644 --- a/pkg/config-api-client/docs/ConfigurationAPI.md +++ b/pkg/config-api-client/docs/ConfigurationAPI.md @@ -16,7 +16,7 @@ Method | HTTP request | Description ## GetUxiV1alpha1NetworkGroupAssignmentsGet -> NetworkGroupAssignmentsResponse GetUxiV1alpha1NetworkGroupAssignmentsGet(ctx).Uid(uid).Cursor(cursor).Limit(limit).Execute() +> NetworkGroupAssignmentsGetResponse GetUxiV1alpha1NetworkGroupAssignmentsGet(ctx).Uid(uid).Cursor(cursor).Limit(limit).Execute() Get @@ -46,7 +46,7 @@ func main() { fmt.Fprintf(os.Stderr, "Error when calling `ConfigurationAPI.GetUxiV1alpha1NetworkGroupAssignmentsGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetUxiV1alpha1NetworkGroupAssignmentsGet`: NetworkGroupAssignmentsResponse + // response from `GetUxiV1alpha1NetworkGroupAssignmentsGet`: NetworkGroupAssignmentsGetResponse fmt.Fprintf(os.Stdout, "Response from `ConfigurationAPI.GetUxiV1alpha1NetworkGroupAssignmentsGet`: %v\n", resp) } ``` @@ -68,7 +68,7 @@ Name | Type | Description | Notes ### Return type -[**NetworkGroupAssignmentsResponse**](NetworkGroupAssignmentsResponse.md) +[**NetworkGroupAssignmentsGetResponse**](NetworkGroupAssignmentsGetResponse.md) ### Authorization diff --git a/pkg/config-api-client/docs/NetworkGroupAssignmentsGetResponse.md b/pkg/config-api-client/docs/NetworkGroupAssignmentsGetResponse.md new file mode 100644 index 00000000..f09dc5e0 --- /dev/null +++ b/pkg/config-api-client/docs/NetworkGroupAssignmentsGetResponse.md @@ -0,0 +1,72 @@ +# NetworkGroupAssignmentsGetResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NetworkGroupAssignments** | [**[]NetworkGroupAssignmentsItem**](NetworkGroupAssignmentsItem.md) | | +**Pagination** | [**PaginationDetails**](PaginationDetails.md) | | + +## Methods + +### NewNetworkGroupAssignmentsGetResponse + +`func NewNetworkGroupAssignmentsGetResponse(networkGroupAssignments []NetworkGroupAssignmentsItem, pagination PaginationDetails, ) *NetworkGroupAssignmentsGetResponse` + +NewNetworkGroupAssignmentsGetResponse instantiates a new NetworkGroupAssignmentsGetResponse 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 + +### NewNetworkGroupAssignmentsGetResponseWithDefaults + +`func NewNetworkGroupAssignmentsGetResponseWithDefaults() *NetworkGroupAssignmentsGetResponse` + +NewNetworkGroupAssignmentsGetResponseWithDefaults instantiates a new NetworkGroupAssignmentsGetResponse 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 + +### GetNetworkGroupAssignments + +`func (o *NetworkGroupAssignmentsGetResponse) GetNetworkGroupAssignments() []NetworkGroupAssignmentsItem` + +GetNetworkGroupAssignments returns the NetworkGroupAssignments field if non-nil, zero value otherwise. + +### GetNetworkGroupAssignmentsOk + +`func (o *NetworkGroupAssignmentsGetResponse) GetNetworkGroupAssignmentsOk() (*[]NetworkGroupAssignmentsItem, bool)` + +GetNetworkGroupAssignmentsOk returns a tuple with the NetworkGroupAssignments field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetworkGroupAssignments + +`func (o *NetworkGroupAssignmentsGetResponse) SetNetworkGroupAssignments(v []NetworkGroupAssignmentsItem)` + +SetNetworkGroupAssignments sets NetworkGroupAssignments field to given value. + + +### GetPagination + +`func (o *NetworkGroupAssignmentsGetResponse) GetPagination() PaginationDetails` + +GetPagination returns the Pagination field if non-nil, zero value otherwise. + +### GetPaginationOk + +`func (o *NetworkGroupAssignmentsGetResponse) GetPaginationOk() (*PaginationDetails, bool)` + +GetPaginationOk returns a tuple with the Pagination field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPagination + +`func (o *NetworkGroupAssignmentsGetResponse) SetPagination(v PaginationDetails)` + +SetPagination sets Pagination field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/config-api-client/model_error_detail.go b/pkg/config-api-client/model_error_detail.go index b0b0cae8..8b0662b6 100644 --- a/pkg/config-api-client/model_error_detail.go +++ b/pkg/config-api-client/model_error_detail.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_error_response.go b/pkg/config-api-client/model_error_response.go index 6db9c928..fece33cc 100644 --- a/pkg/config-api-client/model_error_response.go +++ b/pkg/config-api-client/model_error_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_group.go b/pkg/config-api-client/model_group.go index 7e87529d..7e3bf6a8 100644 --- a/pkg/config-api-client/model_group.go +++ b/pkg/config-api-client/model_group.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_get_item.go b/pkg/config-api-client/model_groups_get_item.go index c0abfc87..a84a07c6 100644 --- a/pkg/config-api-client/model_groups_get_item.go +++ b/pkg/config-api-client/model_groups_get_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_get_response.go b/pkg/config-api-client/model_groups_get_response.go index f9880e4c..77642571 100644 --- a/pkg/config-api-client/model_groups_get_response.go +++ b/pkg/config-api-client/model_groups_get_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_post_request.go b/pkg/config-api-client/model_groups_post_request.go index 8d23c724..12b304f4 100644 --- a/pkg/config-api-client/model_groups_post_request.go +++ b/pkg/config-api-client/model_groups_post_request.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_groups_post_response.go b/pkg/config-api-client/model_groups_post_response.go index 4e5b2ae9..427f3684 100644 --- a/pkg/config-api-client/model_groups_post_response.go +++ b/pkg/config-api-client/model_groups_post_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_issue.go b/pkg/config-api-client/model_issue.go index af7c40ef..d5739426 100644 --- a/pkg/config-api-client/model_issue.go +++ b/pkg/config-api-client/model_issue.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_issue_subject.go b/pkg/config-api-client/model_issue_subject.go index 61af6d23..2048765b 100644 --- a/pkg/config-api-client/model_issue_subject.go +++ b/pkg/config-api-client/model_issue_subject.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_network_group_assignments_get_response.go b/pkg/config-api-client/model_network_group_assignments_get_response.go new file mode 100644 index 00000000..1e9359bc --- /dev/null +++ b/pkg/config-api-client/model_network_group_assignments_get_response.go @@ -0,0 +1,185 @@ +/* +Configuration Api + +Nice description goes here + +API version: 1.15.0 +Contact: support@capenetworks.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package config_api_client + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the NetworkGroupAssignmentsGetResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkGroupAssignmentsGetResponse{} + +// NetworkGroupAssignmentsGetResponse struct for NetworkGroupAssignmentsGetResponse +type NetworkGroupAssignmentsGetResponse struct { + NetworkGroupAssignments []NetworkGroupAssignmentsItem `json:"network_group_assignments"` + Pagination PaginationDetails `json:"pagination"` +} + +type _NetworkGroupAssignmentsGetResponse NetworkGroupAssignmentsGetResponse + +// NewNetworkGroupAssignmentsGetResponse instantiates a new NetworkGroupAssignmentsGetResponse 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 NewNetworkGroupAssignmentsGetResponse(networkGroupAssignments []NetworkGroupAssignmentsItem, pagination PaginationDetails) *NetworkGroupAssignmentsGetResponse { + this := NetworkGroupAssignmentsGetResponse{} + this.NetworkGroupAssignments = networkGroupAssignments + this.Pagination = pagination + return &this +} + +// NewNetworkGroupAssignmentsGetResponseWithDefaults instantiates a new NetworkGroupAssignmentsGetResponse 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 NewNetworkGroupAssignmentsGetResponseWithDefaults() *NetworkGroupAssignmentsGetResponse { + this := NetworkGroupAssignmentsGetResponse{} + return &this +} + +// GetNetworkGroupAssignments returns the NetworkGroupAssignments field value +func (o *NetworkGroupAssignmentsGetResponse) GetNetworkGroupAssignments() []NetworkGroupAssignmentsItem { + if o == nil { + var ret []NetworkGroupAssignmentsItem + return ret + } + + return o.NetworkGroupAssignments +} + +// GetNetworkGroupAssignmentsOk returns a tuple with the NetworkGroupAssignments field value +// and a boolean to check if the value has been set. +func (o *NetworkGroupAssignmentsGetResponse) GetNetworkGroupAssignmentsOk() ([]NetworkGroupAssignmentsItem, bool) { + if o == nil { + return nil, false + } + return o.NetworkGroupAssignments, true +} + +// SetNetworkGroupAssignments sets field value +func (o *NetworkGroupAssignmentsGetResponse) SetNetworkGroupAssignments(v []NetworkGroupAssignmentsItem) { + o.NetworkGroupAssignments = v +} + +// GetPagination returns the Pagination field value +func (o *NetworkGroupAssignmentsGetResponse) GetPagination() PaginationDetails { + if o == nil { + var ret PaginationDetails + return ret + } + + return o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value +// and a boolean to check if the value has been set. +func (o *NetworkGroupAssignmentsGetResponse) GetPaginationOk() (*PaginationDetails, bool) { + if o == nil { + return nil, false + } + return &o.Pagination, true +} + +// SetPagination sets field value +func (o *NetworkGroupAssignmentsGetResponse) SetPagination(v PaginationDetails) { + o.Pagination = v +} + +func (o NetworkGroupAssignmentsGetResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkGroupAssignmentsGetResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["network_group_assignments"] = o.NetworkGroupAssignments + toSerialize["pagination"] = o.Pagination + return toSerialize, nil +} + +func (o *NetworkGroupAssignmentsGetResponse) 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{ + "network_group_assignments", + "pagination", + } + + 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) + } + } + + varNetworkGroupAssignmentsGetResponse := _NetworkGroupAssignmentsGetResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varNetworkGroupAssignmentsGetResponse) + + if err != nil { + return err + } + + *o = NetworkGroupAssignmentsGetResponse(varNetworkGroupAssignmentsGetResponse) + + return err +} + +type NullableNetworkGroupAssignmentsGetResponse struct { + value *NetworkGroupAssignmentsGetResponse + isSet bool +} + +func (v NullableNetworkGroupAssignmentsGetResponse) Get() *NetworkGroupAssignmentsGetResponse { + return v.value +} + +func (v *NullableNetworkGroupAssignmentsGetResponse) Set(val *NetworkGroupAssignmentsGetResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkGroupAssignmentsGetResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkGroupAssignmentsGetResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkGroupAssignmentsGetResponse(val *NetworkGroupAssignmentsGetResponse) *NullableNetworkGroupAssignmentsGetResponse { + return &NullableNetworkGroupAssignmentsGetResponse{value: val, isSet: true} +} + +func (v NullableNetworkGroupAssignmentsGetResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkGroupAssignmentsGetResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/config-api-client/model_network_group_assignments_item.go b/pkg/config-api-client/model_network_group_assignments_item.go index 6e0cc985..ea3bbad0 100644 --- a/pkg/config-api-client/model_network_group_assignments_item.go +++ b/pkg/config-api-client/model_network_group_assignments_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_pagination_details.go b/pkg/config-api-client/model_pagination_details.go index 84a58aa4..b9110e31 100644 --- a/pkg/config-api-client/model_pagination_details.go +++ b/pkg/config-api-client/model_pagination_details.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_parent.go b/pkg/config-api-client/model_parent.go index b52fd24a..abcb01e9 100644 --- a/pkg/config-api-client/model_parent.go +++ b/pkg/config-api-client/model_parent.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor.go b/pkg/config-api-client/model_sensor.go index 300e26f6..45dad539 100644 --- a/pkg/config-api-client/model_sensor.go +++ b/pkg/config-api-client/model_sensor.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor_group_assignment_response.go b/pkg/config-api-client/model_sensor_group_assignment_response.go index 92086ce5..3e4a23d8 100644 --- a/pkg/config-api-client/model_sensor_group_assignment_response.go +++ b/pkg/config-api-client/model_sensor_group_assignment_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor_group_assignments_item.go b/pkg/config-api-client/model_sensor_group_assignments_item.go index 2e862212..25a2fc64 100644 --- a/pkg/config-api-client/model_sensor_group_assignments_item.go +++ b/pkg/config-api-client/model_sensor_group_assignments_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor_group_assignments_post_request.go b/pkg/config-api-client/model_sensor_group_assignments_post_request.go index 00a0cb78..4e47d105 100644 --- a/pkg/config-api-client/model_sensor_group_assignments_post_request.go +++ b/pkg/config-api-client/model_sensor_group_assignments_post_request.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_sensor_group_assignments_response.go b/pkg/config-api-client/model_sensor_group_assignments_response.go index 4eee9288..87d637af 100644 --- a/pkg/config-api-client/model_sensor_group_assignments_response.go +++ b/pkg/config-api-client/model_sensor_group_assignments_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_wired_networks_item.go b/pkg/config-api-client/model_wired_networks_item.go index e340f6b0..df5860a5 100644 --- a/pkg/config-api-client/model_wired_networks_item.go +++ b/pkg/config-api-client/model_wired_networks_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_wired_networks_response.go b/pkg/config-api-client/model_wired_networks_response.go index 002e3964..6dc731ca 100644 --- a/pkg/config-api-client/model_wired_networks_response.go +++ b/pkg/config-api-client/model_wired_networks_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_wireless_networks_item.go b/pkg/config-api-client/model_wireless_networks_item.go index e4e327d2..37afffba 100644 --- a/pkg/config-api-client/model_wireless_networks_item.go +++ b/pkg/config-api-client/model_wireless_networks_item.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/model_wireless_networks_response.go b/pkg/config-api-client/model_wireless_networks_response.go index cbef5dc7..d60609c7 100644 --- a/pkg/config-api-client/model_wireless_networks_response.go +++ b/pkg/config-api-client/model_wireless_networks_response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/response.go b/pkg/config-api-client/response.go index 270b9f7d..8c536f33 100644 --- a/pkg/config-api-client/response.go +++ b/pkg/config-api-client/response.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */ diff --git a/pkg/config-api-client/test/api_configuration_test.go b/pkg/config-api-client/test/api_configuration_test.go index 98227838..8ad36c10 100644 --- a/pkg/config-api-client/test/api_configuration_test.go +++ b/pkg/config-api-client/test/api_configuration_test.go @@ -20,6 +20,47 @@ func Test_config_api_client_ConfigurationAPIService(t *testing.T) { defer gock.Off() + t.Run("Test ConfigurationAPIService GroupsGetUxiV1alpha1GroupsGet", func(t *testing.T) { + parent_uid := "parent_uid" + gock.New(configuration.Scheme + "://" + configuration.Host). + Get("/uxi/v1alpha1/groups"). + MatchParams(map[string]string{"uid": "uid", "limit": "10", "cursor": "some-cursor"}). + Reply(200). + JSON(map[string]interface{}{ + "items": []map[string]interface{}{ + { + "id": "uid", + "name": "name", + "parent": map[string]string{"id": parent_uid}, + "path": "root_uid.parent_uid.uid", + }, + }, + "next": nil, + "count": 1, + }) + resp, httpRes, err := apiClient.ConfigurationAPI. + GroupsGetUxiV1alpha1GroupsGet(context.Background()). + Uid("uid"). + Limit(10). + Cursor("some-cursor"). + Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, resp, &openapiclient.GroupsGetResponse{ + Items: []openapiclient.GroupsGetItem{ + { + Id: "uid", + Name: "name", + Parent: *openapiclient.NewNullableParent(openapiclient.NewParent("parent_uid")), + Path: "root_uid.parent_uid.uid", + }, + }, + Next: *openapiclient.NewNullableString(nil), + Count: 1, + }) + }) + t.Run("Test ConfigurationAPIService GroupsPostUxiV1alpha1GroupsPost", func(t *testing.T) { gock.New(configuration.Scheme + "://" + configuration.Host).Post("/uxi/v1alpha1/groups").Reply(200).JSON(map[string]string{"parent_uid": "parent.uid", "name": "name", "uid": "node", "path": "parent.uid.node"}) @@ -109,47 +150,6 @@ func Test_config_api_client_ConfigurationAPIService(t *testing.T) { }) }) - t.Run("Test ConfigurationAPIService GroupsGetUxiV1alpha1GroupsGet", func(t *testing.T) { - parent_uid := "parent_uid" - gock.New(configuration.Scheme + "://" + configuration.Host). - Get("/uxi/v1alpha1/groups"). - MatchParams(map[string]string{"uid": "uid", "limit": "10", "cursor": "some-cursor"}). - Reply(200). - JSON(map[string]interface{}{ - "items": []map[string]interface{}{ - { - "id": "uid", - "name": "name", - "parent": map[string]string{"id": parent_uid}, - "path": "root_uid.parent_uid.uid", - }, - }, - "next": nil, - "count": 1, - }) - resp, httpRes, err := apiClient.ConfigurationAPI. - GroupsGetUxiV1alpha1GroupsGet(context.Background()). - Uid("uid"). - Limit(10). - Cursor("some-cursor"). - Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &openapiclient.GroupsGetResponse{ - Items: []openapiclient.GroupsGetItem{ - { - Id: "uid", - Name: "name", - Parent: *openapiclient.NewNullableParent(openapiclient.NewParent("parent_uid")), - Path: "root_uid.parent_uid.uid", - }, - }, - Next: *openapiclient.NewNullableString(nil), - Count: 1, - }) - }) - t.Run("Test ConfigurationAPIService GetConfigurationAppV1WiredNetworksGet", func(t *testing.T) { gock.New(configuration.Scheme + "://" + configuration.Host). @@ -291,4 +291,53 @@ func Test_config_api_client_ConfigurationAPIService(t *testing.T) { }) }) + t.Run("Test ConfigurationAPIService GetUxiV1alpha1NetworkGroupAssignmentsGet", func(t *testing.T) { + + gock.New(configuration.Scheme + "://" + configuration.Host). + Get("/uxi/v1alpha1/network-group-assignments"). + MatchParams(map[string]string{"uid": "uid", "limit": "10", "cursor": "some-cursor"}). + Reply(200). + JSON(map[string]interface{}{ + "network_group_assignments": []map[string]interface{}{ + { + "uid": "uid", + "group_uid": "group_uid", + "network_uid": "network_uid", + }, + }, + "pagination": map[string]interface{}{ + "limit": 10, + "first": nil, + "next": nil, + "previous": nil, + "last": nil, + }, + }) + resp, httpRes, err := apiClient.ConfigurationAPI. + GetUxiV1alpha1NetworkGroupAssignmentsGet(context.Background()). + Uid("uid"). + Limit(10). + Cursor("some-cursor"). + Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, resp, &openapiclient.NetworkGroupAssignmentsGetResponse{ + NetworkGroupAssignments: []openapiclient.NetworkGroupAssignmentsItem{ + { + Uid: "uid", + GroupUid: "group_uid", + NetworkUid: "network_uid", + }, + }, + Pagination: openapiclient.PaginationDetails{ + Limit: 10, + Next: *openapiclient.NewNullableString(nil), + Previous: *openapiclient.NewNullableString(nil), + First: *openapiclient.NewNullableString(nil), + Last: *openapiclient.NewNullableString(nil), + }, + }) + }) + } diff --git a/pkg/config-api-client/utils.go b/pkg/config-api-client/utils.go index 6cd0dedc..67cacf5d 100644 --- a/pkg/config-api-client/utils.go +++ b/pkg/config-api-client/utils.go @@ -3,7 +3,7 @@ Configuration Api Nice description goes here -API version: 1.14.0 +API version: 1.15.0 Contact: support@capenetworks.com */