Skip to content

Commit

Permalink
feat(Context-Based Restrictions): add enforcement_modes to operations…
Browse files Browse the repository at this point in the history
… response (#219)

Signed-off-by: Matthew Brandyberry <[email protected]>
  • Loading branch information
mtbrandy authored Nov 3, 2023
1 parent d4b4aec commit 9e1b58e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 3.79.0-2eb6af3d-20230905-174838
* IBM OpenAPI SDK Code Generator Version: 3.81.0-c73a091c-20231026-215706
*/

package com.ibm.cloud.platform_services.context_based_restrictions.v1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class APIType extends GenericModel {
protected String description;
protected String type;
protected List<Action> actions;
@SerializedName("enforcement_modes")
protected List<String> enforcementModes;

protected APIType() { }

Expand Down Expand Up @@ -86,5 +88,16 @@ public String getType() {
public List<Action> getActions() {
return actions;
}

/**
* Gets the enforcementModes.
*
* The enforcement modes supported by the API type.
*
* @return the enforcementModes
*/
public List<String> getEnforcementModes() {
return enforcementModes;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void testCreateZoneWOptions() throws Throwable {
// Construct an instance of the AddressIPAddress model
AddressIPAddress addressModel = new AddressIPAddress.Builder()
.type("ipAddress")
.value("169.23.56.234, 3ffe:1900:fe21:4545::")
.value("169.23.56.234")
.build();

// Construct an instance of the CreateZoneOptions model
Expand Down Expand Up @@ -270,7 +270,7 @@ public void testReplaceZoneWOptions() throws Throwable {
// Construct an instance of the AddressIPAddress model
AddressIPAddress addressModel = new AddressIPAddress.Builder()
.type("ipAddress")
.value("169.23.56.234, 3ffe:1900:fe21:4545::")
.value("169.23.56.234")
.build();

// Construct an instance of the ReplaceZoneOptions model
Expand Down Expand Up @@ -851,7 +851,7 @@ public void testGetAccountSettingsNoOptions() throws Throwable {
@Test
public void testListAvailableServiceOperationsWOptions() throws Throwable {
// Register a mock response
String mockResponseBody = "{\"api_types\": [{\"api_type_id\": \"apiTypeId\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"type\", \"actions\": [{\"action_id\": \"actionId\", \"description\": \"description\"}]}]}";
String mockResponseBody = "{\"api_types\": [{\"api_type_id\": \"apiTypeId\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"type\", \"actions\": [{\"action_id\": \"actionId\", \"description\": \"description\"}], \"enforcement_modes\": [\"enforcementModes\"]}]}";
String listAvailableServiceOperationsPath = "/v1/operations";
server.enqueue(new MockResponse()
.setHeader("Content-type", "application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ public void testAPIType() throws Throwable {
assertNull(apiTypeModel.getDescription());
assertNull(apiTypeModel.getType());
assertNull(apiTypeModel.getActions());
assertNull(apiTypeModel.getEnforcementModes());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,18 @@ public static void main(String[] args) throws Exception {
.type("ipAddress")
.value("169.23.56.234")
.build();
AddressIPAddress ipAddressV6Model = new AddressIPAddress.Builder()
.type("ipAddress")
.value("3ffe:1900:fe21:4545::")
.build();
AddressIPAddressRange ipRangeAddressModel = new AddressIPAddressRange.Builder()
.type("ipRange")
.value("169.23.22.0-169.23.22.255")
.build();
AddressIPAddressRange ipRangeAddressV6Model = new AddressIPAddressRange.Builder()
.type("ipRange")
.value("3ffe:1900:fe21:4545::-3ffe:1900:fe21:6767::")
.build();
AddressSubnet subnetAddressModel = new AddressSubnet.Builder()
.type("subnet")
.value("192.0.2.0/24")
Expand All @@ -130,7 +138,7 @@ public static void main(String[] args) throws Exception {
.name("an example of zone")
.accountId(accountID)
.description("this is an example of zone")
.addresses(java.util.Arrays.asList(ipAddressModel, ipRangeAddressModel, subnetAddressModel, vpcAddressModel, serviceRefAddressModel))
.addresses(java.util.Arrays.asList(ipAddressModel, ipAddressV6Model, ipRangeAddressModel, ipRangeAddressV6Model, subnetAddressModel, vpcAddressModel, serviceRefAddressModel))
.excluded(java.util.Arrays.asList(excludedIPAddressModel))
.build();

Expand Down

0 comments on commit 9e1b58e

Please sign in to comment.