Skip to content

Commit 7574f00

Browse files
committed
feat: directlink provider updated to latest specs
Signed-off-by: Sridhar G K <[email protected]>
1 parent dc10292 commit 7574f00

File tree

14 files changed

+678
-372
lines changed

14 files changed

+678
-372
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ hs_err_pid*
2929
.project
3030
.factorypath
3131
*-apiref.json
32-
32+
.vscode
3333
.idea
3434
.openapi-generator/
3535
.openapi-generator-ignore

modules/direct-link-provider/src/main/java/com/ibm/cloud/networking/direct_link_provider/v2/DirectLinkProvider.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
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.43.0-49eab5c7-20211117-152138
15+
* IBM OpenAPI SDK Code Generator Version: 3.80.0-29334a73-20230925-151553
1616
*/
1717

1818
package com.ibm.cloud.networking.direct_link_provider.v2;
@@ -48,8 +48,14 @@
4848
*/
4949
public class DirectLinkProvider extends BaseService {
5050

51+
/**
52+
* Default service name used when configuring the `DirectLinkProvider` client.
53+
*/
5154
public static final String DEFAULT_SERVICE_NAME = "direct_link_provider";
5255

56+
/**
57+
* Default service endpoint URL.
58+
*/
5359
public static final String DEFAULT_SERVICE_URL = "https://directlink.cloud.ibm.com/provider/v2";
5460

5561
private String version;

modules/direct-link-provider/src/main/java/com/ibm/cloud/networking/direct_link_provider/v2/model/CreateProviderGatewayOptions.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
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
@@ -43,6 +43,11 @@ public static class Builder {
4343
private Long vlan;
4444
private String checkOnly;
4545

46+
/**
47+
* Instantiates a new Builder from an existing CreateProviderGatewayOptions instance.
48+
*
49+
* @param createProviderGatewayOptions the instance to initialize the Builder with
50+
*/
4651
private Builder(CreateProviderGatewayOptions createProviderGatewayOptions) {
4752
this.bgpAsn = createProviderGatewayOptions.bgpAsn;
4853
this.customerAccountId = createProviderGatewayOptions.customerAccountId;
@@ -187,6 +192,8 @@ public Builder checkOnly(String checkOnly) {
187192
}
188193
}
189194

195+
protected CreateProviderGatewayOptions() { }
196+
190197
protected CreateProviderGatewayOptions(Builder builder) {
191198
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.bgpAsn,
192199
"bgpAsn cannot be null");
@@ -318,7 +325,7 @@ public String bgpIbmCidr() {
318325
*
319326
* VLAN requested for this gateway.
320327
*
321-
* VLAN provided should be in the range 1 to 4094.
328+
* VLAN provided should be in the range 2 to 3967.
322329
*
323330
* @return the vlan
324331
*/

modules/direct-link-provider/src/main/java/com/ibm/cloud/networking/direct_link_provider/v2/model/ProviderGatewayUpdateAttributesUpdatesItem.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
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
@@ -36,8 +36,7 @@ public class ProviderGatewayUpdateAttributesUpdatesItem extends GenericModel {
3636
protected Long bgpAsn;
3737
protected Long vlan;
3838

39-
protected ProviderGatewayUpdateAttributesUpdatesItem() {
40-
}
39+
protected ProviderGatewayUpdateAttributesUpdatesItem() { }
4140

4241
/**
4342
* Gets the speedMbps.
@@ -101,7 +100,7 @@ public Long getBgpAsn() {
101100
*
102101
* VLAN to be updated for this gateway.
103102
*
104-
* VLAN provided should be in the range 1 to 4094.
103+
* VLAN provided should be in the range 2 to 3967.
105104
*
106105
* @return the vlan
107106
*/

modules/direct-link-provider/src/main/java/com/ibm/cloud/networking/direct_link_provider/v2/model/ProviderGatewayUpdateAttributesUpdatesItemProviderGatewayVLAN.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
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
@@ -15,9 +15,11 @@
1515
/**
1616
* Update VLAN for this gateway.
1717
*
18-
* VLAN provided should be in the range 1 to 4094.
18+
* VLAN provided should be in the range 2 to 3967.
1919
*/
2020
public class ProviderGatewayUpdateAttributesUpdatesItemProviderGatewayVLAN extends ProviderGatewayUpdateAttributesUpdatesItem {
2121

22+
23+
protected ProviderGatewayUpdateAttributesUpdatesItemProviderGatewayVLAN() { }
2224
}
2325

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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_provider.v2.model;
14+
15+
import com.ibm.cloud.networking.direct_link_provider.v2.DirectLinkProvider;
16+
import java.util.ArrayList;
17+
import java.util.List;
18+
import java.util.NoSuchElementException;
19+
20+
/**
21+
* ProviderGatewaysPager can be used to simplify the use of the "listProviderGateways" method.
22+
*/
23+
public class ProviderGatewaysPager {
24+
private static class PageContext {
25+
private String next;
26+
public String getNext() {
27+
return next;
28+
}
29+
public void setNext(String next) {
30+
this.next = next;
31+
}
32+
}
33+
34+
protected boolean hasNext;
35+
protected ListProviderGatewaysOptions options;
36+
protected DirectLinkProvider client;
37+
protected PageContext pageContext;
38+
39+
// Hide the default ctor.
40+
protected ProviderGatewaysPager() { }
41+
42+
/**
43+
* Constructs a new ProviderGatewaysPager instance with the specified client and options model instance.
44+
* @param client the DirectLinkProvider instance to be used to invoke the "listProviderGateways" method
45+
* @param options the ListProviderGatewaysOptions instance to be used to invoke the "listProviderGateways" method
46+
*/
47+
public ProviderGatewaysPager(DirectLinkProvider client, ListProviderGatewaysOptions options) {
48+
if (options.start() != null) {
49+
throw new IllegalArgumentException("The options 'start' field should not be set");
50+
}
51+
52+
this.hasNext = true;
53+
this.client = client;
54+
this.options = options.newBuilder().build();
55+
this.pageContext = new PageContext();
56+
}
57+
58+
/**
59+
* Returns true if there are more results to be retrieved.
60+
* @return boolean
61+
*/
62+
public boolean hasNext() {
63+
return hasNext;
64+
}
65+
66+
/**
67+
* Returns the next page of results.
68+
* @return a List&lt;ProviderGateway&gt; that contains the next page of results
69+
*/
70+
public List<ProviderGateway> getNext() {
71+
if (!hasNext()) {
72+
throw new NoSuchElementException("No more results available");
73+
}
74+
75+
ListProviderGatewaysOptions.Builder builder = this.options.newBuilder();
76+
if (this.pageContext.getNext() != null) {
77+
builder.start(this.pageContext.getNext());
78+
}
79+
this.options = builder.build();
80+
81+
ProviderGatewayCollection result = client.listProviderGateways(options).execute().getResult();
82+
83+
String next = null;
84+
if (result.getNext() != null) {
85+
next = result.getNext().getStart();
86+
}
87+
this.pageContext.setNext(next);
88+
if (next == null) {
89+
this.hasNext = false;
90+
}
91+
92+
return result.getGateways();
93+
}
94+
95+
/**
96+
* Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved.
97+
* @return a List&lt;ProviderGateway&gt; containing all results returned by the "listProviderGateways" method
98+
*/
99+
public List<ProviderGateway> getAll() {
100+
List<ProviderGateway> results = new ArrayList<>();
101+
while (hasNext()) {
102+
List<ProviderGateway> nextPage = getNext();
103+
results.addAll(nextPage);
104+
}
105+
return results;
106+
}
107+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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_provider.v2.model;
14+
15+
import com.ibm.cloud.networking.direct_link_provider.v2.DirectLinkProvider;
16+
import java.util.ArrayList;
17+
import java.util.List;
18+
import java.util.NoSuchElementException;
19+
20+
/**
21+
* ProviderPortsPager can be used to simplify the use of the "listProviderPorts" method.
22+
*/
23+
public class ProviderPortsPager {
24+
private static class PageContext {
25+
private String next;
26+
public String getNext() {
27+
return next;
28+
}
29+
public void setNext(String next) {
30+
this.next = next;
31+
}
32+
}
33+
34+
protected boolean hasNext;
35+
protected ListProviderPortsOptions options;
36+
protected DirectLinkProvider client;
37+
protected PageContext pageContext;
38+
39+
// Hide the default ctor.
40+
protected ProviderPortsPager() { }
41+
42+
/**
43+
* Constructs a new ProviderPortsPager instance with the specified client and options model instance.
44+
* @param client the DirectLinkProvider instance to be used to invoke the "listProviderPorts" method
45+
* @param options the ListProviderPortsOptions instance to be used to invoke the "listProviderPorts" method
46+
*/
47+
public ProviderPortsPager(DirectLinkProvider client, ListProviderPortsOptions options) {
48+
if (options.start() != null) {
49+
throw new IllegalArgumentException("The options 'start' field should not be set");
50+
}
51+
52+
this.hasNext = true;
53+
this.client = client;
54+
this.options = options.newBuilder().build();
55+
this.pageContext = new PageContext();
56+
}
57+
58+
/**
59+
* Returns true if there are more results to be retrieved.
60+
* @return boolean
61+
*/
62+
public boolean hasNext() {
63+
return hasNext;
64+
}
65+
66+
/**
67+
* Returns the next page of results.
68+
* @return a List&lt;ProviderPort&gt; that contains the next page of results
69+
*/
70+
public List<ProviderPort> getNext() {
71+
if (!hasNext()) {
72+
throw new NoSuchElementException("No more results available");
73+
}
74+
75+
ListProviderPortsOptions.Builder builder = this.options.newBuilder();
76+
if (this.pageContext.getNext() != null) {
77+
builder.start(this.pageContext.getNext());
78+
}
79+
this.options = builder.build();
80+
81+
ProviderPortCollection result = client.listProviderPorts(options).execute().getResult();
82+
83+
String next = null;
84+
if (result.getNext() != null) {
85+
next = result.getNext().getStart();
86+
}
87+
this.pageContext.setNext(next);
88+
if (next == null) {
89+
this.hasNext = false;
90+
}
91+
92+
return result.getPorts();
93+
}
94+
95+
/**
96+
* Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved.
97+
* @return a List&lt;ProviderPort&gt; containing all results returned by the "listProviderPorts" method
98+
*/
99+
public List<ProviderPort> getAll() {
100+
List<ProviderPort> results = new ArrayList<>();
101+
while (hasNext()) {
102+
List<ProviderPort> nextPage = getNext();
103+
results.addAll(nextPage);
104+
}
105+
return results;
106+
}
107+
}

modules/direct-link-provider/src/main/java/com/ibm/cloud/networking/direct_link_provider/v2/model/UpdateProviderGatewayOptions.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
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
@@ -39,6 +39,11 @@ public static class Builder {
3939
private Long speedMbps;
4040
private Long vlan;
4141

42+
/**
43+
* Instantiates a new Builder from an existing UpdateProviderGatewayOptions instance.
44+
*
45+
* @param updateProviderGatewayOptions the instance to initialize the Builder with
46+
*/
4247
private Builder(UpdateProviderGatewayOptions updateProviderGatewayOptions) {
4348
this.id = updateProviderGatewayOptions.id;
4449
this.bgpAsn = updateProviderGatewayOptions.bgpAsn;
@@ -151,6 +156,8 @@ public Builder vlan(long vlan) {
151156
}
152157
}
153158

159+
protected UpdateProviderGatewayOptions() { }
160+
154161
protected UpdateProviderGatewayOptions(Builder builder) {
155162
com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id,
156163
"id cannot be empty");
@@ -253,7 +260,7 @@ public Long speedMbps() {
253260
*
254261
* VLAN to be modified for this gateway.
255262
*
256-
* VLAN provided should be in the range 1 to 4094.
263+
* VLAN provided should be in the range 2 to 3967.
257264
*
258265
* @return the vlan
259266
*/

modules/direct-link-provider/src/main/java/com/ibm/cloud/networking/direct_link_provider/v2/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2021.
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

0 commit comments

Comments
 (0)