diff --git a/ipmgmt/.openapi-generator/FILES b/ipmgmt/.openapi-generator/FILES index 6d55d66..7bff2f2 100644 --- a/ipmgmt/.openapi-generator/FILES +++ b/ipmgmt/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -19,6 +18,7 @@ docs/NullRouteIPOpts.md docs/NullRoutedIP.md docs/ProtocolVersion.md docs/ReverseLookup.md +docs/Sort.md docs/Subnet.md docs/UpdateIPOpts.md docs/UpdateNullRouteOpts.md @@ -39,11 +39,11 @@ model_null_route_ip_opts.go model_null_routed_ip.go model_protocol_version.go model_reverse_lookup.go +model_sort.go model_subnet.go model_update_ip_opts.go model_update_null_route_opts.go model_update_reverse_lookup_records_opts.go model_update_reverse_lookup_records_result.go response.go -test/api_ipmgmt_test.go utils.go diff --git a/ipmgmt/README.md b/ipmgmt/README.md index 1200662..3706ea2 100644 --- a/ipmgmt/README.md +++ b/ipmgmt/README.md @@ -104,6 +104,7 @@ Class | Method | HTTP request | Description - [NullRoutedIP](docs/NullRoutedIP.md) - [ProtocolVersion](docs/ProtocolVersion.md) - [ReverseLookup](docs/ReverseLookup.md) + - [Sort](docs/Sort.md) - [Subnet](docs/Subnet.md) - [UpdateIPOpts](docs/UpdateIPOpts.md) - [UpdateNullRouteOpts](docs/UpdateNullRouteOpts.md) diff --git a/ipmgmt/api/openapi.yaml b/ipmgmt/api/openapi.yaml index b6c3ff0..6fab665 100644 --- a/ipmgmt/api/openapi.yaml +++ b/ipmgmt/api/openapi.yaml @@ -151,7 +151,7 @@ paths: name: sort required: false schema: - type: string + $ref: '#/components/schemas/sort' style: form - description: Filter by reverse lookup. example: mydomain1.example.com @@ -887,7 +887,7 @@ paths: name: sort required: false schema: - type: string + $ref: '#/components/schemas/sort' style: form responses: "200": @@ -1182,7 +1182,7 @@ components: name: sort required: false schema: - type: string + $ref: '#/components/schemas/sort' style: form reverseLookup: description: Filter by reverse lookup. @@ -1287,6 +1287,12 @@ components: - ROUTER2 - IPMI type: string + sort: + enum: + - ip + - nullRouted + - reverseLookup + type: string assignedContract: description: An explanation about the purpose of this instance. example: diff --git a/ipmgmt/api_ipmgmt.go b/ipmgmt/api_ipmgmt.go index 7197b90..ef6b46a 100644 --- a/ipmgmt/api_ipmgmt.go +++ b/ipmgmt/api_ipmgmt.go @@ -177,7 +177,7 @@ type ApiGetIPListRequest struct { ips *string equipmentIds *string assignedContractIds *string - sort *string + sort *Sort reverseLookup *string } @@ -254,7 +254,7 @@ func (r ApiGetIPListRequest) AssignedContractIds(assignedContractIds string) Api } // Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. -func (r ApiGetIPListRequest) Sort(sort string) ApiGetIPListRequest { +func (r ApiGetIPListRequest) Sort(sort Sort) ApiGetIPListRequest { r.sort = &sort return r } @@ -470,7 +470,7 @@ type ApiGetNullRouteHistoryListRequest struct { ticketId *string contractId *string equipmentId *string - sort *string + sort *Sort } // Limit the number of results returned. @@ -540,7 +540,7 @@ func (r ApiGetNullRouteHistoryListRequest) EquipmentId(equipmentId string) ApiGe } // Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. -func (r ApiGetNullRouteHistoryListRequest) Sort(sort string) ApiGetNullRouteHistoryListRequest { +func (r ApiGetNullRouteHistoryListRequest) Sort(sort Sort) ApiGetNullRouteHistoryListRequest { r.sort = &sort return r } diff --git a/ipmgmt/docs/IpmgmtAPI.md b/ipmgmt/docs/IpmgmtAPI.md index f42256d..7a8f2f6 100644 --- a/ipmgmt/docs/IpmgmtAPI.md +++ b/ipmgmt/docs/IpmgmtAPI.md @@ -48,7 +48,7 @@ func main() { ips := "ips_example" // string | Return only IPs specified as a comma-separated list (optional) equipmentIds := "equipmentIds_example" // string | Return only IPs assigned to equipment items specified as a comma-separated list of IDs (optional) assignedContractIds := "assignedContractIds_example" // string | Return only IPs assigned to contracts specified as a comma-separated list of IDs (optional) - sort := "sort_example" // string | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. (optional) + sort := openapiclient.sort("ip") // Sort | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. (optional) reverseLookup := "mydomain1.example.com" // string | Filter by reverse lookup. (optional) configuration := openapiclient.NewConfiguration() @@ -86,7 +86,7 @@ Name | Type | Description | Notes **ips** | **string** | Return only IPs specified as a comma-separated list | **equipmentIds** | **string** | Return only IPs assigned to equipment items specified as a comma-separated list of IDs | **assignedContractIds** | **string** | Return only IPs assigned to contracts specified as a comma-separated list of IDs | - **sort** | **string** | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. | + **sort** | [**Sort**](Sort.md) | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. | **reverseLookup** | **string** | Filter by reverse lookup. | ### Return type @@ -138,7 +138,7 @@ func main() { ticketId := "ticketId_example" // string | Filter by the reference stored with the null route (optional) contractId := "contractId_example" // string | Filter by ID of the contract assigned to the IP at the time of null route creation (optional) equipmentId := "equipmentId_example" // string | Filter by ID of the server assigned to the IP at the time of null route creation (optional) - sort := "sort_example" // string | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. (optional) + sort := openapiclient.sort("ip") // Sort | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -174,7 +174,7 @@ Name | Type | Description | Notes **ticketId** | **string** | Filter by the reference stored with the null route | **contractId** | **string** | Filter by ID of the contract assigned to the IP at the time of null route creation | **equipmentId** | **string** | Filter by ID of the server assigned to the IP at the time of null route creation | - **sort** | **string** | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. | + **sort** | [**Sort**](Sort.md) | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. | ### Return type diff --git a/ipmgmt/docs/Sort.md b/ipmgmt/docs/Sort.md new file mode 100644 index 0000000..e0b3a04 --- /dev/null +++ b/ipmgmt/docs/Sort.md @@ -0,0 +1,15 @@ +# Sort + +## Enum + + +* `IP` (value: `"ip"`) + +* `NULL_ROUTED` (value: `"nullRouted"`) + +* `REVERSE_LOOKUP` (value: `"reverseLookup"`) + + +[[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/ipmgmt/model_sort.go b/ipmgmt/model_sort.go new file mode 100644 index 0000000..b97a1b7 --- /dev/null +++ b/ipmgmt/model_sort.go @@ -0,0 +1,113 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ipmgmt + +import ( + "encoding/json" + "fmt" +) + +// Sort the model 'Sort' +type Sort string + +// List of sort +const ( + SORT_IP Sort = "ip" + SORT_NULL_ROUTED Sort = "nullRouted" + SORT_REVERSE_LOOKUP Sort = "reverseLookup" +) + +// All allowed values of Sort enum +var AllowedSortEnumValues = []Sort{ + "ip", + "nullRouted", + "reverseLookup", +} + +func (v *Sort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Sort(value) + for _, existing := range AllowedSortEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Sort", value) +} + +// NewSortFromValue returns a pointer to a valid Sort +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSortFromValue(v string) (*Sort, error) { + ev := Sort(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Sort: valid values are %v", v, AllowedSortEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Sort) IsValid() bool { + for _, existing := range AllowedSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to sort value +func (v Sort) Ptr() *Sort { + return &v +} + +type NullableSort struct { + value *Sort + isSet bool +} + +func (v NullableSort) Get() *Sort { + return v.value +} + +func (v *NullableSort) Set(val *Sort) { + v.value = val + v.isSet = true +} + +func (v NullableSort) IsSet() bool { + return v.isSet +} + +func (v *NullableSort) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSort(val *Sort) *NullableSort { + return &NullableSort{value: val, isSet: true} +} + +func (v NullableSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} +