From 922cee4c5ad86045b291fa3cf25a20f20e7a4542 Mon Sep 17 00:00:00 2001 From: Vamshik Shetty Date: Tue, 14 Feb 2023 13:56:30 +0530 Subject: [PATCH 1/2] add patch 09 & 10 --- ...set-additional-prop-to-false-in-href.patch | 10 +++ ...circuit-attr-in-interconnection-port.patch | 84 +++++++++++++++++++ .../public/components/schemas/Href.yaml | 1 + .../schemas/InterconnectionPort.yaml | 39 +-------- .../schemas/InterconnectionPortCore.yaml | 34 ++++++++ 5 files changed, 132 insertions(+), 36 deletions(-) create mode 100644 patches/spec.fetched.json/09-set-additional-prop-to-false-in-href.patch create mode 100644 patches/spec.fetched.json/10-fix-virtual-circuit-attr-in-interconnection-port.patch create mode 100644 spec/oas3.patched/openapi/public/components/schemas/InterconnectionPortCore.yaml diff --git a/patches/spec.fetched.json/09-set-additional-prop-to-false-in-href.patch b/patches/spec.fetched.json/09-set-additional-prop-to-false-in-href.patch new file mode 100644 index 000000000..51d86953a --- /dev/null +++ b/patches/spec.fetched.json/09-set-additional-prop-to-false-in-href.patch @@ -0,0 +1,10 @@ +diff --git a/spec/oas3.patched/openapi/public/components/schemas/Href.yaml b/spec/oas3.patched/openapi/public/components/schemas/Href.yaml +index bbe7e22..7cd92bb 100644 +--- a/spec/oas3.patched/openapi/public/components/schemas/Href.yaml ++++ b/spec/oas3.patched/openapi/public/components/schemas/Href.yaml +@@ -4,3 +4,4 @@ properties: + required: + - href + type: object ++additionalProperties: false +\ No newline at end of file diff --git a/patches/spec.fetched.json/10-fix-virtual-circuit-attr-in-interconnection-port.patch b/patches/spec.fetched.json/10-fix-virtual-circuit-attr-in-interconnection-port.patch new file mode 100644 index 000000000..274095d99 --- /dev/null +++ b/patches/spec.fetched.json/10-fix-virtual-circuit-attr-in-interconnection-port.patch @@ -0,0 +1,84 @@ +diff --git a/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPort.yaml b/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPort.yaml +index a34b99a..a77e6f8 100644 +--- a/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPort.yaml ++++ b/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPort.yaml +@@ -1,36 +1,3 @@ +-properties: +- id: +- format: uuid +- type: string +- organization: +- $ref: './Href.yaml' +- role: +- description: Either 'primary' or 'secondary'. +- type: string +- enum: +- - primary +- - secondary +- status: +- type: string +- description: For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, +- this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the +- service token associated is expired. +- enum: +- - requested +- - active +- - deleting +- - expired +- switch_id: +- description: A switch 'short ID' +- type: string +- virtual_circuits: +- $ref: './VirtualCircuitList.yaml' +- name: +- type: string +- speed: +- type: integer +- link_status: +- type: string +- href: +- type: string +-type: object ++allOf: ++ - $ref: './VirtualCircuitList.yaml' ++ - $ref: './InterconnectionPortCore.yaml' +diff --git a/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPortCore.yaml b/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPortCore.yaml +new file mode 100644 +index 0000000..e2407a6 +--- /dev/null ++++ b/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPortCore.yaml +@@ -0,0 +1,34 @@ ++properties: ++ id: ++ format: uuid ++ type: string ++ organization: ++ $ref: './Href.yaml' ++ role: ++ description: Either 'primary' or 'secondary'. ++ type: string ++ enum: ++ - primary ++ - secondary ++ status: ++ type: string ++ description: For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, ++ this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the ++ service token associated is expired. ++ enum: ++ - requested ++ - active ++ - deleting ++ - expired ++ switch_id: ++ description: A switch 'short ID' ++ type: string ++ name: ++ type: string ++ speed: ++ type: integer ++ link_status: ++ type: string ++ href: ++ type: string ++type: object diff --git a/spec/oas3.patched/openapi/public/components/schemas/Href.yaml b/spec/oas3.patched/openapi/public/components/schemas/Href.yaml index bbe7e2205..7cd92bb7e 100644 --- a/spec/oas3.patched/openapi/public/components/schemas/Href.yaml +++ b/spec/oas3.patched/openapi/public/components/schemas/Href.yaml @@ -4,3 +4,4 @@ properties: required: - href type: object +additionalProperties: false \ No newline at end of file diff --git a/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPort.yaml b/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPort.yaml index a34b99ac3..a77e6f8bd 100644 --- a/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPort.yaml +++ b/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPort.yaml @@ -1,36 +1,3 @@ -properties: - id: - format: uuid - type: string - organization: - $ref: './Href.yaml' - role: - description: Either 'primary' or 'secondary'. - type: string - enum: - - primary - - secondary - status: - type: string - description: For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, - this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the - service token associated is expired. - enum: - - requested - - active - - deleting - - expired - switch_id: - description: A switch 'short ID' - type: string - virtual_circuits: - $ref: './VirtualCircuitList.yaml' - name: - type: string - speed: - type: integer - link_status: - type: string - href: - type: string -type: object +allOf: + - $ref: './VirtualCircuitList.yaml' + - $ref: './InterconnectionPortCore.yaml' diff --git a/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPortCore.yaml b/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPortCore.yaml new file mode 100644 index 000000000..e2407a640 --- /dev/null +++ b/spec/oas3.patched/openapi/public/components/schemas/InterconnectionPortCore.yaml @@ -0,0 +1,34 @@ +properties: + id: + format: uuid + type: string + organization: + $ref: './Href.yaml' + role: + description: Either 'primary' or 'secondary'. + type: string + enum: + - primary + - secondary + status: + type: string + description: For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, + this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the + service token associated is expired. + enum: + - requested + - active + - deleting + - expired + switch_id: + description: A switch 'short ID' + type: string + name: + type: string + speed: + type: integer + link_status: + type: string + href: + type: string +type: object From 5e076726744294ac7e56aa61ada9255952c12786 Mon Sep 17 00:00:00 2001 From: "equinix-labs@auto-commit-workflow" Date: Tue, 14 Feb 2023 08:27:53 +0000 Subject: [PATCH 2/2] Auto commit generated client changes - Tue Feb 14 08:27:53 UTC 2023 --- .../.openapi-generator/FILES | 3 + equinix-openapi-metal/README.md | 1 + equinix-openapi-metal/api/openapi.yaml | 216 ++---- .../docs/InterconnectionPort.md | 2 +- .../docs/InterconnectionPortCore.md | 41 ++ .../main/java/com/equinix/openapi/JSON.java | 1 + .../equinix/openapi/metal/v1/model/Href.java | 97 +-- .../metal/v1/model/InterconnectionPort.java | 92 ++- .../v1/model/InterconnectionPortCore.java | 634 ++++++++++++++++++ .../v1/model/InterconnectionPortCoreTest.java | 114 ++++ .../v1/model/InterconnectionPortTest.java | 20 +- 11 files changed, 923 insertions(+), 298 deletions(-) create mode 100644 equinix-openapi-metal/docs/InterconnectionPortCore.md create mode 100644 equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCore.java create mode 100644 equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCoreTest.java diff --git a/equinix-openapi-metal/.openapi-generator/FILES b/equinix-openapi-metal/.openapi-generator/FILES index 9680d29ee..fec4e0227 100644 --- a/equinix-openapi-metal/.openapi-generator/FILES +++ b/equinix-openapi-metal/.openapi-generator/FILES @@ -107,6 +107,7 @@ docs/InterconnectionCreateInput.md docs/InterconnectionList.md docs/InterconnectionMetro.md docs/InterconnectionPort.md +docs/InterconnectionPortCore.md docs/InterconnectionPortList.md docs/InterconnectionUpdateInput.md docs/InterconnectionsApi.md @@ -426,6 +427,7 @@ src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionCreateInput.java src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionList.java src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionMetro.java src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPort.java +src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCore.java src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPortList.java src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionUpdateInput.java src/main/java/com/equinix/openapi/metal/v1/model/Invitation.java @@ -689,6 +691,7 @@ src/test/java/com/equinix/openapi/metal/v1/model/InstancesBatchCreateInputTest.j src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionCreateInputTest.java src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionListTest.java src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionMetroTest.java +src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCoreTest.java src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortListTest.java src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortTest.java src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionTest.java diff --git a/equinix-openapi-metal/README.md b/equinix-openapi-metal/README.md index 50e7bf7e6..567135e98 100644 --- a/equinix-openapi-metal/README.md +++ b/equinix-openapi-metal/README.md @@ -503,6 +503,7 @@ Class | Method | HTTP request | Description - [InterconnectionList](docs/InterconnectionList.md) - [InterconnectionMetro](docs/InterconnectionMetro.md) - [InterconnectionPort](docs/InterconnectionPort.md) + - [InterconnectionPortCore](docs/InterconnectionPortCore.md) - [InterconnectionPortList](docs/InterconnectionPortList.md) - [InterconnectionUpdateInput](docs/InterconnectionUpdateInput.md) - [Invitation](docs/Invitation.md) diff --git a/equinix-openapi-metal/api/openapi.yaml b/equinix-openapi-metal/api/openapi.yaml index dfd7db454..c5f201cd2 100644 --- a/equinix-openapi-metal/api/openapi.yaml +++ b/equinix-openapi-metal/api/openapi.yaml @@ -15837,6 +15837,7 @@ components: $ref: '#/components/schemas/Meta' type: object Href: + additionalProperties: false example: href: href properties: @@ -16117,34 +16118,8 @@ components: description: description created_at: 2000-01-23T04:56:07.000+00:00 ports: - - role: primary - virtual_circuits: - virtual_circuits: - - null - - null - organization: - href: href - name: name - link_status: link_status - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - switch_id: switch_id - href: href - speed: 0 - status: requested - - role: primary - virtual_circuits: - virtual_circuits: - - null - - null - organization: - href: href - name: name - link_status: link_status - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - switch_id: switch_id - href: href - speed: 0 - status: requested + - null + - null type: shared speed: 10000000000 contact_email: contact_email @@ -16394,34 +16369,8 @@ components: - description: description created_at: 2000-01-23T04:56:07.000+00:00 ports: - - role: primary - virtual_circuits: - virtual_circuits: - - null - - null - organization: - href: href - name: name - link_status: link_status - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - switch_id: switch_id - href: href - speed: 0 - status: requested - - role: primary - virtual_circuits: - virtual_circuits: - - null - - null - organization: - href: href - name: name - link_status: link_status - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - switch_id: switch_id - href: href - speed: 0 - status: requested + - null + - null type: shared speed: 10000000000 contact_email: contact_email @@ -16458,34 +16407,8 @@ components: - description: description created_at: 2000-01-23T04:56:07.000+00:00 ports: - - role: primary - virtual_circuits: - virtual_circuits: - - null - - null - organization: - href: href - name: name - link_status: link_status - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - switch_id: switch_id - href: href - speed: 0 - status: requested - - role: primary - virtual_circuits: - virtual_circuits: - - null - - null - organization: - href: href - name: name - link_status: link_status - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - switch_id: switch_id - href: href - speed: 0 - status: requested + - null + - null type: shared speed: 10000000000 contact_email: contact_email @@ -16526,91 +16449,14 @@ components: type: array type: object InterconnectionPort: - example: - role: primary - virtual_circuits: - virtual_circuits: - - null - - null - organization: - href: href - name: name - link_status: link_status - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - switch_id: switch_id - href: href - speed: 0 - status: requested - properties: - id: - format: uuid - type: string - organization: - $ref: '#/components/schemas/Href' - role: - description: Either 'primary' or 'secondary'. - enum: - - primary - - secondary - type: string - status: - description: "For both Fabric VCs and Dedicated Ports, this will be 'requested'\ - \ on creation and 'deleting' on deletion. Once the Fabric VC has found\ - \ its corresponding Fabric connection, this will turn to 'active'. For\ - \ Dedicated Ports, once the dedicated port is associated, this will also\ - \ turn to 'active'. For Fabric VCs, this can turn into an 'expired' state\ - \ if the service token associated is expired." - enum: - - requested - - active - - deleting - - expired - type: string - switch_id: - description: A switch 'short ID' - type: string - virtual_circuits: - $ref: '#/components/schemas/VirtualCircuitList' - name: - type: string - speed: - type: integer - link_status: - type: string - href: - type: string - type: object + allOf: + - $ref: '#/components/schemas/VirtualCircuitList' + - $ref: '#/components/schemas/InterconnectionPortCore' InterconnectionPortList: example: ports: - - role: primary - virtual_circuits: - virtual_circuits: - - null - - null - organization: - href: href - name: name - link_status: link_status - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - switch_id: switch_id - href: href - speed: 0 - status: requested - - role: primary - virtual_circuits: - virtual_circuits: - - null - - null - organization: - href: href - name: name - link_status: link_status - id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - switch_id: switch_id - href: href - speed: 0 - status: requested + - null + - null properties: ports: items: @@ -22735,6 +22581,44 @@ components: type: string type: array type: object + InterconnectionPortCore: + properties: + id: + format: uuid + type: string + organization: + $ref: '#/components/schemas/Href' + role: + description: Either 'primary' or 'secondary'. + enum: + - primary + - secondary + type: string + status: + description: "For both Fabric VCs and Dedicated Ports, this will be 'requested'\ + \ on creation and 'deleting' on deletion. Once the Fabric VC has found\ + \ its corresponding Fabric connection, this will turn to 'active'. For\ + \ Dedicated Ports, once the dedicated port is associated, this will also\ + \ turn to 'active'. For Fabric VCs, this can turn into an 'expired' state\ + \ if the service token associated is expired." + enum: + - requested + - active + - deleting + - expired + type: string + switch_id: + description: A switch 'short ID' + type: string + name: + type: string + speed: + type: integer + link_status: + type: string + href: + type: string + type: object IPReservationOrHref: anyOf: - $ref: '#/components/schemas/IPReservation' diff --git a/equinix-openapi-metal/docs/InterconnectionPort.md b/equinix-openapi-metal/docs/InterconnectionPort.md index bbcef32f6..e8f4332a9 100644 --- a/equinix-openapi-metal/docs/InterconnectionPort.md +++ b/equinix-openapi-metal/docs/InterconnectionPort.md @@ -7,12 +7,12 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| +|**virtualCircuits** | [**List<VirtualCircuitListVirtualCircuitsInner>**](VirtualCircuitListVirtualCircuitsInner.md) | | [optional] | |**id** | **UUID** | | [optional] | |**organization** | [**Href**](Href.md) | | [optional] | |**role** | [**RoleEnum**](#RoleEnum) | Either 'primary' or 'secondary'. | [optional] | |**status** | [**StatusEnum**](#StatusEnum) | For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the service token associated is expired. | [optional] | |**switchId** | **String** | A switch 'short ID' | [optional] | -|**virtualCircuits** | [**VirtualCircuitList**](VirtualCircuitList.md) | | [optional] | |**name** | **String** | | [optional] | |**speed** | **Integer** | | [optional] | |**linkStatus** | **String** | | [optional] | diff --git a/equinix-openapi-metal/docs/InterconnectionPortCore.md b/equinix-openapi-metal/docs/InterconnectionPortCore.md new file mode 100644 index 000000000..ad7cf2abd --- /dev/null +++ b/equinix-openapi-metal/docs/InterconnectionPortCore.md @@ -0,0 +1,41 @@ + + +# InterconnectionPortCore + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**organization** | [**Href**](Href.md) | | [optional] | +|**role** | [**RoleEnum**](#RoleEnum) | Either 'primary' or 'secondary'. | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the service token associated is expired. | [optional] | +|**switchId** | **String** | A switch 'short ID' | [optional] | +|**name** | **String** | | [optional] | +|**speed** | **Integer** | | [optional] | +|**linkStatus** | **String** | | [optional] | +|**href** | **String** | | [optional] | + + + +## Enum: RoleEnum + +| Name | Value | +|---- | -----| +| PRIMARY | "primary" | +| SECONDARY | "secondary" | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| REQUESTED | "requested" | +| ACTIVE | "active" | +| DELETING | "deleting" | +| EXPIRED | "expired" | + + + diff --git a/equinix-openapi-metal/src/main/java/com/equinix/openapi/JSON.java b/equinix-openapi-metal/src/main/java/com/equinix/openapi/JSON.java index 81f05e0b3..65b9a967a 100644 --- a/equinix-openapi-metal/src/main/java/com/equinix/openapi/JSON.java +++ b/equinix-openapi-metal/src/main/java/com/equinix/openapi/JSON.java @@ -184,6 +184,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.equinix.openapi.metal.v1.model.InterconnectionList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.equinix.openapi.metal.v1.model.InterconnectionMetro.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.equinix.openapi.metal.v1.model.InterconnectionPort.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.equinix.openapi.metal.v1.model.InterconnectionPortCore.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.equinix.openapi.metal.v1.model.InterconnectionPortList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.equinix.openapi.metal.v1.model.InterconnectionUpdateInput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.equinix.openapi.metal.v1.model.Invitation.CustomTypeAdapterFactory()); diff --git a/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/Href.java b/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/Href.java index c122a7c13..5ad6b8df8 100644 --- a/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/Href.java +++ b/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/Href.java @@ -76,50 +76,6 @@ public void setHref(String href) { this.href = href; } - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the Href instance itself - */ - public Href putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } @Override @@ -131,13 +87,12 @@ public boolean equals(Object o) { return false; } Href href = (Href) o; - return Objects.equals(this.href, href.href)&& - Objects.equals(this.additionalProperties, href.additionalProperties); + return Objects.equals(this.href, href.href); } @Override public int hashCode() { - return Objects.hash(href, additionalProperties); + return Objects.hash(href); } @Override @@ -145,7 +100,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Href {\n"); sb.append(" href: ").append(toIndentedString(href)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -188,6 +142,14 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { } } + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!Href.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Href` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + } + } + // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Href.openapiRequiredFields) { if (jsonObj.get(requiredField) == null) { @@ -214,23 +176,6 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Href value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); - } - } - } elementAdapter.write(out, obj); } @@ -238,27 +183,7 @@ else if (entry.getValue() instanceof Character) public Href read(JsonReader in) throws IOException { JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); validateJsonObject(jsonObj); - // store additional fields in the deserialized instance - Href instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; + return thisAdapter.fromJsonTree(jsonObj); } }.nullSafe(); diff --git a/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPort.java b/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPort.java index 7142a2185..46efb08dc 100644 --- a/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPort.java +++ b/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPort.java @@ -16,13 +16,15 @@ import java.util.Objects; import java.util.Arrays; import com.equinix.openapi.metal.v1.model.Href; -import com.equinix.openapi.metal.v1.model.VirtualCircuitList; +import com.equinix.openapi.metal.v1.model.VirtualCircuitListVirtualCircuitsInner; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; import com.google.gson.Gson; @@ -51,6 +53,10 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class InterconnectionPort { + public static final String SERIALIZED_NAME_VIRTUAL_CIRCUITS = "virtual_circuits"; + @SerializedName(SERIALIZED_NAME_VIRTUAL_CIRCUITS) + private List virtualCircuits = null; + public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private UUID id; @@ -169,10 +175,6 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException { @SerializedName(SERIALIZED_NAME_SWITCH_ID) private String switchId; - public static final String SERIALIZED_NAME_VIRTUAL_CIRCUITS = "virtual_circuits"; - @SerializedName(SERIALIZED_NAME_VIRTUAL_CIRCUITS) - private VirtualCircuitList virtualCircuits; - public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) private String name; @@ -192,6 +194,36 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException { public InterconnectionPort() { } + public InterconnectionPort virtualCircuits(List virtualCircuits) { + + this.virtualCircuits = virtualCircuits; + return this; + } + + public InterconnectionPort addVirtualCircuitsItem(VirtualCircuitListVirtualCircuitsInner virtualCircuitsItem) { + if (this.virtualCircuits == null) { + this.virtualCircuits = new ArrayList<>(); + } + this.virtualCircuits.add(virtualCircuitsItem); + return this; + } + + /** + * Get virtualCircuits + * @return virtualCircuits + **/ + @javax.annotation.Nullable + + public List getVirtualCircuits() { + return virtualCircuits; + } + + + public void setVirtualCircuits(List virtualCircuits) { + this.virtualCircuits = virtualCircuits; + } + + public InterconnectionPort id(UUID id) { this.id = id; @@ -302,28 +334,6 @@ public void setSwitchId(String switchId) { } - public InterconnectionPort virtualCircuits(VirtualCircuitList virtualCircuits) { - - this.virtualCircuits = virtualCircuits; - return this; - } - - /** - * Get virtualCircuits - * @return virtualCircuits - **/ - @javax.annotation.Nullable - - public VirtualCircuitList getVirtualCircuits() { - return virtualCircuits; - } - - - public void setVirtualCircuits(VirtualCircuitList virtualCircuits) { - this.virtualCircuits = virtualCircuits; - } - - public InterconnectionPort name(String name) { this.name = name; @@ -466,12 +476,12 @@ public boolean equals(Object o) { return false; } InterconnectionPort interconnectionPort = (InterconnectionPort) o; - return Objects.equals(this.id, interconnectionPort.id) && + return Objects.equals(this.virtualCircuits, interconnectionPort.virtualCircuits) && + Objects.equals(this.id, interconnectionPort.id) && Objects.equals(this.organization, interconnectionPort.organization) && Objects.equals(this.role, interconnectionPort.role) && Objects.equals(this.status, interconnectionPort.status) && Objects.equals(this.switchId, interconnectionPort.switchId) && - Objects.equals(this.virtualCircuits, interconnectionPort.virtualCircuits) && Objects.equals(this.name, interconnectionPort.name) && Objects.equals(this.speed, interconnectionPort.speed) && Objects.equals(this.linkStatus, interconnectionPort.linkStatus) && @@ -481,19 +491,19 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(id, organization, role, status, switchId, virtualCircuits, name, speed, linkStatus, href, additionalProperties); + return Objects.hash(virtualCircuits, id, organization, role, status, switchId, name, speed, linkStatus, href, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InterconnectionPort {\n"); + sb.append(" virtualCircuits: ").append(toIndentedString(virtualCircuits)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" organization: ").append(toIndentedString(organization)).append("\n"); sb.append(" role: ").append(toIndentedString(role)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" switchId: ").append(toIndentedString(switchId)).append("\n"); - sb.append(" virtualCircuits: ").append(toIndentedString(virtualCircuits)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" speed: ").append(toIndentedString(speed)).append("\n"); sb.append(" linkStatus: ").append(toIndentedString(linkStatus)).append("\n"); @@ -521,12 +531,12 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); + openapiFields.add("virtual_circuits"); openapiFields.add("id"); openapiFields.add("organization"); openapiFields.add("role"); openapiFields.add("status"); openapiFields.add("switch_id"); - openapiFields.add("virtual_circuits"); openapiFields.add("name"); openapiFields.add("speed"); openapiFields.add("link_status"); @@ -548,6 +558,20 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in InterconnectionPort is not found in the empty JSON string", InterconnectionPort.openapiRequiredFields.toString())); } } + if (jsonObj.get("virtual_circuits") != null && !jsonObj.get("virtual_circuits").isJsonNull()) { + JsonArray jsonArrayvirtualCircuits = jsonObj.getAsJsonArray("virtual_circuits"); + if (jsonArrayvirtualCircuits != null) { + // ensure the json data is an array + if (!jsonObj.get("virtual_circuits").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `virtual_circuits` to be an array in the JSON string but got `%s`", jsonObj.get("virtual_circuits").toString())); + } + + // validate the optional field `virtual_circuits` (array) + for (int i = 0; i < jsonArrayvirtualCircuits.size(); i++) { + VirtualCircuitListVirtualCircuitsInner.validateJsonObject(jsonArrayvirtualCircuits.get(i).getAsJsonObject()); + }; + } + } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } @@ -564,10 +588,6 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if ((jsonObj.get("switch_id") != null && !jsonObj.get("switch_id").isJsonNull()) && !jsonObj.get("switch_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `switch_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("switch_id").toString())); } - // validate the optional field `virtual_circuits` - if (jsonObj.get("virtual_circuits") != null && !jsonObj.get("virtual_circuits").isJsonNull()) { - VirtualCircuitList.validateJsonObject(jsonObj.getAsJsonObject("virtual_circuits")); - } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } diff --git a/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCore.java b/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCore.java new file mode 100644 index 000000000..c69340f4e --- /dev/null +++ b/equinix-openapi-metal/src/main/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCore.java @@ -0,0 +1,634 @@ +/* + * 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. The fields available for search differ by resource, as does the search strategy. 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. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@equinixmetal.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.equinix.openapi.metal.v1.model; + +import java.util.Objects; +import java.util.Arrays; +import com.equinix.openapi.metal.v1.model.Href; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.equinix.openapi.JSON; + +/** + * InterconnectionPortCore + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InterconnectionPortCore { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_ORGANIZATION = "organization"; + @SerializedName(SERIALIZED_NAME_ORGANIZATION) + private Href organization; + + /** + * Either 'primary' or 'secondary'. + */ + @JsonAdapter(RoleEnum.Adapter.class) + public enum RoleEnum { + PRIMARY("primary"), + + SECONDARY("secondary"); + + private String value; + + RoleEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RoleEnum fromValue(String value) { + for (RoleEnum b : RoleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RoleEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RoleEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RoleEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ROLE = "role"; + @SerializedName(SERIALIZED_NAME_ROLE) + private RoleEnum role; + + /** + * For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the service token associated is expired. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + REQUESTED("requested"), + + ACTIVE("active"), + + DELETING("deleting"), + + EXPIRED("expired"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_SWITCH_ID = "switch_id"; + @SerializedName(SERIALIZED_NAME_SWITCH_ID) + private String switchId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SPEED = "speed"; + @SerializedName(SERIALIZED_NAME_SPEED) + private Integer speed; + + public static final String SERIALIZED_NAME_LINK_STATUS = "link_status"; + @SerializedName(SERIALIZED_NAME_LINK_STATUS) + private String linkStatus; + + public static final String SERIALIZED_NAME_HREF = "href"; + @SerializedName(SERIALIZED_NAME_HREF) + private String href; + + public InterconnectionPortCore() { + } + + public InterconnectionPortCore id(UUID id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + this.id = id; + } + + + public InterconnectionPortCore organization(Href organization) { + + this.organization = organization; + return this; + } + + /** + * Get organization + * @return organization + **/ + @javax.annotation.Nullable + + public Href getOrganization() { + return organization; + } + + + public void setOrganization(Href organization) { + this.organization = organization; + } + + + public InterconnectionPortCore role(RoleEnum role) { + + this.role = role; + return this; + } + + /** + * Either 'primary' or 'secondary'. + * @return role + **/ + @javax.annotation.Nullable + + public RoleEnum getRole() { + return role; + } + + + public void setRole(RoleEnum role) { + this.role = role; + } + + + public InterconnectionPortCore status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * For both Fabric VCs and Dedicated Ports, this will be 'requested' on creation and 'deleting' on deletion. Once the Fabric VC has found its corresponding Fabric connection, this will turn to 'active'. For Dedicated Ports, once the dedicated port is associated, this will also turn to 'active'. For Fabric VCs, this can turn into an 'expired' state if the service token associated is expired. + * @return status + **/ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public InterconnectionPortCore switchId(String switchId) { + + this.switchId = switchId; + return this; + } + + /** + * A switch 'short ID' + * @return switchId + **/ + @javax.annotation.Nullable + + public String getSwitchId() { + return switchId; + } + + + public void setSwitchId(String switchId) { + this.switchId = switchId; + } + + + public InterconnectionPortCore name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public InterconnectionPortCore speed(Integer speed) { + + this.speed = speed; + return this; + } + + /** + * Get speed + * @return speed + **/ + @javax.annotation.Nullable + + public Integer getSpeed() { + return speed; + } + + + public void setSpeed(Integer speed) { + this.speed = speed; + } + + + public InterconnectionPortCore linkStatus(String linkStatus) { + + this.linkStatus = linkStatus; + return this; + } + + /** + * Get linkStatus + * @return linkStatus + **/ + @javax.annotation.Nullable + + public String getLinkStatus() { + return linkStatus; + } + + + public void setLinkStatus(String linkStatus) { + this.linkStatus = linkStatus; + } + + + public InterconnectionPortCore href(String href) { + + this.href = href; + return this; + } + + /** + * Get href + * @return href + **/ + @javax.annotation.Nullable + + public String getHref() { + return href; + } + + + public void setHref(String href) { + this.href = href; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the InterconnectionPortCore instance itself + */ + public InterconnectionPortCore putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InterconnectionPortCore interconnectionPortCore = (InterconnectionPortCore) o; + return Objects.equals(this.id, interconnectionPortCore.id) && + Objects.equals(this.organization, interconnectionPortCore.organization) && + Objects.equals(this.role, interconnectionPortCore.role) && + Objects.equals(this.status, interconnectionPortCore.status) && + Objects.equals(this.switchId, interconnectionPortCore.switchId) && + Objects.equals(this.name, interconnectionPortCore.name) && + Objects.equals(this.speed, interconnectionPortCore.speed) && + Objects.equals(this.linkStatus, interconnectionPortCore.linkStatus) && + Objects.equals(this.href, interconnectionPortCore.href)&& + Objects.equals(this.additionalProperties, interconnectionPortCore.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, organization, role, status, switchId, name, speed, linkStatus, href, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InterconnectionPortCore {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" organization: ").append(toIndentedString(organization)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" switchId: ").append(toIndentedString(switchId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" speed: ").append(toIndentedString(speed)).append("\n"); + sb.append(" linkStatus: ").append(toIndentedString(linkStatus)).append("\n"); + sb.append(" href: ").append(toIndentedString(href)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("organization"); + openapiFields.add("role"); + openapiFields.add("status"); + openapiFields.add("switch_id"); + openapiFields.add("name"); + openapiFields.add("speed"); + openapiFields.add("link_status"); + openapiFields.add("href"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to InterconnectionPortCore + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!InterconnectionPortCore.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InterconnectionPortCore is not found in the empty JSON string", InterconnectionPortCore.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `organization` + if (jsonObj.get("organization") != null && !jsonObj.get("organization").isJsonNull()) { + Href.validateJsonObject(jsonObj.getAsJsonObject("organization")); + } + if ((jsonObj.get("role") != null && !jsonObj.get("role").isJsonNull()) && !jsonObj.get("role").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `role` to be a primitive type in the JSON string but got `%s`", jsonObj.get("role").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("switch_id") != null && !jsonObj.get("switch_id").isJsonNull()) && !jsonObj.get("switch_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `switch_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("switch_id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("link_status") != null && !jsonObj.get("link_status").isJsonNull()) && !jsonObj.get("link_status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `link_status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("link_status").toString())); + } + if ((jsonObj.get("href") != null && !jsonObj.get("href").isJsonNull()) && !jsonObj.get("href").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `href` to be a primitive type in the JSON string but got `%s`", jsonObj.get("href").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InterconnectionPortCore.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InterconnectionPortCore' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InterconnectionPortCore.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InterconnectionPortCore value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public InterconnectionPortCore read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + InterconnectionPortCore instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InterconnectionPortCore given an JSON string + * + * @param jsonString JSON string + * @return An instance of InterconnectionPortCore + * @throws IOException if the JSON string is invalid with respect to InterconnectionPortCore + */ + public static InterconnectionPortCore fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InterconnectionPortCore.class); + } + + /** + * Convert an instance of InterconnectionPortCore to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCoreTest.java b/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCoreTest.java new file mode 100644 index 000000000..c33384d46 --- /dev/null +++ b/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortCoreTest.java @@ -0,0 +1,114 @@ +/* + * 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. The fields available for search differ by resource, as does the search strategy. 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. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@equinixmetal.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.equinix.openapi.metal.v1.model; + +import com.equinix.openapi.metal.v1.model.Href; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for InterconnectionPortCore + */ +public class InterconnectionPortCoreTest { + private final InterconnectionPortCore model = new InterconnectionPortCore(); + + /** + * Model tests for InterconnectionPortCore + */ + @Test + public void testInterconnectionPortCore() { + // TODO: test InterconnectionPortCore + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'organization' + */ + @Test + public void organizationTest() { + // TODO: test organization + } + + /** + * Test the property 'role' + */ + @Test + public void roleTest() { + // TODO: test role + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'switchId' + */ + @Test + public void switchIdTest() { + // TODO: test switchId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'speed' + */ + @Test + public void speedTest() { + // TODO: test speed + } + + /** + * Test the property 'linkStatus' + */ + @Test + public void linkStatusTest() { + // TODO: test linkStatus + } + + /** + * Test the property 'href' + */ + @Test + public void hrefTest() { + // TODO: test href + } + +} diff --git a/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortTest.java b/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortTest.java index 0140d1202..1f8deb37e 100644 --- a/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortTest.java +++ b/equinix-openapi-metal/src/test/java/com/equinix/openapi/metal/v1/model/InterconnectionPortTest.java @@ -14,13 +14,15 @@ package com.equinix.openapi.metal.v1.model; import com.equinix.openapi.metal.v1.model.Href; -import com.equinix.openapi.metal.v1.model.VirtualCircuitList; +import com.equinix.openapi.metal.v1.model.VirtualCircuitListVirtualCircuitsInner; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -40,6 +42,14 @@ public void testInterconnectionPort() { // TODO: test InterconnectionPort } + /** + * Test the property 'virtualCircuits' + */ + @Test + public void virtualCircuitsTest() { + // TODO: test virtualCircuits + } + /** * Test the property 'id' */ @@ -80,14 +90,6 @@ public void switchIdTest() { // TODO: test switchId } - /** - * Test the property 'virtualCircuits' - */ - @Test - public void virtualCircuitsTest() { - // TODO: test virtualCircuits - } - /** * Test the property 'name' */