-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding bind running/staging security group v3 api
- Loading branch information
1 parent
53000cb
commit 4f5437d
Showing
9 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...main/java/org/cloudfoundry/client/v3/securitygroups/AbstractBindSecurityGroupRequest.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,40 @@ | ||
/* | ||
* 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.cloudfoundry.client.v3.ToManyRelationship; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
|
||
@JsonSerialize | ||
public abstract class AbstractBindSecurityGroupRequest { | ||
|
||
/** | ||
* The Security Group id | ||
*/ | ||
@JsonIgnore | ||
abstract String getSecurityGroupId(); | ||
|
||
/** | ||
* A relationship to the spaces where the security_group is applied to | ||
* applications during runtime | ||
*/ | ||
@JsonProperty("data") | ||
abstract ToManyRelationship getBoundSpaces(); | ||
} |
41 changes: 41 additions & 0 deletions
41
...ain/java/org/cloudfoundry/client/v3/securitygroups/AbstractBindSecurityGroupResponse.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,41 @@ | ||
/* | ||
* 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.cloudfoundry.Nullable; | ||
import org.cloudfoundry.client.v3.ToManyRelationship; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
|
||
@JsonDeserialize | ||
public abstract class AbstractBindSecurityGroupResponse { | ||
|
||
/** | ||
* A relationship to the spaces where the security_group is applied to | ||
* applications during runtime | ||
*/ | ||
@JsonProperty("data") | ||
abstract ToManyRelationship getBoundSpaces(); | ||
|
||
/** | ||
* When the resource was last updated | ||
*/ | ||
@JsonProperty("updated_at") | ||
@Nullable | ||
public abstract String getUpdatedAt(); | ||
} |
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
24 changes: 24 additions & 0 deletions
24
...main/java/org/cloudfoundry/client/v3/securitygroups/_BindRunningSecurityGroupRequest.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,24 @@ | ||
/* | ||
* 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; | ||
|
||
@Value.Immutable | ||
abstract class _BindRunningSecurityGroupRequest extends AbstractBindSecurityGroupRequest { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...ain/java/org/cloudfoundry/client/v3/securitygroups/_BindRunningSecurityGroupResponse.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,24 @@ | ||
/* | ||
* 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; | ||
|
||
@Value.Immutable | ||
public abstract class _BindRunningSecurityGroupResponse extends AbstractBindSecurityGroupResponse { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...main/java/org/cloudfoundry/client/v3/securitygroups/_BindStagingSecurityGroupRequest.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,24 @@ | ||
/* | ||
* 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; | ||
|
||
@Value.Immutable | ||
abstract class _BindStagingSecurityGroupRequest extends AbstractBindSecurityGroupRequest { | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...ain/java/org/cloudfoundry/client/v3/securitygroups/_BindStagingSecurityGroupResponse.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,24 @@ | ||
/* | ||
* 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; | ||
|
||
@Value.Immutable | ||
public abstract class _BindStagingSecurityGroupResponse extends AbstractBindSecurityGroupResponse { | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...t/java/org/cloudfoundry/client/v3/securitygroups/BindRunningSecurityGroupRequestTest.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,26 @@ | ||
package org.cloudfoundry.client.v3.securitygroups; | ||
|
||
import org.cloudfoundry.client.v3.ToManyRelationship; | ||
import org.cloudfoundry.client.v3.Relationship; | ||
import org.junit.Test; | ||
|
||
public class BindRunningSecurityGroupRequestTest { | ||
|
||
@Test(expected = IllegalStateException.class) | ||
public void noSecurityGroupId() { | ||
BindRunningSecurityGroupRequest.builder() | ||
.build(); | ||
} | ||
|
||
@Test | ||
public void valid() { | ||
BindRunningSecurityGroupRequest.builder() | ||
.securityGroupId("b85a788e-671f-4549-814d-e34cdb2f539a") | ||
.boundSpaces(ToManyRelationship.builder() | ||
.data(Relationship.builder() | ||
.id("space-guid-1") | ||
.build()) | ||
.build()) | ||
.build(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...t/java/org/cloudfoundry/client/v3/securitygroups/BindStagingSecurityGroupRequestTest.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,26 @@ | ||
package org.cloudfoundry.client.v3.securitygroups; | ||
|
||
import org.cloudfoundry.client.v3.ToManyRelationship; | ||
import org.cloudfoundry.client.v3.Relationship; | ||
import org.junit.Test; | ||
|
||
public class BindStagingSecurityGroupRequestTest { | ||
|
||
@Test(expected = IllegalStateException.class) | ||
public void noSecurityGroupId() { | ||
BindStagingSecurityGroupRequest.builder() | ||
.build(); | ||
} | ||
|
||
@Test | ||
public void valid() { | ||
BindStagingSecurityGroupRequest.builder() | ||
.securityGroupId("b85a788e-671f-4549-814d-e34cdb2f539a") | ||
.boundSpaces(ToManyRelationship.builder() | ||
.data(Relationship.builder() | ||
.id("space-guid-1") | ||
.build()) | ||
.build()) | ||
.build(); | ||
} | ||
} |