From 44b4c1ac4d9b850ddab66aaef160c84bb68035aa Mon Sep 17 00:00:00 2001 From: Charles Treatman Date: Thu, 21 Sep 2023 13:16:52 -0500 Subject: [PATCH] fix: remove plan drive type and nic type enums (#156) The [previous fix for plan drive type](https://github.com/equinix-labs/metal-go/155) did not work; it turns out that the API plan data includes plans with drive type `NVMe` _and_ plans with drive type `NVME`. As mentioned on the previous PR, adding both options to the enum generates invalid code, and we don't have a practical way to enable case-insensitive comparisons for string enums. Reverting the plan drive type to a plain string uncovered a different issue with the nic type enum: some plans (`storage` type, possibly others) include the following for drives and nics: ```json "drives": [ { "count": 0, "size": "", "type": "" } ], "nics": [ { "count": 0, "type": "" } ] ``` Rather than test `nullable: true` here, I opted to change the nic type to a plain string as well. --- API.md | 2 - api/openapi.yaml | 180 ++++++++---------- docs/PlanSpecsDrivesInner.md | 8 +- docs/PlanSpecsDrivesInnerType.md | 15 -- docs/PlanSpecsNicsInner.md | 8 +- docs/PlanSpecsNicsInnerType.md | 15 -- metal/v1/.openapi-generator/FILES | 4 - metal/v1/model_plan_specs_drives_inner.go | 12 +- .../v1/model_plan_specs_drives_inner_type.go | 113 ----------- metal/v1/model_plan_specs_nics_inner.go | 14 +- metal/v1/model_plan_specs_nics_inner_type.go | 113 ----------- .../20230920-plan-drive-type.patch | 13 -- .../20230921-plan-drive-type.patch | 26 +++ .../oas3.patched/components/schemas/Plan.yaml | 8 - 14 files changed, 131 insertions(+), 400 deletions(-) delete mode 100644 docs/PlanSpecsDrivesInnerType.md delete mode 100644 docs/PlanSpecsNicsInnerType.md delete mode 100644 metal/v1/model_plan_specs_drives_inner_type.go delete mode 100644 metal/v1/model_plan_specs_nics_inner_type.go delete mode 100644 patches/spec.fetched.json/20230920-plan-drive-type.patch create mode 100644 patches/spec.fetched.json/20230921-plan-drive-type.patch diff --git a/API.md b/API.md index 03b368cc..32dde115 100644 --- a/API.md +++ b/API.md @@ -570,11 +570,9 @@ Class | Method | HTTP request | Description - [PlanSpecsCpusInner](docs/PlanSpecsCpusInner.md) - [PlanSpecsDrivesInner](docs/PlanSpecsDrivesInner.md) - [PlanSpecsDrivesInnerCategory](docs/PlanSpecsDrivesInnerCategory.md) - - [PlanSpecsDrivesInnerType](docs/PlanSpecsDrivesInnerType.md) - [PlanSpecsFeatures](docs/PlanSpecsFeatures.md) - [PlanSpecsMemory](docs/PlanSpecsMemory.md) - [PlanSpecsNicsInner](docs/PlanSpecsNicsInner.md) - - [PlanSpecsNicsInnerType](docs/PlanSpecsNicsInnerType.md) - [PlanType](docs/PlanType.md) - [Port](docs/Port.md) - [PortAssignInput](docs/PortAssignInput.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index eb727b65..1ab4a387 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -15669,17 +15669,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -15849,17 +15849,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -16654,17 +16654,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -16834,17 +16834,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -17256,17 +17256,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -17436,17 +17436,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -18390,17 +18390,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -18620,17 +18620,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -18786,17 +18786,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -19706,17 +19706,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -19768,17 +19768,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -19890,17 +19890,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -19952,17 +19952,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -20030,17 +20030,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -20092,17 +20092,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -20236,17 +20236,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -21234,17 +21234,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -21343,17 +21343,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -21398,17 +21398,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type deployment_types: - null - null @@ -30734,12 +30734,6 @@ components: total: type: string type: object - Plan_specs_drives_inner_type: - enum: - - HDD - - SSD - - NVMe - type: string Plan_specs_drives_inner_category: enum: - boot @@ -30750,35 +30744,29 @@ components: example: size: 3.84TB count: 1 - type: null + type: type category: null properties: count: type: integer type: - $ref: '#/components/schemas/Plan_specs_drives_inner_type' + type: string size: example: 3.84TB type: string category: $ref: '#/components/schemas/Plan_specs_drives_inner_category' type: object - Plan_specs_nics_inner_type: - enum: - - 1Gbps - - 10Gbps - - 25Gbps - type: string Plan_specs_nics_inner: example: count: 2 - type: null + type: type properties: count: example: 2 type: integer type: - $ref: '#/components/schemas/Plan_specs_nics_inner_type' + type: string type: object Plan_specs_features: example: @@ -30809,17 +30797,17 @@ components: drives: - size: 3.84TB count: 1 - type: null + type: type category: null - size: 3.84TB count: 1 - type: null + type: type category: null nics: - count: 2 - type: null + type: type - count: 2 - type: null + type: type properties: cpus: items: diff --git a/docs/PlanSpecsDrivesInner.md b/docs/PlanSpecsDrivesInner.md index 5f21825b..ddf0e14c 100644 --- a/docs/PlanSpecsDrivesInner.md +++ b/docs/PlanSpecsDrivesInner.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Count** | Pointer to **int32** | | [optional] -**Type** | Pointer to [**PlanSpecsDrivesInnerType**](PlanSpecsDrivesInnerType.md) | | [optional] +**Type** | Pointer to **string** | | [optional] **Size** | Pointer to **string** | | [optional] **Category** | Pointer to [**PlanSpecsDrivesInnerCategory**](PlanSpecsDrivesInnerCategory.md) | | [optional] @@ -55,20 +55,20 @@ HasCount returns a boolean if a field has been set. ### GetType -`func (o *PlanSpecsDrivesInner) GetType() PlanSpecsDrivesInnerType` +`func (o *PlanSpecsDrivesInner) GetType() string` GetType returns the Type field if non-nil, zero value otherwise. ### GetTypeOk -`func (o *PlanSpecsDrivesInner) GetTypeOk() (*PlanSpecsDrivesInnerType, bool)` +`func (o *PlanSpecsDrivesInner) GetTypeOk() (*string, bool)` GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetType -`func (o *PlanSpecsDrivesInner) SetType(v PlanSpecsDrivesInnerType)` +`func (o *PlanSpecsDrivesInner) SetType(v string)` SetType sets Type field to given value. diff --git a/docs/PlanSpecsDrivesInnerType.md b/docs/PlanSpecsDrivesInnerType.md deleted file mode 100644 index 2965d3ee..00000000 --- a/docs/PlanSpecsDrivesInnerType.md +++ /dev/null @@ -1,15 +0,0 @@ -# PlanSpecsDrivesInnerType - -## Enum - - -* `HDD` (value: `"HDD"`) - -* `SSD` (value: `"SSD"`) - -* `NVME` (value: `"NVMe"`) - - -[[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/docs/PlanSpecsNicsInner.md b/docs/PlanSpecsNicsInner.md index 2518006b..ede9901e 100644 --- a/docs/PlanSpecsNicsInner.md +++ b/docs/PlanSpecsNicsInner.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Count** | Pointer to **int32** | | [optional] -**Type** | Pointer to [**PlanSpecsNicsInnerType**](PlanSpecsNicsInnerType.md) | | [optional] +**Type** | Pointer to **string** | | [optional] ## Methods @@ -53,20 +53,20 @@ HasCount returns a boolean if a field has been set. ### GetType -`func (o *PlanSpecsNicsInner) GetType() PlanSpecsNicsInnerType` +`func (o *PlanSpecsNicsInner) GetType() string` GetType returns the Type field if non-nil, zero value otherwise. ### GetTypeOk -`func (o *PlanSpecsNicsInner) GetTypeOk() (*PlanSpecsNicsInnerType, bool)` +`func (o *PlanSpecsNicsInner) GetTypeOk() (*string, bool)` GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetType -`func (o *PlanSpecsNicsInner) SetType(v PlanSpecsNicsInnerType)` +`func (o *PlanSpecsNicsInner) SetType(v string)` SetType sets Type field to given value. diff --git a/docs/PlanSpecsNicsInnerType.md b/docs/PlanSpecsNicsInnerType.md deleted file mode 100644 index 7c54a1cb..00000000 --- a/docs/PlanSpecsNicsInnerType.md +++ /dev/null @@ -1,15 +0,0 @@ -# PlanSpecsNicsInnerType - -## Enum - - -* `_1_GBPS` (value: `"1Gbps"`) - -* `_10_GBPS` (value: `"10Gbps"`) - -* `_25_GBPS` (value: `"25Gbps"`) - - -[[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/metal/v1/.openapi-generator/FILES b/metal/v1/.openapi-generator/FILES index 18d6511d..878e938a 100644 --- a/metal/v1/.openapi-generator/FILES +++ b/metal/v1/.openapi-generator/FILES @@ -256,11 +256,9 @@ docs/PlanSpecs.md docs/PlanSpecsCpusInner.md docs/PlanSpecsDrivesInner.md docs/PlanSpecsDrivesInnerCategory.md -docs/PlanSpecsDrivesInnerType.md docs/PlanSpecsFeatures.md docs/PlanSpecsMemory.md docs/PlanSpecsNicsInner.md -docs/PlanSpecsNicsInnerType.md docs/PlanType.md docs/PlansApi.md docs/Port.md @@ -572,11 +570,9 @@ model_plan_specs.go model_plan_specs_cpus_inner.go model_plan_specs_drives_inner.go model_plan_specs_drives_inner_category.go -model_plan_specs_drives_inner_type.go model_plan_specs_features.go model_plan_specs_memory.go model_plan_specs_nics_inner.go -model_plan_specs_nics_inner_type.go model_plan_type.go model_port.go model_port_assign_input.go diff --git a/metal/v1/model_plan_specs_drives_inner.go b/metal/v1/model_plan_specs_drives_inner.go index b9338805..d519352f 100644 --- a/metal/v1/model_plan_specs_drives_inner.go +++ b/metal/v1/model_plan_specs_drives_inner.go @@ -21,7 +21,7 @@ var _ MappedNullable = &PlanSpecsDrivesInner{} // PlanSpecsDrivesInner struct for PlanSpecsDrivesInner type PlanSpecsDrivesInner struct { Count *int32 `json:"count,omitempty"` - Type *PlanSpecsDrivesInnerType `json:"type,omitempty"` + Type *string `json:"type,omitempty"` Size *string `json:"size,omitempty"` Category *PlanSpecsDrivesInnerCategory `json:"category,omitempty"` AdditionalProperties map[string]interface{} @@ -79,9 +79,9 @@ func (o *PlanSpecsDrivesInner) SetCount(v int32) { } // GetType returns the Type field value if set, zero value otherwise. -func (o *PlanSpecsDrivesInner) GetType() PlanSpecsDrivesInnerType { +func (o *PlanSpecsDrivesInner) GetType() string { if o == nil || IsNil(o.Type) { - var ret PlanSpecsDrivesInnerType + var ret string return ret } return *o.Type @@ -89,7 +89,7 @@ func (o *PlanSpecsDrivesInner) GetType() PlanSpecsDrivesInnerType { // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *PlanSpecsDrivesInner) GetTypeOk() (*PlanSpecsDrivesInnerType, bool) { +func (o *PlanSpecsDrivesInner) GetTypeOk() (*string, bool) { if o == nil || IsNil(o.Type) { return nil, false } @@ -105,8 +105,8 @@ func (o *PlanSpecsDrivesInner) HasType() bool { return false } -// SetType gets a reference to the given PlanSpecsDrivesInnerType and assigns it to the Type field. -func (o *PlanSpecsDrivesInner) SetType(v PlanSpecsDrivesInnerType) { +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *PlanSpecsDrivesInner) SetType(v string) { o.Type = &v } diff --git a/metal/v1/model_plan_specs_drives_inner_type.go b/metal/v1/model_plan_specs_drives_inner_type.go deleted file mode 100644 index ba7b7a2d..00000000 --- a/metal/v1/model_plan_specs_drives_inner_type.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -Metal API - -# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. - -API version: 1.0.0 -Contact: support@equinixmetal.com -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1 - -import ( - "encoding/json" - "fmt" -) - -// PlanSpecsDrivesInnerType the model 'PlanSpecsDrivesInnerType' -type PlanSpecsDrivesInnerType string - -// List of Plan_specs_drives_inner_type -const ( - PLANSPECSDRIVESINNERTYPE_HDD PlanSpecsDrivesInnerType = "HDD" - PLANSPECSDRIVESINNERTYPE_SSD PlanSpecsDrivesInnerType = "SSD" - PLANSPECSDRIVESINNERTYPE_NVME PlanSpecsDrivesInnerType = "NVMe" -) - -// All allowed values of PlanSpecsDrivesInnerType enum -var AllowedPlanSpecsDrivesInnerTypeEnumValues = []PlanSpecsDrivesInnerType{ - "HDD", - "SSD", - "NVMe", -} - -func (v *PlanSpecsDrivesInnerType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := PlanSpecsDrivesInnerType(value) - for _, existing := range AllowedPlanSpecsDrivesInnerTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid PlanSpecsDrivesInnerType", value) -} - -// NewPlanSpecsDrivesInnerTypeFromValue returns a pointer to a valid PlanSpecsDrivesInnerType -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewPlanSpecsDrivesInnerTypeFromValue(v string) (*PlanSpecsDrivesInnerType, error) { - ev := PlanSpecsDrivesInnerType(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for PlanSpecsDrivesInnerType: valid values are %v", v, AllowedPlanSpecsDrivesInnerTypeEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v PlanSpecsDrivesInnerType) IsValid() bool { - for _, existing := range AllowedPlanSpecsDrivesInnerTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to Plan_specs_drives_inner_type value -func (v PlanSpecsDrivesInnerType) Ptr() *PlanSpecsDrivesInnerType { - return &v -} - -type NullablePlanSpecsDrivesInnerType struct { - value *PlanSpecsDrivesInnerType - isSet bool -} - -func (v NullablePlanSpecsDrivesInnerType) Get() *PlanSpecsDrivesInnerType { - return v.value -} - -func (v *NullablePlanSpecsDrivesInnerType) Set(val *PlanSpecsDrivesInnerType) { - v.value = val - v.isSet = true -} - -func (v NullablePlanSpecsDrivesInnerType) IsSet() bool { - return v.isSet -} - -func (v *NullablePlanSpecsDrivesInnerType) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullablePlanSpecsDrivesInnerType(val *PlanSpecsDrivesInnerType) *NullablePlanSpecsDrivesInnerType { - return &NullablePlanSpecsDrivesInnerType{value: val, isSet: true} -} - -func (v NullablePlanSpecsDrivesInnerType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullablePlanSpecsDrivesInnerType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/metal/v1/model_plan_specs_nics_inner.go b/metal/v1/model_plan_specs_nics_inner.go index 2a59546d..f25f28bc 100644 --- a/metal/v1/model_plan_specs_nics_inner.go +++ b/metal/v1/model_plan_specs_nics_inner.go @@ -20,8 +20,8 @@ var _ MappedNullable = &PlanSpecsNicsInner{} // PlanSpecsNicsInner struct for PlanSpecsNicsInner type PlanSpecsNicsInner struct { - Count *int32 `json:"count,omitempty"` - Type *PlanSpecsNicsInnerType `json:"type,omitempty"` + Count *int32 `json:"count,omitempty"` + Type *string `json:"type,omitempty"` AdditionalProperties map[string]interface{} } @@ -77,9 +77,9 @@ func (o *PlanSpecsNicsInner) SetCount(v int32) { } // GetType returns the Type field value if set, zero value otherwise. -func (o *PlanSpecsNicsInner) GetType() PlanSpecsNicsInnerType { +func (o *PlanSpecsNicsInner) GetType() string { if o == nil || IsNil(o.Type) { - var ret PlanSpecsNicsInnerType + var ret string return ret } return *o.Type @@ -87,7 +87,7 @@ func (o *PlanSpecsNicsInner) GetType() PlanSpecsNicsInnerType { // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *PlanSpecsNicsInner) GetTypeOk() (*PlanSpecsNicsInnerType, bool) { +func (o *PlanSpecsNicsInner) GetTypeOk() (*string, bool) { if o == nil || IsNil(o.Type) { return nil, false } @@ -103,8 +103,8 @@ func (o *PlanSpecsNicsInner) HasType() bool { return false } -// SetType gets a reference to the given PlanSpecsNicsInnerType and assigns it to the Type field. -func (o *PlanSpecsNicsInner) SetType(v PlanSpecsNicsInnerType) { +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *PlanSpecsNicsInner) SetType(v string) { o.Type = &v } diff --git a/metal/v1/model_plan_specs_nics_inner_type.go b/metal/v1/model_plan_specs_nics_inner_type.go deleted file mode 100644 index d97d417b..00000000 --- a/metal/v1/model_plan_specs_nics_inner_type.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -Metal API - -# Introduction Equinix Metal provides a RESTful HTTP API which can be reached at . This document describes the API and how to use it. The API allows you to programmatically interact with all of your Equinix Metal resources, including devices, networks, addresses, organizations, projects, and your user account. Every feature of the Equinix Metal web interface is accessible through the API. The API docs are generated from the Equinix Metal OpenAPI specification and are officially hosted at . # Common Parameters The Equinix Metal API uses a few methods to minimize network traffic and improve throughput. These parameters are not used in all API calls, but are used often enough to warrant their own section. Look for these parameters in the documentation for the API calls that support them. ## Pagination Pagination is used to limit the number of results returned in a single request. The API will return a maximum of 100 results per page. To retrieve additional results, you can use the `page` and `per_page` query parameters. The `page` parameter is used to specify the page number. The first page is `1`. The `per_page` parameter is used to specify the number of results per page. The maximum number of results differs by resource type. ## Sorting Where offered, the API allows you to sort results by a specific field. To sort results use the `sort_by` query parameter with the root level field name as the value. The `sort_direction` parameter is used to specify the sort direction, either either `asc` (ascending) or `desc` (descending). ## Filtering Filtering is used to limit the results returned in a single request. The API supports filtering by certain fields in the response. To filter results, you can use the field as a query parameter. For example, to filter the IP list to only return public IPv4 addresses, you can filter by the `type` field, as in the following request: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/projects/id/ips?type=public_ipv4 ``` Only IP addresses with the `type` field set to `public_ipv4` will be returned. ## Searching Searching is used to find matching resources using multiple field comparissons. The API supports searching in resources that define this behavior. Currently the search parameter is only available on devices, ssh_keys, api_keys and memberships endpoints. To search resources you can use the `search` query parameter. ## Include and Exclude For resources that contain references to other resources, sucha as a Device that refers to the Project it resides in, the Equinix Metal API will returns `href` values (API links) to the associated resource. ```json { ... \"project\": { \"href\": \"/metal/v1/projects/f3f131c8-f302-49ef-8c44-9405022dc6dd\" } } ``` If you're going need the project details, you can avoid a second API request. Specify the contained `href` resources and collections that you'd like to have included in the response using the `include` query parameter. For example: ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=projects ``` The `include` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests where `href` resources are presented. To have multiple resources include, use a comma-separated list (e.g. `?include=emails,projects,memberships`). ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=emails,projects,memberships ``` You may also include nested associations up to three levels deep using dot notation (`?include=memberships.projects`): ```sh curl -H 'X-Auth-Token: my_authentication_token' \\ https://api.equinix.com/metal/v1/user?include=memberships.projects ``` To exclude resources, and optimize response delivery, use the `exclude` query parameter. The `exclude` parameter is generally accepted in `GET`, `POST`, `PUT`, and `PATCH` requests for fields with nested object responses. When excluded, these fields will be replaced with an object that contains only an `href` field. - -API version: 1.0.0 -Contact: support@equinixmetal.com -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1 - -import ( - "encoding/json" - "fmt" -) - -// PlanSpecsNicsInnerType the model 'PlanSpecsNicsInnerType' -type PlanSpecsNicsInnerType string - -// List of Plan_specs_nics_inner_type -const ( - PLANSPECSNICSINNERTYPE__1_GBPS PlanSpecsNicsInnerType = "1Gbps" - PLANSPECSNICSINNERTYPE__10_GBPS PlanSpecsNicsInnerType = "10Gbps" - PLANSPECSNICSINNERTYPE__25_GBPS PlanSpecsNicsInnerType = "25Gbps" -) - -// All allowed values of PlanSpecsNicsInnerType enum -var AllowedPlanSpecsNicsInnerTypeEnumValues = []PlanSpecsNicsInnerType{ - "1Gbps", - "10Gbps", - "25Gbps", -} - -func (v *PlanSpecsNicsInnerType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := PlanSpecsNicsInnerType(value) - for _, existing := range AllowedPlanSpecsNicsInnerTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid PlanSpecsNicsInnerType", value) -} - -// NewPlanSpecsNicsInnerTypeFromValue returns a pointer to a valid PlanSpecsNicsInnerType -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewPlanSpecsNicsInnerTypeFromValue(v string) (*PlanSpecsNicsInnerType, error) { - ev := PlanSpecsNicsInnerType(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for PlanSpecsNicsInnerType: valid values are %v", v, AllowedPlanSpecsNicsInnerTypeEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v PlanSpecsNicsInnerType) IsValid() bool { - for _, existing := range AllowedPlanSpecsNicsInnerTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to Plan_specs_nics_inner_type value -func (v PlanSpecsNicsInnerType) Ptr() *PlanSpecsNicsInnerType { - return &v -} - -type NullablePlanSpecsNicsInnerType struct { - value *PlanSpecsNicsInnerType - isSet bool -} - -func (v NullablePlanSpecsNicsInnerType) Get() *PlanSpecsNicsInnerType { - return v.value -} - -func (v *NullablePlanSpecsNicsInnerType) Set(val *PlanSpecsNicsInnerType) { - v.value = val - v.isSet = true -} - -func (v NullablePlanSpecsNicsInnerType) IsSet() bool { - return v.isSet -} - -func (v *NullablePlanSpecsNicsInnerType) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullablePlanSpecsNicsInnerType(val *PlanSpecsNicsInnerType) *NullablePlanSpecsNicsInnerType { - return &NullablePlanSpecsNicsInnerType{value: val, isSet: true} -} - -func (v NullablePlanSpecsNicsInnerType) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullablePlanSpecsNicsInnerType) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/patches/spec.fetched.json/20230920-plan-drive-type.patch b/patches/spec.fetched.json/20230920-plan-drive-type.patch deleted file mode 100644 index e2b2bf8c..00000000 --- a/patches/spec.fetched.json/20230920-plan-drive-type.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/spec/oas3.patched/components/schemas/Plan.yaml b/spec/oas3.patched/components/schemas/Plan.yaml -index 0b5f1d5..c8cdf6f 100644 ---- a/spec/oas3.patched/components/schemas/Plan.yaml -+++ b/spec/oas3.patched/components/schemas/Plan.yaml -@@ -97,7 +97,7 @@ properties: - enum: - - HDD - - SSD -- - NVME -+ - NVMe - size: - type: string - example: 3.84TB diff --git a/patches/spec.fetched.json/20230921-plan-drive-type.patch b/patches/spec.fetched.json/20230921-plan-drive-type.patch new file mode 100644 index 00000000..2753ba54 --- /dev/null +++ b/patches/spec.fetched.json/20230921-plan-drive-type.patch @@ -0,0 +1,26 @@ +diff --git a/spec/oas3.patched/components/schemas/Plan.yaml b/spec/oas3.patched/components/schemas/Plan.yaml +index 0b5f1d5..c9602d0 100644 +--- a/spec/oas3.patched/components/schemas/Plan.yaml ++++ b/spec/oas3.patched/components/schemas/Plan.yaml +@@ -94,10 +94,6 @@ properties: + type: integer + type: + type: string +- enum: +- - HDD +- - SSD +- - NVME + size: + type: string + example: 3.84TB +@@ -117,10 +113,6 @@ properties: + example: 2 + type: + type: string +- enum: +- - 1Gbps +- - 10Gbps +- - 25Gbps + features: + type: object + properties: diff --git a/spec/oas3.patched/components/schemas/Plan.yaml b/spec/oas3.patched/components/schemas/Plan.yaml index c8cdf6fa..c9602d00 100644 --- a/spec/oas3.patched/components/schemas/Plan.yaml +++ b/spec/oas3.patched/components/schemas/Plan.yaml @@ -94,10 +94,6 @@ properties: type: integer type: type: string - enum: - - HDD - - SSD - - NVMe size: type: string example: 3.84TB @@ -117,10 +113,6 @@ properties: example: 2 type: type: string - enum: - - 1Gbps - - 10Gbps - - 25Gbps features: type: object properties: