Skip to content

Commit 1b0dbba

Browse files
Locharla, SandeepLocharla, Sandeep
authored andcommitted
CSTACKEX-50: Included changes for Delete storage pool and modified some methods according to the latest design
1 parent bd107b3 commit 1b0dbba

File tree

8 files changed

+614
-137
lines changed

8 files changed

+614
-137
lines changed

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/SANFeignClient.java

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,33 @@
1818
*/
1919
package org.apache.cloudstack.storage.feign.client;
2020

21+
import feign.QueryMap;
2122
import org.apache.cloudstack.storage.feign.model.Igroup;
23+
import org.apache.cloudstack.storage.feign.model.IscsiService;
2224
import org.apache.cloudstack.storage.feign.model.Lun;
2325
import org.apache.cloudstack.storage.feign.model.LunMap;
2426
import org.apache.cloudstack.storage.feign.model.response.OntapResponse;
2527
import feign.Headers;
2628
import feign.Param;
2729
import feign.RequestLine;
2830
import java.net.URI;
31+
import java.util.Map;
2932

3033
//TODO: Proper URLs should be added in the RequestLine annotations below
3134
public interface SANFeignClient {
35+
// iSCSI Service APIs
36+
@RequestLine("GET /api/protocols/san/iscsi/services")
37+
@Headers({"Authorization: {authHeader}"})
38+
OntapResponse<IscsiService> getIscsiServices(@Param("authHeader") String authHeader, @QueryMap Map<String, Object> queryMap);
3239

3340
// LUN Operation APIs
34-
@RequestLine("POST /")
35-
@Headers({"Authorization: {authHeader}", "return_records: {returnRecords}"})
36-
OntapResponse<Lun> createLun(@Param("authHeader") String authHeader,
37-
@Param("returnRecords") boolean returnRecords,
38-
Lun lun);
41+
@RequestLine("POST /api/storage/luns?return_records={returnRecords}")
42+
@Headers({"Authorization: {authHeader}"})
43+
OntapResponse<Lun> createLun(@Param("authHeader") String authHeader, @Param("returnRecords") boolean returnRecords, Lun lun);
3944

40-
@RequestLine("GET /")
45+
@RequestLine("GET /api/storage/luns")
4146
@Headers({"Authorization: {authHeader}"})
42-
OntapResponse<Lun> getLunResponse(@Param("authHeader") String authHeader);
47+
OntapResponse<Lun> getLunResponse(@Param("authHeader") String authHeader, @QueryMap Map<String, Object> queryMap);
4348

4449
@RequestLine("GET /{uuid}")
4550
@Headers({"Authorization: {authHeader}"})
@@ -54,36 +59,35 @@ OntapResponse<Lun> createLun(@Param("authHeader") String authHeader,
5459
void deleteLun(@Param("authHeader") String authHeader, @Param("uuid") String uuid);
5560

5661
// iGroup Operation APIs
57-
@RequestLine("POST /")
58-
@Headers({"Authorization: {authHeader}", "return_records: {returnRecords}"})
59-
OntapResponse<Igroup> createIgroup(@Param("authHeader") String authHeader,
60-
@Param("returnRecords") boolean returnRecords,
61-
Igroup igroupRequest);
62+
@RequestLine("POST /api/protocols/san/igroups?return_records={returnRecords}")
63+
@Headers({"Authorization: {authHeader}"})
64+
OntapResponse<Igroup> createIgroup(@Param("authHeader") String authHeader, @Param("returnRecords") boolean returnRecords, Igroup igroupRequest);
6265

63-
@RequestLine("GET /")
64-
@Headers({"Authorization: {authHeader}"}) // TODO: Check this again, uuid should be part of the path?
65-
OntapResponse<Igroup> getIgroupResponse(@Param("authHeader") String authHeader, @Param("uuid") String uuid);
66+
@RequestLine("GET /api/protocols/san/igroups")
67+
@Headers({"Authorization: {authHeader}"})
68+
OntapResponse<Igroup> getIgroupResponse(@Param("authHeader") String authHeader, @QueryMap Map<String, Object> queryMap);
6669

6770
@RequestLine("GET /{uuid}")
6871
@Headers({"Authorization: {authHeader}"})
6972
Igroup getIgroupByUUID(@Param("authHeader") String authHeader, @Param("uuid") String uuid);
7073

71-
@RequestLine("DELETE /{uuid}")
74+
@RequestLine("DELETE /api/protocols/san/igroups/{uuid}")
7275
@Headers({"Authorization: {authHeader}"})
73-
void deleteIgroup(@Param("baseUri") URI baseUri, @Param("authHeader") String authHeader, @Param("uuid") String uuid);
76+
void deleteIgroup(@Param("authHeader") String authHeader, @Param("uuid") String uuid);
7477

7578
// LUN Maps Operation APIs
76-
@RequestLine("POST /")
77-
@Headers({"Authorization: {authHeader}"})
78-
OntapResponse<LunMap> createLunMap(@Param("authHeader") String authHeader, LunMap lunMap);
79+
@RequestLine("POST /api/protocols/san/lun-maps")
80+
@Headers({"Authorization: {authHeader}", "return_records: {returnRecords}"})
81+
OntapResponse<LunMap> createLunMap(@Param("authHeader") String authHeader, @Param("returnRecords") boolean returnRecords, LunMap lunMap);
82+
7983

80-
@RequestLine("GET /")
84+
@RequestLine("GET /api/protocols/san/lun-maps")
8185
@Headers({"Authorization: {authHeader}"})
82-
OntapResponse<LunMap> getLunMapResponse(@Param("authHeader") String authHeader);
86+
OntapResponse<LunMap> getLunMapResponse(@Param("authHeader") String authHeader, @QueryMap Map<String, Object> queryMap);
8387

84-
@RequestLine("DELETE /{lunUuid}/{igroupUuid}")
88+
@RequestLine("DELETE /api/protocols/san/lun-maps/{lunUuid}/{igroupUuid}")
8589
@Headers({"Authorization: {authHeader}"})
8690
void deleteLunMap(@Param("authHeader") String authHeader,
87-
@Param("lunUuid") String lunUuid,
88-
@Param("igroupUuid") String igroupUuid);
91+
@Param("lunUuid") String lunUUID,
92+
@Param("igroupUuid") String igroupUUID);
8993
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.cloudstack.storage.feign.model;
21+
22+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
23+
import com.fasterxml.jackson.annotation.JsonInclude;
24+
import com.fasterxml.jackson.annotation.JsonProperty;
25+
26+
27+
/**
28+
* An iSCSI service defines the properties of the iSCSI target for an SVM.
29+
*/
30+
@JsonIgnoreProperties(ignoreUnknown = true)
31+
@JsonInclude(JsonInclude.Include.NON_NULL)
32+
public class IscsiService {
33+
@JsonProperty("enabled")
34+
private Boolean enabled = null;
35+
36+
@JsonProperty("svm")
37+
private Svm svm = null;
38+
39+
@JsonProperty("target")
40+
private IscsiServiceTarget target = null;
41+
42+
public Boolean isEnabled() {
43+
return enabled;
44+
}
45+
46+
public void setEnabled(Boolean enabled) {
47+
this.enabled = enabled;
48+
}
49+
50+
public Svm getSvm() {
51+
return svm;
52+
}
53+
54+
public void setSvm(Svm svm) {
55+
this.svm = svm;
56+
}
57+
58+
public IscsiServiceTarget getTarget() {
59+
return target;
60+
}
61+
62+
public void setTarget(IscsiServiceTarget target) {
63+
this.target = target;
64+
}
65+
66+
@Override
67+
public String toString() {
68+
return "IscsiService{" +
69+
"enabled=" + enabled +
70+
", svm=" + svm +
71+
", target=" + target +
72+
'}';
73+
}
74+
75+
/**
76+
* iSCSI target information
77+
*/
78+
@JsonIgnoreProperties(ignoreUnknown = true)
79+
@JsonInclude(JsonInclude.Include.NON_NULL)
80+
public static class IscsiServiceTarget {
81+
@JsonProperty("alias")
82+
private String alias = null;
83+
84+
@JsonProperty("name")
85+
private String name = null;
86+
87+
public String getAlias() {
88+
return alias;
89+
}
90+
91+
public void setAlias(String alias) {
92+
this.alias = alias;
93+
}
94+
95+
public String getName() {
96+
return name;
97+
}
98+
99+
public void setName(String name) {
100+
this.name = name;
101+
}
102+
103+
@Override
104+
public String toString() {
105+
return "IscsiServiceTarget{" +
106+
"alias='" + alias + '\'' +
107+
", name='" + name + '\'' +
108+
'}';
109+
}
110+
}
111+
}

0 commit comments

Comments
 (0)