-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding security groups v3 create api
adding create security group impl and tests adding get security group api and tests adding get security group impl + test adding list security groups impl + api adding update security group api adding update security group api v3 impl adding security groups delete api v3 impl and tests adding bind running/staging security group v3 api adding bind impl adding unbind security group adding list running/staging api and tests adding create security group test adding integration tests adding integration tests fixing setup/teardown fixing integration tests refactoring integration tests
- Loading branch information
1 parent
4a8295b
commit 198c709
Showing
58 changed files
with
3,186 additions
and
10 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
151 changes: 151 additions & 0 deletions
151
.../main/java/org/cloudfoundry/reactor/client/v3/securitygroups/ReactorSecurityGroupsV3.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,151 @@ | ||
/* | ||
* Copyright 2013-2023 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.reactor.client.v3.securitygroups; | ||
|
||
import org.cloudfoundry.client.v3.securitygroups.SecurityGroupsV3; | ||
import org.cloudfoundry.client.v3.securitygroups.CreateSecurityGroupRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.CreateSecurityGroupResponse; | ||
import org.cloudfoundry.client.v3.securitygroups.GetSecurityGroupRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.DeleteSecurityGroupRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.UpdateSecurityGroupRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.GetSecurityGroupResponse; | ||
import org.cloudfoundry.client.v3.securitygroups.UpdateSecurityGroupResponse; | ||
import org.cloudfoundry.client.v3.servicebindings.ServiceBindingsV3; | ||
import org.cloudfoundry.client.v3.securitygroups.ListSecurityGroupsRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.ListSecurityGroupsResponse; | ||
import org.cloudfoundry.client.v3.securitygroups.ListRunningSecurityGroupsRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.ListRunningSecurityGroupsResponse; | ||
import org.cloudfoundry.client.v3.securitygroups.ListStagingSecurityGroupsRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.ListStagingSecurityGroupsResponse; | ||
import org.cloudfoundry.client.v3.securitygroups.BindRunningSecurityGroupRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.BindRunningSecurityGroupResponse; | ||
import org.cloudfoundry.client.v3.securitygroups.BindStagingSecurityGroupRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.BindStagingSecurityGroupResponse; | ||
import org.cloudfoundry.client.v3.securitygroups.UnbindRunningSecurityGroupRequest; | ||
import org.cloudfoundry.client.v3.securitygroups.UnbindStagingSecurityGroupRequest; | ||
import org.cloudfoundry.reactor.ConnectionContext; | ||
import org.cloudfoundry.reactor.TokenProvider; | ||
import org.cloudfoundry.reactor.client.v3.AbstractClientV3Operations; | ||
import reactor.core.publisher.Mono; | ||
import java.util.Map; | ||
|
||
/** | ||
* The Reactor-based implementation of {@link ServiceBindingsV3} | ||
*/ | ||
public final class ReactorSecurityGroupsV3 extends AbstractClientV3Operations | ||
implements SecurityGroupsV3 { | ||
|
||
/** | ||
* Creates an instance | ||
* | ||
* @param connectionContext the {@link ConnectionContext} to use when communicating with the | ||
* server | ||
* @param root the root URI of the server. Typically something like | ||
* {@code https://api.run.pivotal.io}. | ||
* @param tokenProvider the {@link TokenProvider} to use when communicating with the server | ||
* @param requestTags map with custom http headers which will be added to web request | ||
*/ | ||
public ReactorSecurityGroupsV3(ConnectionContext connectionContext, Mono<String> root, | ||
TokenProvider tokenProvider, Map<String, String> requestTags) { | ||
super(connectionContext, root, tokenProvider, requestTags); | ||
} | ||
|
||
@Override | ||
public Mono<CreateSecurityGroupResponse> create(CreateSecurityGroupRequest request) { | ||
return post(request, CreateSecurityGroupResponse.class, | ||
builder -> builder.pathSegment("security_groups")).checkpoint(); | ||
|
||
} | ||
|
||
@Override | ||
public Mono<GetSecurityGroupResponse> get(GetSecurityGroupRequest request) { | ||
return get(request, GetSecurityGroupResponse.class, builder -> builder | ||
.pathSegment("security_groups", request.getSecurityGroupId())) | ||
.checkpoint(); | ||
|
||
} | ||
|
||
@Override | ||
public Mono<ListSecurityGroupsResponse> list(ListSecurityGroupsRequest request) { | ||
return get(request, ListSecurityGroupsResponse.class, | ||
builder -> builder.pathSegment("security_groups")).checkpoint(); | ||
} | ||
|
||
@Override | ||
public Mono<UpdateSecurityGroupResponse> update(UpdateSecurityGroupRequest request) { | ||
return patch(request, UpdateSecurityGroupResponse.class, builder -> builder | ||
.pathSegment("security_groups", request.getSecurityGroupId())) | ||
.checkpoint(); | ||
} | ||
|
||
@Override | ||
public Mono<String> delete(DeleteSecurityGroupRequest request) { | ||
return delete(request, builder -> builder.pathSegment("security_groups", | ||
request.getSecurityGroupId())).checkpoint(); | ||
|
||
} | ||
|
||
@Override | ||
public Mono<BindRunningSecurityGroupResponse> bindRunningSecurityGroup( | ||
BindRunningSecurityGroupRequest request) { | ||
return post(request, BindRunningSecurityGroupResponse.class, | ||
builder -> builder.pathSegment("security_groups", | ||
request.getSecurityGroupId(), "relationships", | ||
"running_spaces")).checkpoint(); | ||
} | ||
|
||
@Override | ||
public Mono<BindStagingSecurityGroupResponse> bindStagingSecurityGroup( | ||
BindStagingSecurityGroupRequest request) { | ||
return post(request, BindStagingSecurityGroupResponse.class, | ||
builder -> builder.pathSegment("security_groups", | ||
request.getSecurityGroupId(), "relationships", | ||
"staging_spaces")).checkpoint(); | ||
} | ||
|
||
@Override | ||
public Mono<Void> unbindStagingSecurityGroup(UnbindStagingSecurityGroupRequest request) { | ||
return delete(request, Void.class, | ||
builder -> builder.pathSegment("security_groups", | ||
request.getSecurityGroupId(), "relationships", | ||
"staging_spaces", request.getSpaceId())) | ||
.checkpoint(); | ||
} | ||
|
||
@Override | ||
public Mono<Void> unbindRunningSecurityGroup(UnbindRunningSecurityGroupRequest request) { | ||
return delete(request, Void.class, | ||
builder -> builder.pathSegment("security_groups", | ||
request.getSecurityGroupId(), "relationships", | ||
"running_spaces", request.getSpaceId())) | ||
.checkpoint(); | ||
} | ||
|
||
@Override | ||
public Mono<ListRunningSecurityGroupsResponse> listRunning( | ||
ListRunningSecurityGroupsRequest request) { | ||
return get(request, ListRunningSecurityGroupsResponse.class, | ||
builder -> builder.pathSegment("spaces", request.getSpaceId(), | ||
"running_security_groups")).checkpoint(); | ||
} | ||
|
||
@Override | ||
public Mono<ListStagingSecurityGroupsResponse> listStaging( | ||
ListStagingSecurityGroupsRequest request) { | ||
return get(request, ListStagingSecurityGroupsResponse.class, | ||
builder -> builder.pathSegment("spaces", request.getSpaceId(), | ||
"staging_security_groups")).checkpoint(); | ||
} | ||
} |
Oops, something went wrong.