本文整理汇总了Java中org.scribe.model.Verb.GET属性的典型用法代码示例。如果您正苦于以下问题:Java Verb.GET属性的具体用法?Java Verb.GET怎么用?Java Verb.GET使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.scribe.model.Verb
的用法示例。
在下文中一共展示了Verb.GET属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClusters
/**
* 获取当前用户所有集群信息
*
* @return
* @throws Fit2CloudException
*/
public List<Cluster> getClusters() throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET, restApiEndpoint + "/clusters");
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
Type listType = new TypeToken<ArrayList<Cluster>>() {
}.getType();
return new GsonBuilder().create().fromJson(responseString, listType);
} else {
throw new Fit2CloudException(responseString);
}
}
示例2: getAuthorizationUrl
@Override
public String getAuthorizationUrl(OAuthConfig config, String state) {
// http://wiki.connect.qq.com/%E4%BD%BF%E7%94%A8authorization_code%E8%8E%B7%E5%8F%96access_token
final String authorizationEndpoint = "https://graph.qq.com/oauth2.0/authorize";
OAuthRequest request = new OAuthRequest(Verb.GET, authorizationEndpoint);
request.addQuerystringParameter("response_type", "code");
request.addQuerystringParameter(OAuthConstants.CLIENT_ID, config.getApiKey());
request.addQuerystringParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
request.addQuerystringParameter(OAuthConstants.REDIRECT_URI, config.getCallback());
request.addQuerystringParameter("state", state);
if (config.hasScope()) {
request.addQuerystringParameter(OAuthConstants.SCOPE, config.getScope());
}
return request.getCompleteUrl();
}
示例3: getClusterRoles
/**
* 获取指定集群下所有虚机组信息
*
* @param clusterId
* 集群ID
* @return
* @throws Fit2CloudException
*/
public List<ClusterRole> getClusterRoles(long clusterId) throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET, restApiEndpoint + "/cluster/" + clusterId + "/roles");
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
Type listType = new TypeToken<ArrayList<ClusterRole>>() {
}.getType();
return new GsonBuilder().create().fromJson(responseString, listType);
} else {
throw new Fit2CloudException(responseString);
}
}
示例4: getLoggingsByEventId
/**
* 获取事件返回的所有日志信息(如执行脚本事件)
*
* @param eventId
* 事件ID
* @return
* @throws Fit2CloudException
*/
public List<Logging> getLoggingsByEventId(long eventId) throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET, getLoggingUrl + eventId);
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
Type listType = new TypeToken<ArrayList<Logging>>() {
}.getType();
return new GsonBuilder().create().fromJson(responseString, listType);
} else {
throw new Fit2CloudException(responseString);
}
}
示例5: getClusterParams
/**
* 获取指定集群的集群参数
*
* @param clusterId
* 集群ID
* @return
* @throws Fit2CloudException
*/
public List<ClusterParam> getClusterParams(long clusterId) throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET, restApiEndpoint + "/cluster/" + clusterId + "/params");
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
Type listType = new TypeToken<ArrayList<ClusterParam>>() {
}.getType();
return new GsonBuilder().create().fromJson(responseString, listType);
} else {
throw new Fit2CloudException(responseString);
}
}
示例6: getServiceCatalogOrders
/**
* 获取服务目录订单列表
*
* @param status
* 查询条件:订单状态,可选值参考 @see ServiceCatalogOrderStatus (可选)
* @param sort
* 排序字段 (可选)
* @param order
* 排序方式 (可选)
* @param pageSize
* 分页大小,(可选,默认9999)
* @param pageNum
* 分页编号,(可选,默认1)
* @return
* @throws Fit2CloudException
*/
public List<ServiceCatalogOrder> getServiceCatalogOrders(String status, String sort, String order, Integer pageSize,
Integer pageNum) throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET, restApiEndpoint + "/servicecatalog/orders?status=" + status
+ "&sort=" + sort + "&order=" + order + "&pageSize=" + pageSize + "&pageNum=" + pageNum);
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
Type listType = new TypeToken<ArrayList<ServiceCatalogOrder>>() {
}.getType();
return new GsonBuilder().create().fromJson(responseString, listType);
} else {
throw new Fit2CloudException(responseString);
}
}
示例7: getCloudCredentials
/**
* 获取云帐号列表
*
* @return
* @throws Fit2CloudException
*/
public List<CloudCredential> getCloudCredentials() throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET, restApiEndpoint + "/cloudcredentials");
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
Type listType = new TypeToken<ArrayList<CloudCredential>>() {
}.getType();
return new GsonBuilder().create().fromJson(responseString, listType);
} else {
throw new Fit2CloudException(responseString);
}
}
示例8: getSupportedServerMetrics
/**
* 获取指定主机组下的所有监控项
*
* @param clusterRoleId
* 主机组ID
* @return
* @throws Fit2CloudException
*/
public List<KeyPair> getSupportedServerMetrics(Long clusterRoleId) throws Fit2CloudException {
if (clusterRoleId == null || clusterRoleId <= 0) {
throw new Fit2CloudException("请检查clusterRoleId的输入!");
}
OAuthRequest request = new OAuthRequest(Verb.GET, restApiEndpoint + "/metrics?clusterRoleId=" + clusterRoleId);
request.setCharset("UTF-8");
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
Type listType = new TypeToken<List<KeyPair>>() {
}.getType();
return new GsonBuilder().create().fromJson(responseString, listType);
} else {
throw new Fit2CloudException(responseString);
}
}
示例9: getApplication
/**
* 获取应用信息
*
* @param applicationName
* 应用名称
* @return
* @throws Fit2CloudException
*/
public Application getApplication(String applicationName) throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET,
restApiEndpoint + "/deploy/app/search?name=" + applicationName);
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
return new GsonBuilder().create().fromJson(responseString, Application.class);
} else {
throw new Fit2CloudException(responseString);
}
}
示例10: getAttributeProfile
@Override
public Response getAttributeProfile(long customerId, int clientId, String attribute) {
if (!IdPool.clientInList(customerId, clientId)) {
clientNotFoundMsg.setCustomerId(customerId);
clientNotFoundMsg.setClientId(clientId);
return Response.status(Response.Status.OK).entity(clientNotFoundMsg).type(MediaType.APPLICATION_JSON_TYPE).build();
}
customer = LinkedInCustomerResource.getCustomerList().get(customerId);
client = customer.getClientDB().getClientList().get(clientId);
if (client.getStatus() == linkStatusOff) {
notLinkedMsg = new NotLinked();
notLinkedMsg.setCustomerId(customerId);
notLinkedMsg.setClientId(clientId);
return Response.status(Response.Status.OK).entity(notLinkedMsg).type(MediaType.APPLICATION_JSON_TYPE).build();
}
OAuthRequest request = new OAuthRequest(Verb.GET, LinkedInAppResource.API_BASIC_PROFILE_URI + ":(" + attribute + ")");
request.addHeader("x-li-format", "json");
OAuthService service = client.getLinkHandler().getServiceProvider();
service.signRequest(client.getLinkHandler().getAccessToken(), request);
org.scribe.model.Response response = request.send();
return Response.status(Response.Status.OK).entity(response.getBody()).build();
}
示例11: getContactGroupList
/**
* 获取通知组列表
*
* @param pageSize
* 分页大小,(可选,默认9999)
* @param pageNum
* 分页编号,(可选,默认1)
* @return
* @throws Fit2CloudException
*/
public List<ContactGroup> getContactGroupList(Integer pageSize, Integer pageNum) throws Fit2CloudException {
StringBuffer requestParamSb = new StringBuffer();
if (pageSize != null && pageSize.intValue() > 0) {
requestParamSb.append("pageSize=");
requestParamSb.append(pageSize);
requestParamSb.append("&");
}
if (pageNum != null && pageNum.intValue() > 0) {
requestParamSb.append("pageNum=");
requestParamSb.append(pageNum);
requestParamSb.append("&");
}
String requestParam = requestParamSb.toString();
if (requestParam != null && requestParam.endsWith("&")) {
requestParam = requestParam.substring(0, requestParam.length() - 1);
}
OAuthRequest request = new OAuthRequest(Verb.GET, restApiEndpoint + "/contactgroups?" + requestParam);
request.setCharset("UTF-8");
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
Type listType = new TypeToken<List<ContactGroup>>() {
}.getType();
return new GsonBuilder().create().fromJson(responseString, listType);
} else {
throw new Fit2CloudException(responseString);
}
}
示例12: getClusterParam
/**
* 获取指定集群下指定名称的集群参数
*
* @param clusterId
* 集群ID
* @param name
* 集群参数名称
* @return
* @throws Fit2CloudException
*/
public ClusterParam getClusterParam(long clusterId, String name) throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET,
restApiEndpoint + "/cluster/" + clusterId + "/param?name=" + name);
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
return new GsonBuilder().create().fromJson(responseString, ClusterParam.class);
} else {
throw new Fit2CloudException(responseString);
}
}
示例13: getApplicationRepo
/**
* 获取应用仓库信息
*
* @param applicationRepoId
* 应用仓库ID
* @return
* @throws Fit2CloudException
*/
public ApplicationRepo getApplicationRepo(Long applicationRepoId) throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET,
restApiEndpoint + "/deploy/repo/search?id=" + applicationRepoId);
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
return new GsonBuilder().create().fromJson(responseString, ApplicationRepo.class);
} else {
throw new Fit2CloudException(responseString);
}
}
示例14: getServerSSHUrl
/**
* 获取指定虚机的ssh登录url
*
* @param serverId
* 虚机ID
* @return
* @throws Fit2CloudException
*/
public String getServerSSHUrl(long serverId) throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET, restApiEndpoint + "/server/" + serverId + "/openssh");
request.setCharset("UTF-8");
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
return responseString;
} else {
throw new Fit2CloudException(responseString);
}
}
示例15: getGroupEnv
/**
* 获取当前工作空间信息
*
* @return
* @throws Fit2CloudException
*/
public GroupEnv getGroupEnv() throws Fit2CloudException {
OAuthRequest request = new OAuthRequest(Verb.GET, restApiEndpoint + "/group/info");
Token accessToken = new Token("", "");
service.signRequest(accessToken, request);
Response response = request.send();
int code = response.getCode();
String responseString = response.getBody();
if (code == 200) {
return new GsonBuilder().create().fromJson(responseString, GroupEnv.class);
} else {
throw new Fit2CloudException(responseString);
}
}