|
14 | 14 |
|
15 | 15 | package org.cloudfoundry.reactor.client.v3.securitygroups;
|
16 | 16 |
|
17 |
| -import org.cloudfoundry.client.v3.securitygroups.SecurityGroupsV3; |
| 17 | +import java.util.Map; |
| 18 | +import org.cloudfoundry.client.v3.securitygroups.BindRunningSecurityGroupRequest; |
| 19 | +import org.cloudfoundry.client.v3.securitygroups.BindRunningSecurityGroupResponse; |
| 20 | +import org.cloudfoundry.client.v3.securitygroups.BindStagingSecurityGroupRequest; |
| 21 | +import org.cloudfoundry.client.v3.securitygroups.BindStagingSecurityGroupResponse; |
18 | 22 | import org.cloudfoundry.client.v3.securitygroups.CreateSecurityGroupRequest;
|
19 | 23 | import org.cloudfoundry.client.v3.securitygroups.CreateSecurityGroupResponse;
|
20 |
| -import org.cloudfoundry.client.v3.securitygroups.GetSecurityGroupRequest; |
21 | 24 | import org.cloudfoundry.client.v3.securitygroups.DeleteSecurityGroupRequest;
|
22 |
| -import org.cloudfoundry.client.v3.securitygroups.UpdateSecurityGroupRequest; |
| 25 | +import org.cloudfoundry.client.v3.securitygroups.GetSecurityGroupRequest; |
23 | 26 | import org.cloudfoundry.client.v3.securitygroups.GetSecurityGroupResponse;
|
24 |
| -import org.cloudfoundry.client.v3.securitygroups.UpdateSecurityGroupResponse; |
25 |
| -import org.cloudfoundry.client.v3.servicebindings.ServiceBindingsV3; |
26 |
| -import org.cloudfoundry.client.v3.securitygroups.ListSecurityGroupsRequest; |
27 |
| -import org.cloudfoundry.client.v3.securitygroups.ListSecurityGroupsResponse; |
28 | 27 | import org.cloudfoundry.client.v3.securitygroups.ListRunningSecurityGroupsRequest;
|
29 | 28 | import org.cloudfoundry.client.v3.securitygroups.ListRunningSecurityGroupsResponse;
|
| 29 | +import org.cloudfoundry.client.v3.securitygroups.ListSecurityGroupsRequest; |
| 30 | +import org.cloudfoundry.client.v3.securitygroups.ListSecurityGroupsResponse; |
30 | 31 | import org.cloudfoundry.client.v3.securitygroups.ListStagingSecurityGroupsRequest;
|
31 | 32 | import org.cloudfoundry.client.v3.securitygroups.ListStagingSecurityGroupsResponse;
|
32 |
| -import org.cloudfoundry.client.v3.securitygroups.BindRunningSecurityGroupRequest; |
33 |
| -import org.cloudfoundry.client.v3.securitygroups.BindRunningSecurityGroupResponse; |
34 |
| -import org.cloudfoundry.client.v3.securitygroups.BindStagingSecurityGroupRequest; |
35 |
| -import org.cloudfoundry.client.v3.securitygroups.BindStagingSecurityGroupResponse; |
| 33 | +import org.cloudfoundry.client.v3.securitygroups.SecurityGroupsV3; |
36 | 34 | import org.cloudfoundry.client.v3.securitygroups.UnbindRunningSecurityGroupRequest;
|
37 | 35 | import org.cloudfoundry.client.v3.securitygroups.UnbindStagingSecurityGroupRequest;
|
| 36 | +import org.cloudfoundry.client.v3.securitygroups.UpdateSecurityGroupRequest; |
| 37 | +import org.cloudfoundry.client.v3.securitygroups.UpdateSecurityGroupResponse; |
| 38 | +import org.cloudfoundry.client.v3.servicebindings.ServiceBindingsV3; |
38 | 39 | import org.cloudfoundry.reactor.ConnectionContext;
|
39 | 40 | import org.cloudfoundry.reactor.TokenProvider;
|
40 | 41 | import org.cloudfoundry.reactor.client.v3.AbstractClientV3Operations;
|
41 | 42 | import reactor.core.publisher.Mono;
|
42 |
| -import java.util.Map; |
43 | 43 |
|
44 | 44 | /**
|
45 | 45 | * The Reactor-based implementation of {@link ServiceBindingsV3}
|
46 | 46 | */
|
47 | 47 | public final class ReactorSecurityGroupsV3 extends AbstractClientV3Operations
|
48 |
| - implements SecurityGroupsV3 { |
49 |
| - |
50 |
| - /** |
51 |
| - * Creates an instance |
52 |
| - * |
53 |
| - * @param connectionContext the {@link ConnectionContext} to use when communicating with the |
54 |
| - * server |
55 |
| - * @param root the root URI of the server. Typically something like |
56 |
| - * {@code https://api.run.pivotal.io}. |
57 |
| - * @param tokenProvider the {@link TokenProvider} to use when communicating with the server |
58 |
| - * @param requestTags map with custom http headers which will be added to web request |
59 |
| - */ |
60 |
| - public ReactorSecurityGroupsV3(ConnectionContext connectionContext, Mono<String> root, |
61 |
| - TokenProvider tokenProvider, Map<String, String> requestTags) { |
62 |
| - super(connectionContext, root, tokenProvider, requestTags); |
63 |
| - } |
64 |
| - |
65 |
| - @Override |
66 |
| - public Mono<CreateSecurityGroupResponse> create(CreateSecurityGroupRequest request) { |
67 |
| - return post(request, CreateSecurityGroupResponse.class, |
68 |
| - builder -> builder.pathSegment("security_groups")).checkpoint(); |
69 |
| - |
70 |
| - } |
71 |
| - |
72 |
| - @Override |
73 |
| - public Mono<GetSecurityGroupResponse> get(GetSecurityGroupRequest request) { |
74 |
| - return get(request, GetSecurityGroupResponse.class, builder -> builder |
75 |
| - .pathSegment("security_groups", request.getSecurityGroupId())) |
76 |
| - .checkpoint(); |
77 |
| - |
78 |
| - } |
79 |
| - |
80 |
| - @Override |
81 |
| - public Mono<ListSecurityGroupsResponse> list(ListSecurityGroupsRequest request) { |
82 |
| - return get(request, ListSecurityGroupsResponse.class, |
83 |
| - builder -> builder.pathSegment("security_groups")).checkpoint(); |
84 |
| - } |
85 |
| - |
86 |
| - @Override |
87 |
| - public Mono<UpdateSecurityGroupResponse> update(UpdateSecurityGroupRequest request) { |
88 |
| - return patch(request, UpdateSecurityGroupResponse.class, builder -> builder |
89 |
| - .pathSegment("security_groups", request.getSecurityGroupId())) |
90 |
| - .checkpoint(); |
91 |
| - } |
92 |
| - |
93 |
| - @Override |
94 |
| - public Mono<String> delete(DeleteSecurityGroupRequest request) { |
95 |
| - return delete(request, builder -> builder.pathSegment("security_groups", |
96 |
| - request.getSecurityGroupId())).checkpoint(); |
97 |
| - |
98 |
| - } |
99 |
| - |
100 |
| - @Override |
101 |
| - public Mono<BindRunningSecurityGroupResponse> bindRunningSecurityGroup( |
102 |
| - BindRunningSecurityGroupRequest request) { |
103 |
| - return post(request, BindRunningSecurityGroupResponse.class, |
104 |
| - builder -> builder.pathSegment("security_groups", |
105 |
| - request.getSecurityGroupId(), "relationships", |
106 |
| - "running_spaces")).checkpoint(); |
107 |
| - } |
108 |
| - |
109 |
| - @Override |
110 |
| - public Mono<BindStagingSecurityGroupResponse> bindStagingSecurityGroup( |
111 |
| - BindStagingSecurityGroupRequest request) { |
112 |
| - return post(request, BindStagingSecurityGroupResponse.class, |
113 |
| - builder -> builder.pathSegment("security_groups", |
114 |
| - request.getSecurityGroupId(), "relationships", |
115 |
| - "staging_spaces")).checkpoint(); |
116 |
| - } |
117 |
| - |
118 |
| - @Override |
119 |
| - public Mono<Void> unbindStagingSecurityGroup(UnbindStagingSecurityGroupRequest request) { |
120 |
| - return delete(request, Void.class, |
121 |
| - builder -> builder.pathSegment("security_groups", |
122 |
| - request.getSecurityGroupId(), "relationships", |
123 |
| - "staging_spaces", request.getSpaceId())) |
124 |
| - .checkpoint(); |
125 |
| - } |
126 |
| - |
127 |
| - @Override |
128 |
| - public Mono<Void> unbindRunningSecurityGroup(UnbindRunningSecurityGroupRequest request) { |
129 |
| - return delete(request, Void.class, |
130 |
| - builder -> builder.pathSegment("security_groups", |
131 |
| - request.getSecurityGroupId(), "relationships", |
132 |
| - "running_spaces", request.getSpaceId())) |
133 |
| - .checkpoint(); |
134 |
| - } |
135 |
| - |
136 |
| - @Override |
137 |
| - public Mono<ListRunningSecurityGroupsResponse> listRunning( |
138 |
| - ListRunningSecurityGroupsRequest request) { |
139 |
| - return get(request, ListRunningSecurityGroupsResponse.class, |
140 |
| - builder -> builder.pathSegment("spaces", request.getSpaceId(), |
141 |
| - "running_security_groups")).checkpoint(); |
142 |
| - } |
143 |
| - |
144 |
| - @Override |
145 |
| - public Mono<ListStagingSecurityGroupsResponse> listStaging( |
146 |
| - ListStagingSecurityGroupsRequest request) { |
147 |
| - return get(request, ListStagingSecurityGroupsResponse.class, |
148 |
| - builder -> builder.pathSegment("spaces", request.getSpaceId(), |
149 |
| - "staging_security_groups")).checkpoint(); |
150 |
| - } |
| 48 | + implements SecurityGroupsV3 { |
| 49 | + |
| 50 | + /** |
| 51 | + * Creates an instance |
| 52 | + * |
| 53 | + * @param connectionContext the {@link ConnectionContext} to use when communicating with the |
| 54 | + * server |
| 55 | + * @param root the root URI of the server. Typically something like |
| 56 | + * {@code https://api.run.pivotal.io}. |
| 57 | + * @param tokenProvider the {@link TokenProvider} to use when communicating with the server |
| 58 | + * @param requestTags map with custom http headers which will be added to web request |
| 59 | + */ |
| 60 | + public ReactorSecurityGroupsV3( |
| 61 | + ConnectionContext connectionContext, |
| 62 | + Mono<String> root, |
| 63 | + TokenProvider tokenProvider, |
| 64 | + Map<String, String> requestTags) { |
| 65 | + super(connectionContext, root, tokenProvider, requestTags); |
| 66 | + } |
| 67 | + |
| 68 | + @Override |
| 69 | + public Mono<CreateSecurityGroupResponse> create(CreateSecurityGroupRequest request) { |
| 70 | + return post( |
| 71 | + request, |
| 72 | + CreateSecurityGroupResponse.class, |
| 73 | + builder -> builder.pathSegment("security_groups")) |
| 74 | + .checkpoint(); |
| 75 | + } |
| 76 | + |
| 77 | + @Override |
| 78 | + public Mono<GetSecurityGroupResponse> get(GetSecurityGroupRequest request) { |
| 79 | + return get( |
| 80 | + request, |
| 81 | + GetSecurityGroupResponse.class, |
| 82 | + builder -> |
| 83 | + builder.pathSegment( |
| 84 | + "security_groups", request.getSecurityGroupId())) |
| 85 | + .checkpoint(); |
| 86 | + } |
| 87 | + |
| 88 | + @Override |
| 89 | + public Mono<ListSecurityGroupsResponse> list(ListSecurityGroupsRequest request) { |
| 90 | + return get( |
| 91 | + request, |
| 92 | + ListSecurityGroupsResponse.class, |
| 93 | + builder -> builder.pathSegment("security_groups")) |
| 94 | + .checkpoint(); |
| 95 | + } |
| 96 | + |
| 97 | + @Override |
| 98 | + public Mono<UpdateSecurityGroupResponse> update(UpdateSecurityGroupRequest request) { |
| 99 | + return patch( |
| 100 | + request, |
| 101 | + UpdateSecurityGroupResponse.class, |
| 102 | + builder -> |
| 103 | + builder.pathSegment( |
| 104 | + "security_groups", request.getSecurityGroupId())) |
| 105 | + .checkpoint(); |
| 106 | + } |
| 107 | + |
| 108 | + @Override |
| 109 | + public Mono<String> delete(DeleteSecurityGroupRequest request) { |
| 110 | + return delete( |
| 111 | + request, |
| 112 | + builder -> |
| 113 | + builder.pathSegment( |
| 114 | + "security_groups", request.getSecurityGroupId())) |
| 115 | + .checkpoint(); |
| 116 | + } |
| 117 | + |
| 118 | + @Override |
| 119 | + public Mono<BindRunningSecurityGroupResponse> bindRunningSecurityGroup( |
| 120 | + BindRunningSecurityGroupRequest request) { |
| 121 | + return post( |
| 122 | + request, |
| 123 | + BindRunningSecurityGroupResponse.class, |
| 124 | + builder -> |
| 125 | + builder.pathSegment( |
| 126 | + "security_groups", |
| 127 | + request.getSecurityGroupId(), |
| 128 | + "relationships", |
| 129 | + "running_spaces")) |
| 130 | + .checkpoint(); |
| 131 | + } |
| 132 | + |
| 133 | + @Override |
| 134 | + public Mono<BindStagingSecurityGroupResponse> bindStagingSecurityGroup( |
| 135 | + BindStagingSecurityGroupRequest request) { |
| 136 | + return post( |
| 137 | + request, |
| 138 | + BindStagingSecurityGroupResponse.class, |
| 139 | + builder -> |
| 140 | + builder.pathSegment( |
| 141 | + "security_groups", |
| 142 | + request.getSecurityGroupId(), |
| 143 | + "relationships", |
| 144 | + "staging_spaces")) |
| 145 | + .checkpoint(); |
| 146 | + } |
| 147 | + |
| 148 | + @Override |
| 149 | + public Mono<Void> unbindStagingSecurityGroup(UnbindStagingSecurityGroupRequest request) { |
| 150 | + return delete( |
| 151 | + request, |
| 152 | + Void.class, |
| 153 | + builder -> |
| 154 | + builder.pathSegment( |
| 155 | + "security_groups", |
| 156 | + request.getSecurityGroupId(), |
| 157 | + "relationships", |
| 158 | + "staging_spaces", |
| 159 | + request.getSpaceId())) |
| 160 | + .checkpoint(); |
| 161 | + } |
| 162 | + |
| 163 | + @Override |
| 164 | + public Mono<Void> unbindRunningSecurityGroup(UnbindRunningSecurityGroupRequest request) { |
| 165 | + return delete( |
| 166 | + request, |
| 167 | + Void.class, |
| 168 | + builder -> |
| 169 | + builder.pathSegment( |
| 170 | + "security_groups", |
| 171 | + request.getSecurityGroupId(), |
| 172 | + "relationships", |
| 173 | + "running_spaces", |
| 174 | + request.getSpaceId())) |
| 175 | + .checkpoint(); |
| 176 | + } |
| 177 | + |
| 178 | + @Override |
| 179 | + public Mono<ListRunningSecurityGroupsResponse> listRunning( |
| 180 | + ListRunningSecurityGroupsRequest request) { |
| 181 | + return get( |
| 182 | + request, |
| 183 | + ListRunningSecurityGroupsResponse.class, |
| 184 | + builder -> |
| 185 | + builder.pathSegment( |
| 186 | + "spaces", request.getSpaceId(), "running_security_groups")) |
| 187 | + .checkpoint(); |
| 188 | + } |
| 189 | + |
| 190 | + @Override |
| 191 | + public Mono<ListStagingSecurityGroupsResponse> listStaging( |
| 192 | + ListStagingSecurityGroupsRequest request) { |
| 193 | + return get( |
| 194 | + request, |
| 195 | + ListStagingSecurityGroupsResponse.class, |
| 196 | + builder -> |
| 197 | + builder.pathSegment( |
| 198 | + "spaces", request.getSpaceId(), "staging_security_groups")) |
| 199 | + .checkpoint(); |
| 200 | + } |
151 | 201 | }
|
0 commit comments