From bf5e9615dc015369a2d9208f2d6cfeef5bfa1915 Mon Sep 17 00:00:00 2001 From: Vasubabu <3358152+vasubabu@users.noreply.github.com> Date: Tue, 26 Sep 2023 22:39:52 +0530 Subject: [PATCH] fix: Added IPAssignments type --- API.md | 1 + api/openapi.yaml | 15 +++ docs/FindIPAddressById200Response.md | 42 +++---- docs/IPAssignment.md | 26 +++++ docs/IPAssignmentType.md | 11 ++ metal/v1/.openapi-generator/FILES | 2 + metal/v1/model_ip_assignment.go | 39 ++++++- metal/v1/model_ip_assignment_type.go | 109 ++++++++++++++++++ ...0926-added-pro-type-in-ipassignments.patch | 13 +++ .../components/schemas/IPAssignment.yaml | 4 + 10 files changed, 240 insertions(+), 22 deletions(-) create mode 100644 docs/IPAssignmentType.md create mode 100644 metal/v1/model_ip_assignment_type.go create mode 100644 patches/spec.fetched.json/20230926-added-pro-type-in-ipassignments.patch diff --git a/API.md b/API.md index a8ef4833..abca432e 100644 --- a/API.md +++ b/API.md @@ -495,6 +495,7 @@ Class | Method | HTTP request | Description - [IPAssignmentList](docs/IPAssignmentList.md) - [IPAssignmentMetro](docs/IPAssignmentMetro.md) - [IPAssignmentState](docs/IPAssignmentState.md) + - [IPAssignmentType](docs/IPAssignmentType.md) - [IPAssignmentUpdateInput](docs/IPAssignmentUpdateInput.md) - [IPAvailabilitiesList](docs/IPAvailabilitiesList.md) - [IPReservation](docs/IPReservation.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index 1ab4a387..8268a9d0 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -15313,6 +15313,7 @@ components: href: href network: network created_at: 2000-01-23T04:56:07.000+00:00 + type: null enabled: true manageable: true network: network @@ -15337,6 +15338,7 @@ components: href: href network: network created_at: 2000-01-23T04:56:07.000+00:00 + type: null enabled: true manageable: true network: network @@ -16298,6 +16300,7 @@ components: href: href network: network created_at: 2000-01-23T04:56:07.000+00:00 + type: null enabled: true manageable: true network: network @@ -16322,6 +16325,7 @@ components: href: href network: network created_at: 2000-01-23T04:56:07.000+00:00 + type: null enabled: true manageable: true network: network @@ -16900,6 +16904,7 @@ components: href: href network: network created_at: 2000-01-23T04:56:07.000+00:00 + type: null enabled: true manageable: true network: network @@ -16924,6 +16929,7 @@ components: href: href network: network created_at: 2000-01-23T04:56:07.000+00:00 + type: null enabled: true manageable: true network: network @@ -18857,6 +18863,7 @@ components: href: href network: network created_at: 2000-01-23T04:56:07.000+00:00 + type: null enabled: true manageable: true network: network @@ -18920,6 +18927,8 @@ components: The IP address within the Metal Gateway to which requests to the Elastic IP are forwarded. format: ipv4 type: string + type: + $ref: '#/components/schemas/IPAssignment_type' type: object IPAssignmentInput: example: @@ -18943,6 +18952,7 @@ components: href: href network: network created_at: 2000-01-23T04:56:07.000+00:00 + type: null enabled: true manageable: true network: network @@ -18967,6 +18977,7 @@ components: href: href network: network created_at: 2000-01-23T04:56:07.000+00:00 + type: null enabled: true manageable: true network: network @@ -30517,6 +30528,10 @@ components: - active - deleting type: string + IPAssignment_type: + enum: + - IPAssignment + type: string IPReservation_facility: allOf: - $ref: '#/components/schemas/Facility' diff --git a/docs/FindIPAddressById200Response.md b/docs/FindIPAddressById200Response.md index 97f2174d..94b9c3f9 100644 --- a/docs/FindIPAddressById200Response.md +++ b/docs/FindIPAddressById200Response.md @@ -23,6 +23,7 @@ Name | Type | Description | Notes **Public** | Pointer to **bool** | | [optional] **State** | Pointer to **string** | | [optional] **NextHop** | Pointer to **string** | Only set when this is a Metal Gateway Elastic IP Assignment. The IP address within the Metal Gateway to which requests to the Elastic IP are forwarded. | [optional] +**Type** | [**VrfIpReservationType**](VrfIpReservationType.md) | | **Addon** | Pointer to **bool** | | [optional] **Assignments** | Pointer to [**[]IPAssignment**](IPAssignment.md) | | [optional] **Available** | Pointer to **string** | | [optional] @@ -35,7 +36,6 @@ Name | Type | Description | Notes **ProjectLite** | Pointer to [**Project**](Project.md) | | [optional] **RequestedBy** | Pointer to [**Href**](Href.md) | | [optional] **Tags** | Pointer to **[]string** | | [optional] -**Type** | [**VrfIpReservationType**](VrfIpReservationType.md) | | **CreatedBy** | Pointer to [**Href**](Href.md) | | [optional] **Vrf** | [**Vrf**](Vrf.md) | | @@ -533,6 +533,26 @@ SetNextHop sets NextHop field to given value. HasNextHop returns a boolean if a field has been set. +### GetType + +`func (o *FindIPAddressById200Response) GetType() VrfIpReservationType` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *FindIPAddressById200Response) GetTypeOk() (*VrfIpReservationType, 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 *FindIPAddressById200Response) SetType(v VrfIpReservationType)` + +SetType sets Type field to given value. + + ### GetAddon `func (o *FindIPAddressById200Response) GetAddon() bool` @@ -833,26 +853,6 @@ SetTags sets Tags field to given value. HasTags returns a boolean if a field has been set. -### GetType - -`func (o *FindIPAddressById200Response) GetType() VrfIpReservationType` - -GetType returns the Type field if non-nil, zero value otherwise. - -### GetTypeOk - -`func (o *FindIPAddressById200Response) GetTypeOk() (*VrfIpReservationType, 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 *FindIPAddressById200Response) SetType(v VrfIpReservationType)` - -SetType sets Type field to given value. - - ### GetCreatedBy `func (o *FindIPAddressById200Response) GetCreatedBy() Href` diff --git a/docs/IPAssignment.md b/docs/IPAssignment.md index cf683a88..d0d49768 100644 --- a/docs/IPAssignment.md +++ b/docs/IPAssignment.md @@ -23,6 +23,7 @@ Name | Type | Description | Notes **Public** | Pointer to **bool** | | [optional] **State** | Pointer to [**IPAssignmentState**](IPAssignmentState.md) | | [optional] **NextHop** | Pointer to **string** | Only set when this is a Metal Gateway Elastic IP Assignment. The IP address within the Metal Gateway to which requests to the Elastic IP are forwarded. | [optional] +**Type** | Pointer to [**IPAssignmentType**](IPAssignmentType.md) | | [optional] ## Methods @@ -518,6 +519,31 @@ SetNextHop sets NextHop field to given value. HasNextHop returns a boolean if a field has been set. +### GetType + +`func (o *IPAssignment) GetType() IPAssignmentType` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *IPAssignment) GetTypeOk() (*IPAssignmentType, 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 *IPAssignment) SetType(v IPAssignmentType)` + +SetType sets Type field to given value. + +### HasType + +`func (o *IPAssignment) HasType() bool` + +HasType returns a boolean if a field has been set. + [[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/IPAssignmentType.md b/docs/IPAssignmentType.md new file mode 100644 index 00000000..273b2b64 --- /dev/null +++ b/docs/IPAssignmentType.md @@ -0,0 +1,11 @@ +# IPAssignmentType + +## Enum + + +* `IP_ASSIGNMENT` (value: `"IPAssignment"`) + + +[[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 878e938a..7a69e690 100644 --- a/metal/v1/.openapi-generator/FILES +++ b/metal/v1/.openapi-generator/FILES @@ -168,6 +168,7 @@ docs/IPAssignmentInput.md docs/IPAssignmentList.md docs/IPAssignmentMetro.md docs/IPAssignmentState.md +docs/IPAssignmentType.md docs/IPAssignmentUpdateInput.md docs/IPAvailabilitiesList.md docs/IPReservation.md @@ -513,6 +514,7 @@ model_ip_assignment_input.go model_ip_assignment_list.go model_ip_assignment_metro.go model_ip_assignment_state.go +model_ip_assignment_type.go model_ip_assignment_update_input.go model_ip_availabilities_list.go model_ip_reservation.go diff --git a/metal/v1/model_ip_assignment.go b/metal/v1/model_ip_assignment.go index 4d7ef371..9deeea47 100644 --- a/metal/v1/model_ip_assignment.go +++ b/metal/v1/model_ip_assignment.go @@ -40,7 +40,8 @@ type IPAssignment struct { Public *bool `json:"public,omitempty"` State *IPAssignmentState `json:"state,omitempty"` // Only set when this is a Metal Gateway Elastic IP Assignment. The IP address within the Metal Gateway to which requests to the Elastic IP are forwarded. - NextHop *string `json:"next_hop,omitempty"` + NextHop *string `json:"next_hop,omitempty"` + Type *IPAssignmentType `json:"type,omitempty"` AdditionalProperties map[string]interface{} } @@ -671,6 +672,38 @@ func (o *IPAssignment) SetNextHop(v string) { o.NextHop = &v } +// GetType returns the Type field value if set, zero value otherwise. +func (o *IPAssignment) GetType() IPAssignmentType { + if o == nil || IsNil(o.Type) { + var ret IPAssignmentType + return ret + } + return *o.Type +} + +// 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 *IPAssignment) GetTypeOk() (*IPAssignmentType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *IPAssignment) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given IPAssignmentType and assigns it to the Type field. +func (o *IPAssignment) SetType(v IPAssignmentType) { + o.Type = &v +} + func (o IPAssignment) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -738,6 +771,9 @@ func (o IPAssignment) ToMap() (map[string]interface{}, error) { if !IsNil(o.NextHop) { toSerialize["next_hop"] = o.NextHop } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -779,6 +815,7 @@ func (o *IPAssignment) UnmarshalJSON(bytes []byte) (err error) { delete(additionalProperties, "public") delete(additionalProperties, "state") delete(additionalProperties, "next_hop") + delete(additionalProperties, "type") o.AdditionalProperties = additionalProperties } diff --git a/metal/v1/model_ip_assignment_type.go b/metal/v1/model_ip_assignment_type.go new file mode 100644 index 00000000..86002e21 --- /dev/null +++ b/metal/v1/model_ip_assignment_type.go @@ -0,0 +1,109 @@ +/* +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" +) + +// IPAssignmentType the model 'IPAssignmentType' +type IPAssignmentType string + +// List of IPAssignment_type +const ( + IPASSIGNMENTTYPE_IP_ASSIGNMENT IPAssignmentType = "IPAssignment" +) + +// All allowed values of IPAssignmentType enum +var AllowedIPAssignmentTypeEnumValues = []IPAssignmentType{ + "IPAssignment", +} + +func (v *IPAssignmentType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := IPAssignmentType(value) + for _, existing := range AllowedIPAssignmentTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid IPAssignmentType", value) +} + +// NewIPAssignmentTypeFromValue returns a pointer to a valid IPAssignmentType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewIPAssignmentTypeFromValue(v string) (*IPAssignmentType, error) { + ev := IPAssignmentType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for IPAssignmentType: valid values are %v", v, AllowedIPAssignmentTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v IPAssignmentType) IsValid() bool { + for _, existing := range AllowedIPAssignmentTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IPAssignment_type value +func (v IPAssignmentType) Ptr() *IPAssignmentType { + return &v +} + +type NullableIPAssignmentType struct { + value *IPAssignmentType + isSet bool +} + +func (v NullableIPAssignmentType) Get() *IPAssignmentType { + return v.value +} + +func (v *NullableIPAssignmentType) Set(val *IPAssignmentType) { + v.value = val + v.isSet = true +} + +func (v NullableIPAssignmentType) IsSet() bool { + return v.isSet +} + +func (v *NullableIPAssignmentType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIPAssignmentType(val *IPAssignmentType) *NullableIPAssignmentType { + return &NullableIPAssignmentType{value: val, isSet: true} +} + +func (v NullableIPAssignmentType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIPAssignmentType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/patches/spec.fetched.json/20230926-added-pro-type-in-ipassignments.patch b/patches/spec.fetched.json/20230926-added-pro-type-in-ipassignments.patch new file mode 100644 index 00000000..68c107a6 --- /dev/null +++ b/patches/spec.fetched.json/20230926-added-pro-type-in-ipassignments.patch @@ -0,0 +1,13 @@ +diff --git a/spec/oas3.patched/components/schemas/IPAssignment.yaml b/spec/oas3.patched/components/schemas/IPAssignment.yaml +index efce269..46f9abc 100644 +--- a/spec/oas3.patched/components/schemas/IPAssignment.yaml ++++ b/spec/oas3.patched/components/schemas/IPAssignment.yaml +@@ -54,4 +54,8 @@ properties: + Only set when this is a Metal Gateway Elastic IP Assignment. + + The IP address within the Metal Gateway to which requests to the Elastic IP are forwarded. ++ type: ++ type: string ++ enum: ++ - IPAssignment + type: object diff --git a/spec/oas3.patched/components/schemas/IPAssignment.yaml b/spec/oas3.patched/components/schemas/IPAssignment.yaml index efce269a..46f9abc3 100644 --- a/spec/oas3.patched/components/schemas/IPAssignment.yaml +++ b/spec/oas3.patched/components/schemas/IPAssignment.yaml @@ -54,4 +54,8 @@ properties: Only set when this is a Metal Gateway Elastic IP Assignment. The IP address within the Metal Gateway to which requests to the Elastic IP are forwarded. + type: + type: string + enum: + - IPAssignment type: object