File tree Expand file tree Collapse file tree 4 files changed +110
-0
lines changed
src/main/java/cloud/dnation/hetznerclient Expand file tree Collapse file tree 4 files changed +110
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2022 https://dnation.cloud
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package cloud .dnation .hetznerclient ;
17+
18+ import com .google .gson .annotations .SerializedName ;
19+ import lombok .Data ;
20+
21+ @ Data
22+ public class GetPlacementGroupByIdResponse {
23+ @ SerializedName ("placement_group" )
24+ private PlacementGroupDetail placementGroup ;
25+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2022 https://dnation.cloud
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package cloud .dnation .hetznerclient ;
17+
18+
19+ import com .google .gson .annotations .SerializedName ;
20+ import lombok .Data ;
21+ import lombok .EqualsAndHashCode ;
22+
23+ import java .util .List ;
24+
25+ @ EqualsAndHashCode (callSuper = true )
26+ @ Data
27+ public class GetPlacementGroupsResponse extends AbstractSearchResponse {
28+ @ SerializedName ("placement_groups" )
29+ private List <PlacementGroupDetail > placementGroups ;
30+ }
Original file line number Diff line number Diff line change @@ -182,6 +182,27 @@ Call<GetServersBySelectorResponse> getServersBySelector(@Query("label_selector")
182182 @ GET ("/v1/networks/{id}" )
183183 Call <GetNetworkByIdResponse > getNetworkById (@ Path ("id" ) int id );
184184
185+ /**
186+ * Get placement groups, optionally filtered using label expression.
187+ *
188+ * @param selector Can be used to filter resources by labels.
189+ * The response will only contain resources matching the label selector.
190+ * @return returns matching placement groups.
191+ * see <a href="https://docs.hetzner.cloud/#placement-groups-get-all-placementgroups">API reference</a>
192+ */
193+ @ GET ("/v1/placement_groups" )
194+ Call <GetPlacementGroupsResponse > getPlacementGroups (@ Query ("label_selector" ) String selector );
195+
196+ /**
197+ * Get placement group detail based on provided placement group ID.
198+ *
199+ * @param id placement group ID
200+ * @return details of placement group
201+ * see <a href="https://docs.hetzner.cloud/#placement-groups-get-a-placementgroup">API reference</a>
202+ */
203+ @ GET ("/v1/placement_groups/{id}" )
204+ Call <GetPlacementGroupByIdResponse > getPlacementGroupById (@ Path ("id" ) int id );
205+
185206 /**
186207 * Get all Primary IP objects.
187208 *
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2022 https://dnation.cloud
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package cloud .dnation .hetznerclient ;
17+
18+ import lombok .Data ;
19+ import lombok .EqualsAndHashCode ;
20+
21+ import java .util .ArrayList ;
22+ import java .util .HashMap ;
23+ import java .util .List ;
24+ import java .util .Map ;
25+
26+ @ Data
27+ @ EqualsAndHashCode (callSuper = true )
28+ public class PlacementGroupDetail extends IdentifiableResource {
29+ private String created ;
30+ private Map <String , String > labels = new HashMap <>();
31+ private String name ;
32+ private List <Integer > servers = new ArrayList <>();
33+ private String type = "spread" ;
34+ }
You can’t perform that action at this time.
0 commit comments