-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
696c8b0
commit c4fe290
Showing
6 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
.../src/main/java/org/cloudfoundry/client/v3/securitygroups/_UpdateSecurityGroupRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2013-2021 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.cloudfoundry.client.v3.securitygroups; | ||
|
||
import org.immutables.value.Value; | ||
|
||
import java.util.List; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** | ||
* The request payload for the Create a Security Group operation | ||
*/ | ||
@JsonSerialize | ||
@Value.Immutable | ||
abstract class _UpdateSecurityGroupRequest { | ||
/** | ||
* Name of the security group | ||
*/ | ||
@JsonProperty("name") | ||
abstract String getName(); | ||
|
||
/** | ||
* Object that controls if the group is applied globally to the lifecycle of all | ||
* applications | ||
*/ | ||
@JsonProperty("globally_enabled") | ||
abstract GloballyEnabled getGloballyEnabled(); | ||
|
||
/** | ||
* Rules that will be applied by this security group | ||
*/ | ||
@JsonProperty("rules") | ||
abstract List<Rule> getRules(); | ||
} |
29 changes: 29 additions & 0 deletions
29
...src/main/java/org/cloudfoundry/client/v3/securitygroups/_UpdateSecurityGroupResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2013-2021 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.cloudfoundry.client.v3.securitygroups; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import org.immutables.value.Value; | ||
|
||
/** | ||
* The response payload for the Update a Security Group operation | ||
*/ | ||
@JsonDeserialize | ||
@Value.Immutable | ||
abstract class _UpdateSecurityGroupResponse extends SecurityGroup { | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
...c/test/java/org/cloudfoundry/client/v3/securitygroups/UpdateSecurityGroupRequestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.cloudfoundry.client.v3.securitygroups; | ||
|
||
import org.junit.Test; | ||
|
||
public class UpdateSecurityGroupRequestTest { | ||
|
||
@Test(expected = IllegalStateException.class) | ||
public void noName() { | ||
UpdateSecurityGroupRequest.builder() | ||
.build(); | ||
} | ||
|
||
@Test() | ||
public void valid() { | ||
UpdateSecurityGroupRequest.builder() | ||
.name("my-group0") | ||
.globallyEnabled(GloballyEnabled | ||
.builder() | ||
.running(true) | ||
.build()) | ||
.rules(Rule.builder() | ||
.protocol(Protocol.TCP) | ||
.destination("10.10.10.0/24") | ||
.ports("443,80,8080") | ||
.build()) | ||
.rules(Rule.builder() | ||
.protocol(Protocol.ICMP) | ||
.destination("10.10.10.0/24") | ||
.description("Allow ping requests to private services") | ||
.type(8) | ||
.code(0) | ||
.build()) | ||
.build(); | ||
|
||
} | ||
|
||
} |