Skip to content

Commit 1f0fb9f

Browse files
author
YangSen-qn
committed
pfop api
1 parent 6252399 commit 1f0fb9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+12449
-15
lines changed

src/main/java/com/qiniu/audit/apis/ApiQueryLog.java

Lines changed: 641 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 311 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,311 @@
1+
package com.qiniu.iam.apis;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import com.qiniu.common.Constants;
5+
import com.qiniu.common.QiniuException;
6+
import com.qiniu.http.Client;
7+
import com.qiniu.http.MethodType;
8+
import com.qiniu.storage.Api;
9+
import com.qiniu.util.Json;
10+
11+
12+
/**
13+
* 新建用户分组
14+
*/
15+
public class ApiCreateGroup extends Api {
16+
17+
/**
18+
* api 构建函数
19+
*
20+
* @param client 请求 Client
21+
*/
22+
public ApiCreateGroup(Client client) {
23+
super(client);
24+
}
25+
26+
/**
27+
* api 构建函数
28+
*
29+
* @param client 请求 Client
30+
* @param config 请求流程的配置信息
31+
**/
32+
public ApiCreateGroup(Client client, Config config) {
33+
super(client, config);
34+
}
35+
36+
/**
37+
* 发起请求
38+
*
39+
* @param request 请求对象【必须】
40+
* @return 响应对象
41+
* @throws QiniuException 请求异常
42+
*/
43+
public Response request(Request request) throws QiniuException {
44+
return new Response(requestWithInterceptor(request));
45+
}
46+
47+
/**
48+
* 请求信息
49+
*/
50+
public static class Request extends Api.Request {
51+
52+
/**
53+
* 创建用户分组参数
54+
*/
55+
private CreateGroupParam data;
56+
57+
/**
58+
* 请求构造函数
59+
*
60+
* @param urlPrefix 请求 scheme + host 【可选】
61+
* 若为空则会直接从 HostProvider 中获取
62+
* @param data 创建用户分组参数 【必须】
63+
*/
64+
public Request(String urlPrefix, CreateGroupParam data) {
65+
super(urlPrefix);
66+
this.setMethod(MethodType.POST);
67+
this.setAuthType(AuthTypeQiniu);
68+
this.data = data;
69+
}
70+
71+
@Override
72+
protected void prepareToRequest() throws QiniuException {
73+
if (this.data == null) {
74+
throw new QiniuException(new NullPointerException("data can't empty"));
75+
}
76+
77+
super.prepareToRequest();
78+
}
79+
80+
@Override
81+
protected void buildPath() throws QiniuException {
82+
addPathSegment("iam/v1/groups");
83+
super.buildPath();
84+
}
85+
86+
@Override
87+
protected void buildQuery() throws QiniuException {
88+
89+
super.buildQuery();
90+
}
91+
92+
@Override
93+
protected void buildHeader() throws QiniuException {
94+
95+
super.buildHeader();
96+
}
97+
98+
@Override
99+
protected void buildBodyInfo() throws QiniuException {
100+
byte[] body = Json.encode(this.data).getBytes(Constants.UTF_8);
101+
this.setBody(body, 0, body.length, Client.JsonMime);
102+
103+
super.buildBodyInfo();
104+
}
105+
106+
/**
107+
* 创建用户分组参数
108+
*/
109+
public static final class CreateGroupParam {
110+
111+
/**
112+
* 用户分组别名,由 `A-Za-z0-9` 组成
113+
*/
114+
@SerializedName("alias")
115+
private String alias;
116+
117+
/**
118+
* 用户分组描述
119+
*/
120+
@SerializedName("description")
121+
private String description;
122+
123+
/**
124+
* 设置变量值
125+
*
126+
* @param alias 用户分组别名,由 `A-Za-z0-9` 组成
127+
* @return Request
128+
*/
129+
public CreateGroupParam setAlias(String alias) {
130+
this.alias = alias;
131+
return this;
132+
}
133+
134+
/**
135+
* 设置变量值
136+
*
137+
* @param description 用户分组描述
138+
* @return Request
139+
*/
140+
public CreateGroupParam setDescription(String description) {
141+
this.description = description;
142+
return this;
143+
}
144+
}
145+
}
146+
147+
/**
148+
* 响应信息
149+
*/
150+
public static class Response extends Api.Response {
151+
152+
/**
153+
* 返回的用户分组响应
154+
*/
155+
private CreatedGroupResp data;
156+
157+
protected Response(com.qiniu.http.Response response) throws QiniuException {
158+
super(response);
159+
160+
this.data = Json.decode(response.bodyString(), CreatedGroupResp.class);
161+
}
162+
163+
/**
164+
* 响应信息
165+
*
166+
* @return CreatedGroupResp
167+
*/
168+
public CreatedGroupResp getData() {
169+
return this.data;
170+
}
171+
172+
/**
173+
* 返回的用户分组信息
174+
*/
175+
public static final class CreatedGroupData {
176+
177+
/**
178+
* 记录 ID
179+
*/
180+
@SerializedName("id")
181+
private String id;
182+
183+
/**
184+
* 根用户 uid
185+
*/
186+
@SerializedName("root_uid")
187+
private Integer rootUid;
188+
189+
/**
190+
* 用户分组别名
191+
*/
192+
@SerializedName("alias")
193+
private String alias;
194+
195+
/**
196+
* 用户分组描述
197+
*/
198+
@SerializedName("description")
199+
private String description;
200+
201+
/**
202+
* 用户分组是否启用
203+
*/
204+
@SerializedName("enabled")
205+
private Boolean enabled;
206+
207+
/**
208+
* 用户分组创建时间
209+
*/
210+
@SerializedName("created_at")
211+
private String createdAt;
212+
213+
/**
214+
* 用户分组上次更新时间
215+
*/
216+
@SerializedName("updated_at")
217+
private String updatedAt;
218+
219+
/**
220+
* 获取变量值
221+
* 记录 ID
222+
*
223+
* @return id
224+
*/
225+
public String getId() {
226+
return this.id;
227+
}
228+
229+
/**
230+
* 获取变量值
231+
* 根用户 uid
232+
*
233+
* @return rootUid
234+
*/
235+
public Integer getRootUid() {
236+
return this.rootUid;
237+
}
238+
239+
/**
240+
* 获取变量值
241+
* 用户分组别名
242+
*
243+
* @return alias
244+
*/
245+
public String getAlias() {
246+
return this.alias;
247+
}
248+
249+
/**
250+
* 获取变量值
251+
* 用户分组描述
252+
*
253+
* @return description
254+
*/
255+
public String getDescription() {
256+
return this.description;
257+
}
258+
259+
/**
260+
* 获取变量值
261+
* 用户分组是否启用
262+
*
263+
* @return enabled
264+
*/
265+
public Boolean getEnabled() {
266+
return this.enabled;
267+
}
268+
269+
/**
270+
* 获取变量值
271+
* 用户分组创建时间
272+
*
273+
* @return createdAt
274+
*/
275+
public String getCreatedAt() {
276+
return this.createdAt;
277+
}
278+
279+
/**
280+
* 获取变量值
281+
* 用户分组上次更新时间
282+
*
283+
* @return updatedAt
284+
*/
285+
public String getUpdatedAt() {
286+
return this.updatedAt;
287+
}
288+
}
289+
/**
290+
* 返回的用户分组响应
291+
*/
292+
public static final class CreatedGroupResp {
293+
294+
/**
295+
* 用户分组信息
296+
*/
297+
@SerializedName("data")
298+
private CreatedGroupData data;
299+
300+
/**
301+
* 获取变量值
302+
* 用户分组信息
303+
*
304+
* @return data
305+
*/
306+
public CreatedGroupData getData() {
307+
return this.data;
308+
}
309+
}
310+
}
311+
}

0 commit comments

Comments
 (0)