本文整理匯總了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);
}
}