Skip to content

Commit dc10292

Browse files
authored
Merge pull request #87 from IBM/dl-vlan-mapping
feat: directlink - dedicated vlan mapping
2 parents d0ba72c + 209b5e4 commit dc10292

33 files changed

+3453
-757
lines changed

modules/direct-link/src/main/java/com/ibm/cloud/networking/direct_link/v1/DirectLink.java

Lines changed: 12 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2023.
2+
* (C) Copyright IBM Corp. 2024.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -12,7 +12,7 @@
1212
*/
1313

1414
/*
15-
* IBM OpenAPI SDK Code Generator Version: 3.60.2-95dc7721-20221102-203229
15+
* IBM OpenAPI SDK Code Generator Version: 3.80.0-29334a73-20230925-151553
1616
*/
1717

1818
package com.ibm.cloud.networking.direct_link.v1;
@@ -42,6 +42,7 @@
4242
import com.ibm.cloud.networking.direct_link.v1.model.GetGatewayExportRouteFilterOptions;
4343
import com.ibm.cloud.networking.direct_link.v1.model.GetGatewayImportRouteFilterOptions;
4444
import com.ibm.cloud.networking.direct_link.v1.model.GetGatewayOptions;
45+
import com.ibm.cloud.networking.direct_link.v1.model.GetGatewayResponse;
4546
import com.ibm.cloud.networking.direct_link.v1.model.GetGatewayRouteReportOptions;
4647
import com.ibm.cloud.networking.direct_link.v1.model.GetGatewayStatisticsOptions;
4748
import com.ibm.cloud.networking.direct_link.v1.model.GetGatewayStatusOptions;
@@ -260,9 +261,9 @@ public ServiceCall<Void> deleteGateway(DeleteGatewayOptions deleteGatewayOptions
260261
* Retrieve a Direct Link gateway.
261262
*
262263
* @param getGatewayOptions the {@link GetGatewayOptions} containing the options for the call
263-
* @return a {@link ServiceCall} with a result of type {@link Gateway}
264+
* @return a {@link ServiceCall} with a result of type {@link GetGatewayResponse}
264265
*/
265-
public ServiceCall<Gateway> getGateway(GetGatewayOptions getGatewayOptions) {
266+
public ServiceCall<GetGatewayResponse> getGateway(GetGatewayOptions getGatewayOptions) {
266267
com.ibm.cloud.sdk.core.util.Validator.notNull(getGatewayOptions,
267268
"getGatewayOptions cannot be null");
268269
Map<String, String> pathParamsMap = new HashMap<String, String>();
@@ -274,8 +275,8 @@ public ServiceCall<Gateway> getGateway(GetGatewayOptions getGatewayOptions) {
274275
}
275276
builder.header("Accept", "application/json");
276277
builder.query("version", String.valueOf(this.version));
277-
ResponseConverter<Gateway> responseConverter =
278-
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Gateway>() { }.getType());
278+
ResponseConverter<GetGatewayResponse> responseConverter =
279+
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<GetGatewayResponse>() { }.getType());
279280
return createServiceCall(builder.build(), responseConverter);
280281
}
281282

@@ -299,56 +300,11 @@ public ServiceCall<Gateway> updateGateway(UpdateGatewayOptions updateGatewayOpti
299300
}
300301
builder.header("Accept", "application/json");
301302
builder.query("version", String.valueOf(this.version));
302-
final JsonObject contentJson = new JsonObject();
303-
if (updateGatewayOptions.authenticationKey() != null) {
304-
contentJson.add("authentication_key", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateGatewayOptions.authenticationKey()));
305-
}
306-
if (updateGatewayOptions.bfdConfig() != null) {
307-
contentJson.add("bfd_config", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateGatewayOptions.bfdConfig()));
308-
}
309-
if (updateGatewayOptions.bgpAsn() != null) {
310-
contentJson.addProperty("bgp_asn", updateGatewayOptions.bgpAsn());
311-
}
312-
if (updateGatewayOptions.bgpCerCidr() != null) {
313-
contentJson.addProperty("bgp_cer_cidr", updateGatewayOptions.bgpCerCidr());
314-
}
315-
if (updateGatewayOptions.bgpIbmCidr() != null) {
316-
contentJson.addProperty("bgp_ibm_cidr", updateGatewayOptions.bgpIbmCidr());
317-
}
318-
if (updateGatewayOptions.connectionMode() != null) {
319-
contentJson.addProperty("connection_mode", updateGatewayOptions.connectionMode());
320-
}
321-
if (updateGatewayOptions.defaultExportRouteFilter() != null) {
322-
contentJson.addProperty("default_export_route_filter", updateGatewayOptions.defaultExportRouteFilter());
323-
}
324-
if (updateGatewayOptions.defaultImportRouteFilter() != null) {
325-
contentJson.addProperty("default_import_route_filter", updateGatewayOptions.defaultImportRouteFilter());
326-
}
327-
if (updateGatewayOptions.global() != null) {
328-
contentJson.addProperty("global", updateGatewayOptions.global());
329-
}
330-
if (updateGatewayOptions.loaRejectReason() != null) {
331-
contentJson.addProperty("loa_reject_reason", updateGatewayOptions.loaRejectReason());
332-
}
333-
if (updateGatewayOptions.macsecConfig() != null) {
334-
contentJson.add("macsec_config", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateGatewayOptions.macsecConfig()));
335-
}
336-
if (updateGatewayOptions.metered() != null) {
337-
contentJson.addProperty("metered", updateGatewayOptions.metered());
338-
}
339-
if (updateGatewayOptions.name() != null) {
340-
contentJson.addProperty("name", updateGatewayOptions.name());
341-
}
342-
if (updateGatewayOptions.operationalStatus() != null) {
343-
contentJson.addProperty("operational_status", updateGatewayOptions.operationalStatus());
344-
}
345-
if (updateGatewayOptions.patchPanelCompletionNotice() != null) {
346-
contentJson.addProperty("patch_panel_completion_notice", updateGatewayOptions.patchPanelCompletionNotice());
347-
}
348-
if (updateGatewayOptions.speedMbps() != null) {
349-
contentJson.addProperty("speed_mbps", updateGatewayOptions.speedMbps());
350-
}
351-
builder.bodyJson(contentJson);
303+
String patchBodyString = com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(updateGatewayOptions.gatewayPatchTemplatePatch());
304+
patchBodyString = patchBodyString.replace(".0,", ",");
305+
builder.bodyContent(patchBodyString, "application/merge-patch+json");
306+
307+
builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(updateGatewayOptions.gatewayPatchTemplatePatch()), "application/merge-patch+json");
352308
ResponseConverter<Gateway> responseConverter =
353309
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Gateway>() { }.getType());
354310
return createServiceCall(builder.build(), responseConverter);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2024.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
package com.ibm.cloud.networking.direct_link.v1.model;
14+
15+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
16+
17+
/**
18+
* gateway port for type=connect gateways.
19+
*/
20+
public class CrossAccountGatewayPort extends GenericModel {
21+
22+
protected String id;
23+
24+
protected CrossAccountGatewayPort() { }
25+
26+
/**
27+
* Gets the id.
28+
*
29+
* Port Identifier.
30+
*
31+
* @return the id
32+
*/
33+
public String getId() {
34+
return id;
35+
}
36+
}
37+

modules/direct-link/src/main/java/com/ibm/cloud/networking/direct_link/v1/model/Gateway.java

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2023.
2+
* (C) Copyright IBM Corp. 2024.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -156,6 +156,8 @@ public interface Type {
156156
@SerializedName("created_at")
157157
protected Date createdAt;
158158
protected String crn;
159+
@SerializedName("cross_account")
160+
protected Boolean crossAccount;
159161
@SerializedName("cross_connect_router")
160162
protected String crossConnectRouter;
161163
@SerializedName("customer_name")
@@ -180,15 +182,15 @@ public interface Type {
180182
protected String name;
181183
@SerializedName("operational_status")
182184
protected String operationalStatus;
183-
@SerializedName("patch_panel_completion_notice")
184-
protected String patchPanelCompletionNotice;
185185
protected GatewayPort port;
186186
@SerializedName("provider_api_managed")
187187
protected Boolean providerApiManaged;
188188
@SerializedName("resource_group")
189189
protected ResourceGroupReference resourceGroup;
190190
@SerializedName("speed_mbps")
191191
protected Long speedMbps;
192+
@SerializedName("patch_panel_completion_notice")
193+
protected String patchPanelCompletionNotice;
192194
protected String type;
193195
protected Long vlan;
194196

@@ -381,6 +383,17 @@ public String getCrn() {
381383
return crn;
382384
}
383385

386+
/**
387+
* Gets the crossAccount.
388+
*
389+
* Indicates whether this gateway is cross account gateway.
390+
*
391+
* @return the crossAccount
392+
*/
393+
public Boolean isCrossAccount() {
394+
return crossAccount;
395+
}
396+
384397
/**
385398
* Gets the crossConnectRouter.
386399
*
@@ -539,17 +552,6 @@ public String getOperationalStatus() {
539552
return operationalStatus;
540553
}
541554

542-
/**
543-
* Gets the patchPanelCompletionNotice.
544-
*
545-
* Gateway patch panel complete notification from implementation team.
546-
*
547-
* @return the patchPanelCompletionNotice
548-
*/
549-
public String getPatchPanelCompletionNotice() {
550-
return patchPanelCompletionNotice;
551-
}
552-
553555
/**
554556
* Gets the port.
555557
*
@@ -594,6 +596,17 @@ public Long getSpeedMbps() {
594596
return speedMbps;
595597
}
596598

599+
/**
600+
* Gets the patchPanelCompletionNotice.
601+
*
602+
* Gateway patch panel complete notification from implementation team.
603+
*
604+
* @return the patchPanelCompletionNotice
605+
*/
606+
public String getPatchPanelCompletionNotice() {
607+
return patchPanelCompletionNotice;
608+
}
609+
597610
/**
598611
* Gets the type.
599612
*
@@ -609,7 +622,8 @@ public String getType() {
609622
/**
610623
* Gets the vlan.
611624
*
612-
* VLAN allocated for this gateway. Only set for type=connect gateways.
625+
* VLAN configured for this gateway. If there is no vlan configured for the gateway, the vlan will be absent. This
626+
* property will also be absent if this gateway's `crn` is in another account.
613627
*
614628
* @return the vlan
615629
*/

modules/direct-link/src/main/java/com/ibm/cloud/networking/direct_link/v1/model/GatewayCollection.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2022.
2+
* (C) Copyright IBM Corp. 2024.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -17,11 +17,13 @@
1717
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1818

1919
/**
20-
* GatewayCollection.
20+
* List of gateways.
2121
*/
2222
public class GatewayCollection extends GenericModel {
2323

24-
protected List<Gateway> gateways;
24+
protected List<GatewayCollectionGatewaysItem> gateways;
25+
26+
protected GatewayCollection() { }
2527

2628
/**
2729
* Gets the gateways.
@@ -30,7 +32,7 @@ public class GatewayCollection extends GenericModel {
3032
*
3133
* @return the gateways
3234
*/
33-
public List<Gateway> getGateways() {
35+
public List<GatewayCollectionGatewaysItem> getGateways() {
3436
return gateways;
3537
}
3638
}

0 commit comments

Comments
 (0)