From 853703f252e963d12a056986fcf06a9be86b97bd Mon Sep 17 00:00:00 2001 From: tbandwala Date: Wed, 10 Aug 2022 11:14:53 +0530 Subject: [PATCH 1/2] Patch metal_gateway field in VirtualNetwork spec to metal_gateways of type array with items href --- ...-vlan-metalgateways-href-array-field.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 patches/spec.fetched.json/07-vlan-metalgateways-href-array-field.patch diff --git a/patches/spec.fetched.json/07-vlan-metalgateways-href-array-field.patch b/patches/spec.fetched.json/07-vlan-metalgateways-href-array-field.patch new file mode 100644 index 000000000..32991d68f --- /dev/null +++ b/patches/spec.fetched.json/07-vlan-metalgateways-href-array-field.patch @@ -0,0 +1,19 @@ +diff --git a/spec/oas3.patched.json b/spec/oas3.patched.json +index 0816bf5..fb8fdf0 100644 +--- a/spec/oas3.patched.json ++++ b/spec/oas3.patched.json +@@ -4549,8 +4549,12 @@ + }, + "type": "array" + }, +- "metal_gateway": { +- "$ref": "#/components/schemas/MetalGatewayLite" ++ "metal_gateways": { ++ "description": "A list of metal gateways currently associated to this Virtual Network.", ++ "items": { ++ "$ref": "#/components/schemas/Href" ++ }, ++ "type": "array" + }, + "metro": { + "$ref": "#/components/schemas/Href" From ad373c8958c3fbc0afd612d3338aa07807ee694f Mon Sep 17 00:00:00 2001 From: "equinix-labs@auto-commit-workflow" Date: Wed, 10 Aug 2022 05:46:32 +0000 Subject: [PATCH 2/2] Auto commit generated client changes - Wed Aug 10 05:46:32 UTC 2022 --- equinix-openapi-metal/api/openapi.yaml | 55 ++++++++----------- equinix-openapi-metal/docs/VirtualNetwork.md | 2 +- .../metal/v1/model/VirtualNetwork.java | 55 ++++++++++++------- .../metal/v1/model/VirtualNetworkTest.java | 7 +-- 4 files changed, 61 insertions(+), 58 deletions(-) diff --git a/equinix-openapi-metal/api/openapi.yaml b/equinix-openapi-metal/api/openapi.yaml index 497924790..e92d2de7a 100644 --- a/equinix-openapi-metal/api/openapi.yaml +++ b/equinix-openapi-metal/api/openapi.yaml @@ -15460,7 +15460,7 @@ components: example: gateway_address: gateway_address updated_at: 2000-01-23T04:56:07.000+00:00 - vlan: 0.8008281904610115 + vlan: 1.4658129805029452 created_at: 2000-01-23T04:56:07.000+00:00 href: href id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -19070,15 +19070,10 @@ components: type: object VirtualNetwork: example: - vxlan: 6 - metal_gateway: - gateway_address: gateway_address - updated_at: 2000-01-23T04:56:07.000+00:00 - vlan: 0.8008281904610115 - created_at: 2000-01-23T04:56:07.000+00:00 - href: href - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - state: ready + vxlan: 0 + metal_gateways: + - href: href + - href: href metro_code: metro_code instances: - href: href @@ -19115,8 +19110,12 @@ components: items: $ref: '#/components/schemas/Href' type: array - metal_gateway: - $ref: '#/components/schemas/MetalGatewayLite' + metal_gateways: + description: A list of metal gateways currently associated to this Virtual + Network. + items: + $ref: '#/components/schemas/Href' + type: array metro: $ref: '#/components/schemas/Href' metro_code: @@ -19160,15 +19159,10 @@ components: VirtualNetworkList: example: virtual_networks: - - vxlan: 6 - metal_gateway: - gateway_address: gateway_address - updated_at: 2000-01-23T04:56:07.000+00:00 - vlan: 0.8008281904610115 - created_at: 2000-01-23T04:56:07.000+00:00 - href: href - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - state: ready + - vxlan: 0 + metal_gateways: + - href: href + - href: href metro_code: metro_code instances: - href: href @@ -19183,15 +19177,10 @@ components: assigned_to_virtual_circuit: true assigned_to: href: href - - vxlan: 6 - metal_gateway: - gateway_address: gateway_address - updated_at: 2000-01-23T04:56:07.000+00:00 - vlan: 0.8008281904610115 - created_at: 2000-01-23T04:56:07.000+00:00 - href: href - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - state: ready + - vxlan: 0 + metal_gateways: + - href: href + - href: href metro_code: metro_code instances: - href: href @@ -19478,7 +19467,7 @@ components: metal_gateway: gateway_address: gateway_address updated_at: 2000-01-23T04:56:07.000+00:00 - vlan: 0.8008281904610115 + vlan: 1.4658129805029452 created_at: 2000-01-23T04:56:07.000+00:00 href: href id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -19673,7 +19662,7 @@ components: metal_gateway: gateway_address: gateway_address updated_at: 2000-01-23T04:56:07.000+00:00 - vlan: 0.8008281904610115 + vlan: 1.4658129805029452 created_at: 2000-01-23T04:56:07.000+00:00 href: href id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -19793,7 +19782,7 @@ components: metal_gateway: gateway_address: gateway_address updated_at: 2000-01-23T04:56:07.000+00:00 - vlan: 0.8008281904610115 + vlan: 1.4658129805029452 created_at: 2000-01-23T04:56:07.000+00:00 href: href id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 diff --git a/equinix-openapi-metal/docs/VirtualNetwork.md b/equinix-openapi-metal/docs/VirtualNetwork.md index 508be5868..f7b1964aa 100644 --- a/equinix-openapi-metal/docs/VirtualNetwork.md +++ b/equinix-openapi-metal/docs/VirtualNetwork.md @@ -14,7 +14,7 @@ |**href** | **String** | | [optional] | |**id** | **UUID** | | [optional] | |**instances** | [**List<Href>**](Href.md) | A list of instances with ports currently associated to this Virtual Network. | [optional] | -|**metalGateway** | [**MetalGatewayLite**](MetalGatewayLite.md) | | [optional] | +|**metalGateways** | [**List<Href>**](Href.md) | A list of metal gateways currently associated to this Virtual Network. | [optional] | |**metro** | [**Href**](Href.md) | | [optional] | |**metroCode** | **String** | The Metro code of the metro in which this Virtual Network is defined. | [optional] | |**vxlan** | **Integer** | | [optional] | diff --git a/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/VirtualNetwork.java b/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/VirtualNetwork.java index a235eaa24..b3f9cc0b3 100644 --- a/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/VirtualNetwork.java +++ b/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/VirtualNetwork.java @@ -16,7 +16,6 @@ import java.util.Objects; import java.util.Arrays; import com.equinix.openapi.metal.v1.model.Href; -import com.equinix.openapi.metal.v1.model.MetalGatewayLite; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -82,9 +81,9 @@ public class VirtualNetwork { @SerializedName(SERIALIZED_NAME_INSTANCES) private List instances = null; - public static final String SERIALIZED_NAME_METAL_GATEWAY = "metal_gateway"; - @SerializedName(SERIALIZED_NAME_METAL_GATEWAY) - private MetalGatewayLite metalGateway; + public static final String SERIALIZED_NAME_METAL_GATEWAYS = "metal_gateways"; + @SerializedName(SERIALIZED_NAME_METAL_GATEWAYS) + private List metalGateways = null; public static final String SERIALIZED_NAME_METRO = "metro"; @SerializedName(SERIALIZED_NAME_METRO) @@ -270,26 +269,34 @@ public void setInstances(List instances) { } - public VirtualNetwork metalGateway(MetalGatewayLite metalGateway) { + public VirtualNetwork metalGateways(List metalGateways) { - this.metalGateway = metalGateway; + this.metalGateways = metalGateways; + return this; + } + + public VirtualNetwork addMetalGatewaysItem(Href metalGatewaysItem) { + if (this.metalGateways == null) { + this.metalGateways = new ArrayList<>(); + } + this.metalGateways.add(metalGatewaysItem); return this; } /** - * Get metalGateway - * @return metalGateway + * A list of metal gateways currently associated to this Virtual Network. + * @return metalGateways **/ @javax.annotation.Nullable - @ApiModelProperty(value = "") + @ApiModelProperty(value = "A list of metal gateways currently associated to this Virtual Network.") - public MetalGatewayLite getMetalGateway() { - return metalGateway; + public List getMetalGateways() { + return metalGateways; } - public void setMetalGateway(MetalGatewayLite metalGateway) { - this.metalGateway = metalGateway; + public void setMetalGateways(List metalGateways) { + this.metalGateways = metalGateways; } @@ -414,7 +421,7 @@ public boolean equals(Object o) { Objects.equals(this.href, virtualNetwork.href) && Objects.equals(this.id, virtualNetwork.id) && Objects.equals(this.instances, virtualNetwork.instances) && - Objects.equals(this.metalGateway, virtualNetwork.metalGateway) && + Objects.equals(this.metalGateways, virtualNetwork.metalGateways) && Objects.equals(this.metro, virtualNetwork.metro) && Objects.equals(this.metroCode, virtualNetwork.metroCode) && Objects.equals(this.vxlan, virtualNetwork.vxlan)&& @@ -423,7 +430,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(assignedTo, assignedToVirtualCircuit, description, facility, href, id, instances, metalGateway, metro, metroCode, vxlan, additionalProperties); + return Objects.hash(assignedTo, assignedToVirtualCircuit, description, facility, href, id, instances, metalGateways, metro, metroCode, vxlan, additionalProperties); } @Override @@ -437,7 +444,7 @@ public String toString() { sb.append(" href: ").append(toIndentedString(href)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" instances: ").append(toIndentedString(instances)).append("\n"); - sb.append(" metalGateway: ").append(toIndentedString(metalGateway)).append("\n"); + sb.append(" metalGateways: ").append(toIndentedString(metalGateways)).append("\n"); sb.append(" metro: ").append(toIndentedString(metro)).append("\n"); sb.append(" metroCode: ").append(toIndentedString(metroCode)).append("\n"); sb.append(" vxlan: ").append(toIndentedString(vxlan)).append("\n"); @@ -471,7 +478,7 @@ private String toIndentedString(Object o) { openapiFields.add("href"); openapiFields.add("id"); openapiFields.add("instances"); - openapiFields.add("metal_gateway"); + openapiFields.add("metal_gateways"); openapiFields.add("metro"); openapiFields.add("metro_code"); openapiFields.add("vxlan"); @@ -523,9 +530,17 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { Href.validateJsonObject(jsonArrayinstances.get(i).getAsJsonObject()); }; } - // validate the optional field `metal_gateway` - if (jsonObj.get("metal_gateway") != null && !jsonObj.get("metal_gateway").isJsonNull()) { - MetalGatewayLite.validateJsonObject(jsonObj.getAsJsonObject("metal_gateway")); + JsonArray jsonArraymetalGateways = jsonObj.getAsJsonArray("metal_gateways"); + if (jsonArraymetalGateways != null) { + // ensure the json data is an array + if (!jsonObj.get("metal_gateways").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `metal_gateways` to be an array in the JSON string but got `%s`", jsonObj.get("metal_gateways").toString())); + } + + // validate the optional field `metal_gateways` (array) + for (int i = 0; i < jsonArraymetalGateways.size(); i++) { + Href.validateJsonObject(jsonArraymetalGateways.get(i).getAsJsonObject()); + }; } // validate the optional field `metro` if (jsonObj.get("metro") != null && !jsonObj.get("metro").isJsonNull()) { diff --git a/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/VirtualNetworkTest.java b/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/VirtualNetworkTest.java index 8f6bba8a5..8b2d60332 100644 --- a/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/VirtualNetworkTest.java +++ b/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/VirtualNetworkTest.java @@ -14,7 +14,6 @@ package com.equinix.openapi.metal.v1.model; import com.equinix.openapi.metal.v1.model.Href; -import com.equinix.openapi.metal.v1.model.MetalGatewayLite; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -101,11 +100,11 @@ public void instancesTest() { } /** - * Test the property 'metalGateway' + * Test the property 'metalGateways' */ @Test - public void metalGatewayTest() { - // TODO: test metalGateway + public void metalGatewaysTest() { + // TODO: test metalGateways } /**