Skip to content

Commit

Permalink
Merge branch 'uaa-groups'
Browse files Browse the repository at this point in the history
  • Loading branch information
nebhale committed Jun 18, 2016
2 parents 8fa35f4 + 5ab201b commit faef15b
Show file tree
Hide file tree
Showing 36 changed files with 1,511 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Builder;
import org.cloudfoundry.reactor.uaa.authorizations.ReactorAuthorizations;
import org.cloudfoundry.reactor.uaa.groups.ReactorGroups;
import org.cloudfoundry.reactor.uaa.identityproviders.ReactorIdentityProviders;
import org.cloudfoundry.reactor.uaa.identityzones.ReactorIdentityZones;
import org.cloudfoundry.reactor.uaa.tokens.ReactorTokens;
Expand All @@ -27,6 +28,7 @@
import org.cloudfoundry.reactor.util.ConnectionContextSupplier;
import org.cloudfoundry.uaa.UaaClient;
import org.cloudfoundry.uaa.authorizations.Authorizations;
import org.cloudfoundry.uaa.groups.Groups;
import org.cloudfoundry.uaa.identityproviders.IdentityProviders;
import org.cloudfoundry.uaa.identityzones.IdentityZones;
import org.cloudfoundry.uaa.tokens.Tokens;
Expand All @@ -41,6 +43,8 @@ public final class ReactorUaaClient implements UaaClient {

private final Authorizations authorizations;

private final Groups groups;

private final IdentityProviders identityProviders;

private final IdentityZones identityZones;
Expand All @@ -57,6 +61,7 @@ public final class ReactorUaaClient implements UaaClient {

ReactorUaaClient(AuthorizationProvider authorizationProvider, HttpClient httpClient, ObjectMapper objectMapper, Mono<String> root) {
this.authorizations = new ReactorAuthorizations(authorizationProvider, httpClient, objectMapper, root);
this.groups = new ReactorGroups(authorizationProvider, httpClient, objectMapper, root);
this.identityProviders = new ReactorIdentityProviders(authorizationProvider, httpClient, objectMapper, root);
this.identityZones = new ReactorIdentityZones(authorizationProvider, httpClient, objectMapper, root);
this.tokens = new ReactorTokens(authorizationProvider, httpClient, objectMapper, root);
Expand All @@ -68,6 +73,11 @@ public Authorizations authorizations() {
return this.authorizations;
}

@Override
public Groups groups() {
return this.groups;
}

@Override
public IdentityProviders identityProviders() {
return this.identityProviders;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright 2013-2016 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.uaa.groups;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.cloudfoundry.reactor.uaa.AbstractUaaOperations;
import org.cloudfoundry.reactor.util.AuthorizationProvider;
import org.cloudfoundry.uaa.groups.CreateGroupRequest;
import org.cloudfoundry.uaa.groups.CreateGroupResponse;
import org.cloudfoundry.uaa.groups.DeleteGroupRequest;
import org.cloudfoundry.uaa.groups.DeleteGroupResponse;
import org.cloudfoundry.uaa.groups.GetGroupRequest;
import org.cloudfoundry.uaa.groups.GetGroupResponse;
import org.cloudfoundry.uaa.groups.Groups;
import org.cloudfoundry.uaa.groups.ListGroupsRequest;
import org.cloudfoundry.uaa.groups.ListGroupsResponse;
import org.cloudfoundry.uaa.groups.UpdateGroupRequest;
import org.cloudfoundry.uaa.groups.UpdateGroupResponse;
import reactor.core.publisher.Mono;
import reactor.io.netty.http.HttpClient;

/**
* The Reactor-based implementation of {@link Groups}
*/
public class ReactorGroups extends AbstractUaaOperations implements Groups {

/**
* Creates an instance
*
* @param authorizationProvider the {@link AuthorizationProvider} to use when communicating with the server
* @param httpClient the {@link HttpClient} to use when communicating with the server
* @param objectMapper the {@link ObjectMapper} to use when communicating with the server
* @param root the root URI of the server. Typically something like {@code https://uaa.run.pivotal.io}.
*/
public ReactorGroups(AuthorizationProvider authorizationProvider, HttpClient httpClient, ObjectMapper objectMapper, Mono<String> root) {
super(authorizationProvider, httpClient, objectMapper, root);
}

@Override
public Mono<CreateGroupResponse> create(CreateGroupRequest request) {
return post(request, CreateGroupResponse.class, builder -> builder.pathSegment("Groups"));
}

@Override
public Mono<DeleteGroupResponse> delete(DeleteGroupRequest request) {
return delete(request, DeleteGroupResponse.class, builder -> builder.pathSegment("Groups", request.getGroupId()));
}

@Override
public Mono<GetGroupResponse> get(GetGroupRequest request) {
return get(request, GetGroupResponse.class, builder -> builder.pathSegment("Groups", request.getGroupId()));
}

@Override
public Mono<ListGroupsResponse> list(ListGroupsRequest request) {
return get(request, ListGroupsResponse.class, builder -> builder.pathSegment("Groups"));
}

@Override
public Mono<UpdateGroupResponse> update(UpdateGroupRequest request) {
return put(request, UpdateGroupResponse.class, builder -> builder.pathSegment("Groups", request.getGroupId()));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public void authorizations() {
assertNotNull(this.client.authorizations());
}

@Test
public void groups() {
assertNotNull(this.client.groups());
}

@Test
public void identityProviders() {
assertNotNull(this.client.identityProviders());
Expand Down
Loading

0 comments on commit faef15b

Please sign in to comment.