index
int64 | repo_id
string | file_path
string | content
string |
|---|---|---|---|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth/sts/AssumeRoleResponse.java
|
package com.alicloud.auth.sts;
import com.alicloud.AcsResponse;
import com.alicloud.transform.UnmarshallerContext;
public class AssumeRoleResponse extends AcsResponse {
private String requestId;
private Credentials credentials;
private AssumedRoleUser assumedRoleUser;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public Credentials getCredentials() {
return this.credentials;
}
public void setCredentials(Credentials credentials) {
this.credentials = credentials;
}
public AssumedRoleUser getAssumedRoleUser() {
return this.assumedRoleUser;
}
public void setAssumedRoleUser(AssumedRoleUser assumedRoleUser) {
this.assumedRoleUser = assumedRoleUser;
}
@Override
public AssumeRoleResponse getInstance(UnmarshallerContext context) {
return AssumeRoleResponseUnmarshaller.unmarshall(this, context);
}
public static class Credentials {
private String securityToken;
private String accessKeySecret;
private String accessKeyId;
private String expiration;
public String getSecurityToken() {
return this.securityToken;
}
public void setSecurityToken(String securityToken) {
this.securityToken = securityToken;
}
public String getAccessKeySecret() {
return this.accessKeySecret;
}
public void setAccessKeySecret(String accessKeySecret) {
this.accessKeySecret = accessKeySecret;
}
public String getAccessKeyId() {
return this.accessKeyId;
}
public void setAccessKeyId(String accessKeyId) {
this.accessKeyId = accessKeyId;
}
public String getExpiration() {
return this.expiration;
}
public void setExpiration(String expiration) {
this.expiration = expiration;
}
}
public static class AssumedRoleUser {
private String arn;
private String assumedRoleId;
public String getArn() {
return this.arn;
}
public void setArn(String arn) {
this.arn = arn;
}
public String getAssumedRoleId() {
return this.assumedRoleId;
}
public void setAssumedRoleId(String assumedRoleId) {
this.assumedRoleId = assumedRoleId;
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth/sts/AssumeRoleResponseUnmarshaller.java
|
package com.alicloud.auth.sts;
import com.alicloud.auth.sts.AssumeRoleResponse.AssumedRoleUser;
import com.alicloud.auth.sts.AssumeRoleResponse.Credentials;
import com.alicloud.transform.UnmarshallerContext;
public class AssumeRoleResponseUnmarshaller {
public static AssumeRoleResponse unmarshall(AssumeRoleResponse assumeRoleResponse, UnmarshallerContext context) {
assumeRoleResponse.setRequestId(context.stringValue("AssumeRoleResponse.RequestId"));
Credentials credentials = new Credentials();
credentials.setSecurityToken(context.stringValue("AssumeRoleResponse.Credentials.SecurityToken"));
credentials.setAccessKeySecret(context.stringValue("AssumeRoleResponse.Credentials.AccessKeySecret"));
credentials.setAccessKeyId(context.stringValue("AssumeRoleResponse.Credentials.AccessKeyId"));
credentials.setExpiration(context.stringValue("AssumeRoleResponse.Credentials.Expiration"));
assumeRoleResponse.setCredentials(credentials);
AssumedRoleUser assumedRoleUser = new AssumedRoleUser();
assumedRoleUser.setArn(context.stringValue("AssumeRoleResponse.AssumedRoleUser.Arn"));
assumedRoleUser.setAssumedRoleId(context.stringValue("AssumeRoleResponse.AssumedRoleUser.AssumedRoleId"));
assumeRoleResponse.setAssumedRoleUser(assumedRoleUser);
return assumeRoleResponse;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth/sts/GenerateSessionAccessKeyResponse.java
|
package com.alicloud.auth.sts;
import com.alicloud.AcsResponse;
import com.alicloud.transform.UnmarshallerContext;
import com.google.gson.annotations.SerializedName;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "GenerateSessionAccessKeyResponse")
public class GenerateSessionAccessKeyResponse extends AcsResponse {
@SerializedName("RequestId")
private String requestId;
@SerializedName("SessionAccessKey")
private SessionAccessKey sessionAccessKey;
public String getRequestId() {
return requestId;
}
@XmlElement(name = "RequestId")
public void setRequestId(String requestId) {
this.requestId = requestId;
}
@XmlElement(name = "SessionAccessKey")
public SessionAccessKey getSessionAccessKey() {
return sessionAccessKey;
}
public void setSessionAccessKey(SessionAccessKey sessionAccessKey) {
this.sessionAccessKey = sessionAccessKey;
}
@Override
public GenerateSessionAccessKeyResponse getInstance(UnmarshallerContext context) {
return GetSessionAccessKeyResponseUnmarshaller.unmarshall(this, context);
}
public static class SessionAccessKey {
@SerializedName("SessionAccessKeyId")
private String sessionAccessKeyId;
@SerializedName("SessionAccessKeySecret")
private String sessionAccessKeySecret;
@SerializedName("Expiration")
private String expiration;
public String getSessionAccessKeyId() {
return sessionAccessKeyId;
}
@XmlElement(name = "SessionAccessKeyId")
public void setSessionAccessKeyId(String sessionAccessKeyId) {
this.sessionAccessKeyId = sessionAccessKeyId;
}
public String getSessionAccessKeySecert() {
return sessionAccessKeySecret;
}
@XmlElement(name = "SessionAccessKeySecret")
public void setSessionAccessKeySecert(String sessionAccessKeySecert) {
this.sessionAccessKeySecret = sessionAccessKeySecert;
}
public String getExpiration() {
return expiration;
}
@XmlElement(name = "Expiration")
public void setExpiration(String expiration) {
this.expiration = expiration;
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth/sts/GetSessionAccessKeyRequest.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.alicloud.auth.sts;
import com.alicloud.RpcAcsRequest;
public class GetSessionAccessKeyRequest extends RpcAcsRequest<GenerateSessionAccessKeyResponse> {
private static String version = "2015-04-01";
private static String product = "Sts";
private static String action = "GenerateSessionAccessKey";
private int durationSeconds = 3600;
private String publicKeyId;
public GetSessionAccessKeyRequest() {
super(product, version, action);
}
public int getDurationSeconds() {
return durationSeconds;
}
public void setDurationSeconds(int durationSeconds) {
this.durationSeconds = durationSeconds;
putQueryParameter("DurationSeconds", durationSeconds);
}
public String getPublicKeyId() {
return publicKeyId;
}
public void setPublicKeyId(String publicKeyId) {
this.publicKeyId = publicKeyId;
putQueryParameter("PublicKeyId", publicKeyId);
}
@Override
public Class<GenerateSessionAccessKeyResponse> getResponseClass() {
return GenerateSessionAccessKeyResponse.class;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/auth/sts/GetSessionAccessKeyResponseUnmarshaller.java
|
package com.alicloud.auth.sts;
import com.alicloud.auth.sts.GenerateSessionAccessKeyResponse.SessionAccessKey;
import com.alicloud.transform.UnmarshallerContext;
public class GetSessionAccessKeyResponseUnmarshaller {
public static GenerateSessionAccessKeyResponse unmarshall(GenerateSessionAccessKeyResponse getSessionAccessKeyResponse,
UnmarshallerContext context) {
getSessionAccessKeyResponse.setRequestId(context.stringValue("GenerateSessionAccessKeyResponse.RequestId"));
SessionAccessKey credentials = new SessionAccessKey();
credentials.setSessionAccessKeyId(context.stringValue("GenerateSessionAccessKeyResponse.SessionAccessKey.SessionAccessKeyId"));
credentials.setSessionAccessKeySecert(context.stringValue("GenerateSessionAccessKeyResponse.SessionAccessKey.SessionAccessKeySecret"));
credentials.setExpiration(context.stringValue("GenerateSessionAccessKeyResponse.SessionAccessKey.Expiration"));
getSessionAccessKeyResponse.setSessionAccessKey(credentials);
return getSessionAccessKeyResponse;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/ChainedEndpointResolver.java
|
package com.alicloud.endpoint;
import com.alicloud.exceptions.ClientException;
import com.alicloud.exceptions.ErrorCodeConstant;
import com.alicloud.exceptions.ErrorMessageConstant;
import java.util.List;
import java.util.Set;
@SuppressWarnings({"ALL", "AlibabaClassMustHaveAuthor"})
public class ChainedEndpointResolver implements EndpointResolver {
protected List<EndpointResolverBase> endpointResolvers;
public ChainedEndpointResolver(List<EndpointResolverBase> resolverChain) {
this.endpointResolvers = resolverChain;
}
private void checkProductCode(ResolveEndpointRequest request) throws ClientException {
boolean productCodeValid = false;
for (EndpointResolverBase resolver : endpointResolvers) {
if (resolver.isProductCodeValid(request)) {
productCodeValid = true;
}
}
if (!productCodeValid) {
throw new ClientException(ErrorCodeConstant.SDK_ENDPOINT_RESOLVING_ERROR,
String.format(ErrorMessageConstant.ENDPOINT_NO_PRODUCT, request.productCode));
}
}
private void checkRegionId(ResolveEndpointRequest request) throws ClientException {
boolean regionIdValid = false;
for (EndpointResolverBase resolver : endpointResolvers) {
if (resolver.isRegionIdValid(request)) {
regionIdValid = true;
}
}
if (!regionIdValid) {
throw new ClientException(ErrorCodeConstant.SDK_ENDPOINT_RESOLVING_ERROR,
String.format(ErrorMessageConstant.INVALID_REGION_ID, request.regionId));
}
}
private String getAvailableRegionsHint(String productCode) {
Set<String> availabeRegions = null;
String availabeRegionsHint = "";
for (EndpointResolverBase resolver : endpointResolvers) {
availabeRegions = resolver.getValidRegionIdsByProduct(productCode);
if (availabeRegions != null) {
availabeRegionsHint = "\nOr you can use the other available regions:";
for (String availabeRegion : availabeRegions) {
availabeRegionsHint += " " + availabeRegion;
}
break;
}
}
return availabeRegionsHint;
}
@Override
public String resolve(ResolveEndpointRequest request) throws ClientException {
for (EndpointResolverBase resolver : endpointResolvers) {
String endpoint = resolver.resolve(request);
if (endpoint != null) {
return endpoint;
}
}
checkProductCode(request);
checkRegionId(request);
throw new ClientException(ErrorCodeConstant.SDK_ENDPOINT_RESOLVING_ERROR,
String.format(ErrorMessageConstant.ENDPOINT_NO_REGION, request.regionId, request.productCode,
getAvailableRegionsHint(request.productCode)));
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/DefaultEndpointResolver.java
|
package com.alicloud.endpoint;
import com.alicloud.DefaultAcsClient;
import com.alicloud.exceptions.ClientException;
import com.alicloud.profile.DefaultProfile;
import com.alicloud.profile.IClientProfile;
import java.util.ArrayList;
import java.util.List;
public class DefaultEndpointResolver implements EndpointResolver {
public static UserCustomizedEndpointResolver predefinedEndpointResolver = new UserCustomizedEndpointResolver();
private UserCustomizedEndpointResolver userCustomizedEndpointResolver;
private EndpointResolver insideEndpointResolver;
public DefaultEndpointResolver(
DefaultAcsClient client,
String userConfig,
IClientProfile profile) {
userCustomizedEndpointResolver = new UserCustomizedEndpointResolver();
EndpointResolverRules endpointResolverRules = new EndpointResolverRules();
List<EndpointResolverBase> resolverChain = new ArrayList<EndpointResolverBase>();
// The order is very IMPORTANT!
resolverChain.add(predefinedEndpointResolver);
resolverChain.add(userCustomizedEndpointResolver);
if (profile.isUsingVpcEndpoint()) {
resolverChain.add(new UserVpcEndpointResolver());
}
resolverChain.add(endpointResolverRules);
if (userConfig == null) {
resolverChain.add(new LocalConfigRegionalEndpointResolver());
resolverChain.add(new LocalConfigGlobalEndpointResolver());
} else {
resolverChain.add(new LocalConfigRegionalEndpointResolver(userConfig));
resolverChain.add(new LocalConfigGlobalEndpointResolver(userConfig));
}
if (profile.isUsingInternalLocationService()) {
resolverChain.add(new InternalLocationServiceEndpointResolver(client));
} else {
resolverChain.add(new LocationServiceEndpointResolver(client));
}
insideEndpointResolver = new ChainedEndpointResolver(resolverChain);
}
public DefaultEndpointResolver(DefaultAcsClient client) {
this(client, null, DefaultProfile.getProfile(null));
}
public DefaultEndpointResolver(DefaultAcsClient client, IClientProfile profile) {
this(client, null, profile);
}
@Override
public String resolve(ResolveEndpointRequest request) throws ClientException {
return this.insideEndpointResolver.resolve(request);
}
public void putEndpointEntry(String regionId, String productCode, String endpoint) {
this.userCustomizedEndpointResolver.putEndpointEntry(regionId, productCode, endpoint);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/EndpointResolver.java
|
package com.alicloud.endpoint;
import com.alicloud.exceptions.ClientException;
public interface EndpointResolver {
String resolve(ResolveEndpointRequest request) throws ClientException;
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/EndpointResolverBase.java
|
package com.alicloud.endpoint;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public abstract class EndpointResolverBase implements EndpointResolver {
Map<String, String> endpointsData;
public EndpointResolverBase() {
endpointsData = new HashMap<String, String>();
}
public String fetchEndpointEntry(ResolveEndpointRequest request) {
String key = makeEndpointKey(request);
if (endpointsData.containsKey(key)) {
return endpointsData.get(key);
} else {
return null;
}
}
public void putEndpointEntry(String key, String endpoint) {
endpointsData.put(key, endpoint);
}
public boolean isProductCodeValid(ResolveEndpointRequest request) {
for (String key : endpointsData.keySet()) {
if (key.startsWith(request.productCodeLower)) {
return true;
}
}
return false;
}
abstract public boolean isRegionIdValid(ResolveEndpointRequest request);
abstract String makeEndpointKey(ResolveEndpointRequest request);
public Set<String> getValidRegionIdsByProduct(String productCode) {
// Only local config can tell
return null;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/EndpointResolverRules.java
|
package com.alicloud.endpoint;
import java.util.HashMap;
public class EndpointResolverRules extends EndpointResolverBase {
private Boolean validRegionId = false;
private Boolean validProductId = false;
private HashMap<String, String> productEndpointMap = null;
private String productEndpointRegional = null;
private String productNetwork = "public";
private String productSuffix = "";
@Override
public String resolve(ResolveEndpointRequest request) {
this.productEndpointMap = request.productEndpointMap;
this.productEndpointRegional = request.productEndpointRegional;
this.productNetwork = request.productNetwork;
this.productSuffix = request.productSuffix;
if (this.productEndpointMap == null || this.productEndpointRegional == null) {
return null;
}
return getEndpoint(request.productCode, request.regionId);
}
@Override
public String makeEndpointKey(ResolveEndpointRequest request) {
return makeEndpointKey(request.productCode, request.regionId);
}
public String makeEndpointKey(String productCode, String regionId) {
return productCode.toLowerCase() + "." + regionId.toLowerCase();
}
private String getEndpoint(String productCode, String regionId) {
if (this.productEndpointRegional != null && this.productEndpointMap != null) {
if ("".equals(this.productNetwork) || this.productNetwork == null) {
this.productNetwork = "public";
}
if ("public".equals(this.productNetwork)) {
if (this.productEndpointMap.containsKey(regionId)) {
return this.productEndpointMap.get(regionId);
}
}
String endpoint = "";
if ("regional".equals(this.productEndpointRegional)) {
endpoint = "<product_id><suffix><network>.<region_id>.aliyuncs.com";
endpoint = endpoint.replace("<region_id>", regionId.toLowerCase());
} else {
endpoint = "<product_id><suffix><network>.aliyuncs.com";
}
if (this.productSuffix == null || "".equals(this.productSuffix)) {
endpoint = endpoint.replace("<suffix>", "");
} else {
endpoint = endpoint.replace("<suffix>", "-" + this.productSuffix.toLowerCase());
}
if ("public".equals(this.productNetwork)) {
endpoint = endpoint.replace("<network>", "");
} else {
endpoint = endpoint.replace("<network>", "-" + this.productNetwork.toLowerCase());
}
endpoint = endpoint.replace("<product_id>", productCode.toLowerCase());
this.validRegionId = true;
this.validProductId = true;
return endpoint;
}
return null;
}
@Override
public boolean isProductCodeValid(ResolveEndpointRequest request) {
return this.validProductId;
}
@Override
public boolean isRegionIdValid(ResolveEndpointRequest request) {
return this.validRegionId;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/InternalLocationServiceEndpointResolver.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.alicloud.endpoint;
import com.alicloud.DefaultAcsClient;
public class InternalLocationServiceEndpointResolver extends LocationServiceEndpointResolver {
private final static String INNER_LOCATION_SERVICE_ENDPOINT = "location-inner.aliyuncs.com";
private final static String INNER_LOCATION_SERVICE_API_VERSION = "2015-12-25";
public InternalLocationServiceEndpointResolver(DefaultAcsClient client) {
super(client);
this.locationServiceEndpoint = INNER_LOCATION_SERVICE_ENDPOINT;
this.locationServiceApiVersion = INNER_LOCATION_SERVICE_API_VERSION;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/LocalConfigGlobalEndpointResolver.java
|
package com.alicloud.endpoint;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class LocalConfigGlobalEndpointResolver extends LocalConfigRegionalEndpointResolver {
public LocalConfigGlobalEndpointResolver() {
JsonObject obj = readLocalConfigAsJsonObject();
initLocalConfig(obj);
}
public LocalConfigGlobalEndpointResolver(String configJsonStr) {
// For testability
JsonObject obj = (new JsonParser()).parse(configJsonStr).getAsJsonObject();
initLocalConfig(obj);
}
protected void initLocalConfig(JsonObject obj) {
initGlobalEndpointData(obj);
initRegionIds(obj);
initLocationCodeMapping(obj);
}
private void initGlobalEndpointData(JsonObject obj) {
if (!obj.has("global_endpoints")) {
return;
}
JsonObject globalEndpoints = obj.get("global_endpoints").getAsJsonObject();
Set<String> globalEndpointsKeySet = new HashSet<String>();
for (Map.Entry<String, JsonElement> entry : globalEndpoints.entrySet()) {
globalEndpointsKeySet.add(entry.getKey());
}
for (String locationServiceCode : globalEndpointsKeySet) {
String endpoint = globalEndpoints.get(locationServiceCode).getAsString();
putEndpointEntry(makeEndpointKey(locationServiceCode), endpoint);
}
}
@Override
public String resolve(ResolveEndpointRequest request) {
if (request.isOpenApiEndpoint() && isRegionIdValid(request)) {
return fetchEndpointEntry(request);
} else {
return null;
}
}
@Override
public String makeEndpointKey(ResolveEndpointRequest request) {
return makeEndpointKey(request.productCodeLower);
}
public String makeEndpointKey(String productCodeLower) {
return getNormalizedProductCode(productCodeLower);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/LocalConfigRegionalEndpointResolver.java
|
package com.alicloud.endpoint;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.InputStream;
import java.util.*;
public class LocalConfigRegionalEndpointResolver extends EndpointResolverBase {
protected static final String ENDPOINT_JSON = "endpoints.json";
private Set<String> validRegionIds = new HashSet<String>();
private Map<String, String> locationCodeMapping = new HashMap<String, String>();
private JsonObject regionalEndpointData;
public LocalConfigRegionalEndpointResolver() {
JsonObject obj = readLocalConfigAsJsonObject();
initLocalConfig(obj);
}
public LocalConfigRegionalEndpointResolver(String configJsonStr) {
// For testability
JsonObject obj = (new JsonParser()).parse(configJsonStr).getAsJsonObject();
initLocalConfig(obj);
}
private void initLocalConfig(JsonObject obj) {
initRegionalEndpointData(obj);
initRegionIds(obj);
initLocationCodeMapping(obj);
}
private void initRegionalEndpointData(JsonObject obj) {
if (!obj.has("regional_endpoints")) {
return;
}
regionalEndpointData = obj.get("regional_endpoints").getAsJsonObject();
JsonObject regionalEndpoints = obj.get("regional_endpoints").getAsJsonObject();
Set<String> regionalEndpointsKeySet = new HashSet<String>();
for (Map.Entry<String, JsonElement> entry : regionalEndpoints.entrySet()) {
regionalEndpointsKeySet.add(entry.getKey());
}
for (String normalizedProductCode : regionalEndpointsKeySet) {
JsonObject productData = regionalEndpoints.get(normalizedProductCode).getAsJsonObject();
Set<String> productDataKeySet = new HashSet<String>();
for (Map.Entry<String, JsonElement> entry : productData.entrySet()) {
productDataKeySet.add(entry.getKey());
}
for (String regionId : productDataKeySet) {
String endpoint = productData.get(regionId).getAsString();
putEndpointEntry(makeEndpointKey(normalizedProductCode, regionId), endpoint);
}
}
}
protected void initRegionIds(JsonObject obj) {
if (!obj.has("regions")) {
return;
}
JsonArray regions = obj.get("regions").getAsJsonArray();
for (JsonElement regionData : regions) {
validRegionIds.add(regionData.getAsString());
}
}
protected void initLocationCodeMapping(JsonObject obj) {
if (!obj.has("location_code_mapping")) {
return;
}
JsonObject mappingData = obj.get("location_code_mapping").getAsJsonObject();
Set<String> keySet = new HashSet<String>();
for (Map.Entry<String, JsonElement> entry : mappingData.entrySet()) {
keySet.add(entry.getKey());
}
for (String productCode : keySet) {
String locationServiceCode = mappingData.get(productCode).getAsString();
locationCodeMapping.put(productCode, locationServiceCode);
}
}
protected String getNormalizedProductCode(String productCode) {
String productCodeLower = productCode.toLowerCase();
if (locationCodeMapping.containsKey(productCodeLower)) {
return locationCodeMapping.get(productCodeLower);
}
return productCodeLower;
}
protected JsonObject readLocalConfigAsJsonObject() {
ClassLoader classLoader = getClass().getClassLoader();
InputStream is = classLoader.getResourceAsStream(ENDPOINT_JSON);
Scanner scanner = new Scanner(is, "UTF-8");
scanner.useDelimiter("\0");
String jsonStr = scanner.hasNext() ? scanner.next() : "";
scanner.close();
JsonObject endpointData = (new JsonParser()).parse(jsonStr).getAsJsonObject();
return endpointData;
}
@Override
public String resolve(ResolveEndpointRequest request) {
if (request.isOpenApiEndpoint()) {
return fetchEndpointEntry(request);
} else {
return null;
}
}
@Override
public String makeEndpointKey(ResolveEndpointRequest request) {
return makeEndpointKey(request.productCodeLower, request.regionId);
}
public String makeEndpointKey(String productCodeLower, String regionId) {
return getNormalizedProductCode(productCodeLower) + "." + regionId.toLowerCase();
}
@Override
public boolean isRegionIdValid(ResolveEndpointRequest request) {
return validRegionIds.contains(request.regionId);
}
@Override
public Set<String> getValidRegionIdsByProduct(String productCodeLower) {
String code = getNormalizedProductCode(productCodeLower);
if (regionalEndpointData != null && regionalEndpointData.has(code)) {
JsonObject regionalEndpoints = regionalEndpointData.get(code).getAsJsonObject();
Set<String> validRegionIdsByProduct = new HashSet<String>();
for (Map.Entry<String, JsonElement> entry : regionalEndpoints.entrySet()) {
validRegionIdsByProduct.add(entry.getKey());
}
return validRegionIdsByProduct;
}
return null;
}
@Override
public boolean isProductCodeValid(ResolveEndpointRequest request) {
ResolveEndpointRequest request2 = new ResolveEndpointRequest(
request.regionId,
getNormalizedProductCode(request.productCode),
null,
null
);
return super.isProductCodeValid(request2);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/LocationServiceEndpointResolver.java
|
package com.alicloud.endpoint;
import com.alicloud.DefaultAcsClient;
import com.alicloud.endpoint.location.model.v20150612.DescribeEndpointsRequest;
import com.alicloud.endpoint.location.model.v20150612.DescribeEndpointsResponse;
import com.alicloud.exceptions.ClientException;
import com.alicloud.http.FormatType;
import com.alicloud.http.ProtocolType;
import java.util.HashSet;
import java.util.Set;
public class LocationServiceEndpointResolver extends EndpointResolverBase {
private final static String DEFAULT_LOCATION_SERVICE_ENDPOINT = "location-readonly.aliyuncs.com";
private final static String DEFAULT_LOCATION_SERVICE_API_VERSION = "2015-06-12";
/**
* For test use
*/
public int locationServiceCallCounter = 0;
protected String locationServiceEndpoint = DEFAULT_LOCATION_SERVICE_ENDPOINT;
protected String locationServiceApiVersion = DEFAULT_LOCATION_SERVICE_API_VERSION;
private DefaultAcsClient client;
private Set<String> invalidProductCodes;
private Set<String> validProductCodes;
private Set<String> invalidRegionIds;
private Set<String> validRegionIds;
public LocationServiceEndpointResolver(DefaultAcsClient client) {
this.client = client;
invalidProductCodes = new HashSet<String>();
invalidRegionIds = new HashSet<String>();
validProductCodes = new HashSet<String>();
validRegionIds = new HashSet<String>();
}
public void setLocationServiceEndpoint(String endpoint) {
locationServiceEndpoint = endpoint;
}
@Override
public String resolve(ResolveEndpointRequest request) throws ClientException {
if (request.locationServiceCode == null || request.locationServiceCode.length() == 0) {
return null;
}
if (invalidProductCodes.contains(request.productCodeLower)) {
return null;
}
if (invalidRegionIds.contains(request.regionId)) {
return null;
}
String key = makeEndpointKey(request);
if (endpointsData.containsKey(key)) {
// The endpoint can be null when last fetch is failed
return endpointsData.get(key);
}
return getEndpointFromLocationService(key, request);
}
synchronized private String getEndpointFromLocationService(String key, ResolveEndpointRequest request)
throws ClientException {
if (endpointsData.containsKey(key)) {
return endpointsData.get(key);
}
callLocationService(key, request);
locationServiceCallCounter += 1;
if (endpointsData.containsKey(key)) {
return endpointsData.get(key);
}
return null;
}
private void callLocationService(String key, ResolveEndpointRequest request) throws ClientException {
DescribeEndpointsRequest describeEndpointsRequest = new DescribeEndpointsRequest();
describeEndpointsRequest.setSysProtocol(ProtocolType.HTTPS);
describeEndpointsRequest.setAcceptFormat(FormatType.JSON);
describeEndpointsRequest.setId(request.regionId);
describeEndpointsRequest.setServiceCode(request.locationServiceCode);
describeEndpointsRequest.setType(request.endpointType);
describeEndpointsRequest.setSysEndpoint(locationServiceEndpoint);
describeEndpointsRequest.setVersion(locationServiceApiVersion);
DescribeEndpointsResponse response;
try {
response = client.getAcsResponse(describeEndpointsRequest);
} catch (ClientException e) {
if ("InvalidRegionId".equals(e.getErrCode())
&& "The specified region does not exist.".equals(e.getErrMsg())) {
// No such region
invalidRegionIds.add(request.regionId);
putEndpointEntry(key, null);
return;
} else if ("Illegal Parameter".equals(e.getErrCode())
&& "Please check the parameters".equals(e.getErrMsg())) {
// No such product
invalidProductCodes.add(request.productCodeLower);
putEndpointEntry(key, null);
return;
} else {
throw e;
}
}
// As long as code gets here
// the product code and the region id is valid
// the endpoint can be still not found
validProductCodes.add(request.productCodeLower);
validRegionIds.add(request.regionId);
boolean foundFlag = false;
for (DescribeEndpointsResponse.Endpoint endpoint : response.getEndpoints()) {
if (endpoint.getSerivceCode().equals(request.locationServiceCode)
&& endpoint.getType().equals(request.endpointType)) {
foundFlag = true;
putEndpointEntry(key, endpoint.getEndpoint());
break;
}
}
if (!foundFlag) {
putEndpointEntry(key, null);
}
}
@Override
public boolean isProductCodeValid(ResolveEndpointRequest request) {
if (request.locationServiceCode != null) {
return !invalidProductCodes.contains(request.productCodeLower);
}
return false;
}
@Override
public boolean isRegionIdValid(ResolveEndpointRequest request) {
if (request.locationServiceCode != null) {
return !invalidRegionIds.contains(request.regionId);
}
return false;
}
@Override
public String makeEndpointKey(ResolveEndpointRequest request) {
return makeEndpointKey(
request.productCode, request.locationServiceCode,
request.regionId, request.endpointType
);
}
public String makeEndpointKey(String productCode, String locationServiceCode, String regionId,
String endpointType) {
return productCode.toLowerCase() + "." + locationServiceCode + "."
+ regionId.toLowerCase() + "." + endpointType;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/ResolveEndpointRequest.java
|
package com.alicloud.endpoint;
import java.util.HashMap;
public class ResolveEndpointRequest {
public static final String ENDPOINT_TYPE_INNER = "innerAPI";
public static final String ENDPOINT_TYPE_OPEN = "openAPI";
public String productCode = null;
public String regionId = null;
public String endpointType = null;
public String locationServiceCode = null;
public String productCodeLower = null;
public HashMap<String, String> productEndpointMap = null;
public String productEndpointRegional = null;
public String productNetwork = "public";
public String productSuffix = "";
public ResolveEndpointRequest(String regionId, String productCode,
String locationServiceCode, String endpointType) {
this.regionId = regionId;
this.productCode = productCode;
this.productCodeLower = productCode.toLowerCase();
if (endpointType == null || endpointType.length() == 0) {
endpointType = ENDPOINT_TYPE_OPEN;
}
this.endpointType = endpointType;
this.locationServiceCode = locationServiceCode;
}
public boolean isOpenApiEndpoint() {
return ENDPOINT_TYPE_OPEN.equals(endpointType);
}
public void setProductEndpointMap(HashMap<String, String> productEndpointMap) {
this.productEndpointMap = productEndpointMap;
}
public void setProductEndpointRegional(String productEndpointRegional) {
this.productEndpointRegional = productEndpointRegional;
}
public void setProductNetwork(String productNetwork) {
this.productNetwork = productNetwork;
}
public void setProductSuffix(String suffix) {
this.productSuffix = suffix;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/UserCustomizedEndpointResolver.java
|
package com.alicloud.endpoint;
import java.util.HashSet;
import java.util.Set;
public class UserCustomizedEndpointResolver extends EndpointResolverBase {
private Set<String> validRegionIds;
public UserCustomizedEndpointResolver() {
validRegionIds = new HashSet<String>();
}
public void putEndpointEntry(String regionId, String productCode, String endpoint) {
putEndpointEntry(makeEndpointKey(productCode, regionId), endpoint);
validRegionIds.add(regionId);
}
@Override
public String resolve(ResolveEndpointRequest request) {
return fetchEndpointEntry(request);
}
@Override
public String makeEndpointKey(ResolveEndpointRequest request) {
return makeEndpointKey(request.productCode, request.regionId);
}
public String makeEndpointKey(String productCode, String regionId) {
return productCode.toLowerCase() + "." + regionId.toLowerCase();
}
@Override
public boolean isRegionIdValid(ResolveEndpointRequest request) {
return validRegionIds.contains(request.regionId);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/UserVpcEndpointResolver.java
|
package com.alicloud.endpoint;
import com.alicloud.exceptions.ClientException;
public class UserVpcEndpointResolver extends EndpointResolverBase {
@Override
public boolean isRegionIdValid(ResolveEndpointRequest request) {
return request.regionId != null;
}
@Override
public boolean isProductCodeValid(ResolveEndpointRequest request) {
return request.productCode != null;
}
@Override
String makeEndpointKey(ResolveEndpointRequest request) {
return null;
}
@Override
public String resolve(ResolveEndpointRequest request) throws ClientException {
String productCode = request.productCode.toLowerCase();
String regionId = request.regionId.toLowerCase();
return String.format("%s-vpc.%s.aliyuncs.com", productCode, regionId);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/location/model
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/location/model/v20150612/DescribeEndpointsRequest.java
|
package com.alicloud.endpoint.location.model.v20150612;
import com.alicloud.RpcAcsRequest;
public class DescribeEndpointsRequest extends RpcAcsRequest<DescribeEndpointsResponse> {
private String id;
private String serviceCode;
private String type;
public DescribeEndpointsRequest() {
super("Location", "2015-06-12", "DescribeEndpoints");
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
putQueryParameter("Id", id);
}
public String getServiceCode() {
return this.serviceCode;
}
public void setServiceCode(String serviceCode) {
this.serviceCode = serviceCode;
putQueryParameter("ServiceCode", serviceCode);
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
putQueryParameter("Type", type);
}
@Override
public Class<DescribeEndpointsResponse> getResponseClass() {
return DescribeEndpointsResponse.class;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/location/model
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/location/model/v20150612/DescribeEndpointsResponse.java
|
package com.alicloud.endpoint.location.model.v20150612;
import com.alicloud.AcsResponse;
import com.alicloud.endpoint.location.transform.v20150612.DescribeEndpointsResponseUnmarshaller;
import com.alicloud.transform.UnmarshallerContext;
import java.util.List;
public class DescribeEndpointsResponse extends AcsResponse {
private String requestId;
private Boolean success;
private List<Endpoint> endpoints;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public Boolean getSuccess() {
return this.success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public List<Endpoint> getEndpoints() {
return this.endpoints;
}
public void setEndpoints(List<Endpoint> endpoints) {
this.endpoints = endpoints;
}
@Override
public DescribeEndpointsResponse getInstance(UnmarshallerContext context) {
return DescribeEndpointsResponseUnmarshaller.unmarshall(this, context);
}
public static class Endpoint {
private String endpoint;
private String id;
private String namespace;
private String serivceCode;
private String type;
private List<String> protocols;
public String getEndpoint() {
return this.endpoint;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getNamespace() {
return this.namespace;
}
public void setNamespace(String namespace) {
this.namespace = namespace;
}
public String getSerivceCode() {
return this.serivceCode;
}
public void setSerivceCode(String serivceCode) {
this.serivceCode = serivceCode;
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public List<String> getProtocols() {
return this.protocols;
}
public void setProtocols(List<String> protocols) {
this.protocols = protocols;
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/location/transform
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/endpoint/location/transform/v20150612/DescribeEndpointsResponseUnmarshaller.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.alicloud.endpoint.location.transform.v20150612;
import com.alicloud.endpoint.location.model.v20150612.DescribeEndpointsResponse;
import com.alicloud.endpoint.location.model.v20150612.DescribeEndpointsResponse.Endpoint;
import com.alicloud.transform.UnmarshallerContext;
import java.util.ArrayList;
import java.util.List;
public class DescribeEndpointsResponseUnmarshaller {
public static DescribeEndpointsResponse unmarshall(DescribeEndpointsResponse describeEndpointsResponse,
UnmarshallerContext context) {
describeEndpointsResponse.setRequestId(context.stringValue("DescribeEndpointsResponse.RequestId"));
describeEndpointsResponse.setSuccess(context.booleanValue("DescribeEndpointsResponse.Success"));
List<Endpoint> endpoints = new ArrayList<Endpoint>();
for (int i = 0; i < context.lengthValue("DescribeEndpointsResponse.Endpoints.Length"); i++) {
Endpoint endpoint = new Endpoint();
endpoint.setEndpoint(context.stringValue("DescribeEndpointsResponse.Endpoints[" + i + "].Endpoint"));
endpoint.setId(context.stringValue("DescribeEndpointsResponse.Endpoints[" + i + "].Id"));
endpoint.setNamespace(context.stringValue("DescribeEndpointsResponse.Endpoints[" + i + "].Namespace"));
endpoint.setSerivceCode(context.stringValue("DescribeEndpointsResponse.Endpoints[" + i + "].SerivceCode"));
endpoint.setType(context.stringValue("DescribeEndpointsResponse.Endpoints[" + i + "].Type"));
List<String> protocols = new ArrayList<String>();
for (int j = 0; j < context
.lengthValue("DescribeEndpointsResponse.Endpoints[" + i + "].Protocols.Length"); j++) {
protocols.add(
context.stringValue("DescribeEndpointsResponse.Endpoints[" + i + "].Protocols[" + j + "]"));
}
endpoint.setProtocols(protocols);
endpoints.add(endpoint);
}
describeEndpointsResponse.setEndpoints(endpoints);
return describeEndpointsResponse;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/exceptions/ClientException.java
|
package com.alicloud.exceptions;
public class ClientException extends Exception {
private static final long serialVersionUID = 534996425110290578L;
private String requestId;
private String errCode;
private String errMsg;
private ErrorType errorType;
public ClientException(String errCode, String errMsg, String requestId) {
this(errCode, errMsg);
this.requestId = requestId;
this.setErrorType(ErrorType.Client);
}
public ClientException(String errCode, String errMsg, Throwable cause) {
super(errCode + " : " + errMsg, cause);
this.errCode = errCode;
this.errMsg = errMsg;
this.setErrorType(ErrorType.Client);
}
public ClientException(String errCode, String errMsg) {
super(errCode + " : " + errMsg);
this.errCode = errCode;
this.errMsg = errMsg;
this.setErrorType(ErrorType.Client);
}
public ClientException(String message) {
super(message);
this.setErrorType(ErrorType.Client);
}
public ClientException(Throwable cause) {
super(cause);
this.setErrorType(ErrorType.Client);
}
public String getRequestId() {
return requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public String getErrCode() {
return errCode;
}
public void setErrCode(String errCode) {
this.errCode = errCode;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public ErrorType getErrorType() {
return errorType;
}
public void setErrorType(ErrorType errorType) {
this.errorType = errorType;
}
@Override
public String getMessage() {
return super.getMessage() + (null == getRequestId() ? "" : "\r\nRequestId : " + getRequestId());
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/exceptions/ErrorCodeConstant.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.alicloud.exceptions;
public class ErrorCodeConstant {
public static final String SDK_ENDPOINT_RESOLVING_ERROR = "SDK.EndpointResolvingError";
public static final String SDK_ENDPOINT_TESTABILITY = "SDK.EndpointTestability";
public static final String SDK_INVALID_SERVER_RESPONSE = "SDK.InvalidServerResponse";
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/exceptions/ErrorMessageConstant.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.alicloud.exceptions;
public class ErrorMessageConstant {
public static final String SDK_ENDPOINT_MANAGEMENT_DOC_HTML =
"https://www.alibabacloud.com/help/zh/doc-detail/92049.htm";
public static final String INVALID_REGION_ID =
"No such region '%s'. Please check your region ID.";
public static final String ENDPOINT_NO_REGION =
"No endpoint in the region '%s' for product '%s'. \n" +
"You can set an endpoint for your request explicitly.%s\n" +
"See " + SDK_ENDPOINT_MANAGEMENT_DOC_HTML + "\n";
/**
* Or use available regions:
*/
public static final String ENDPOINT_NO_PRODUCT =
"No endpoint for product '%s'. \n" +
"Please check the product code, or set an endpoint for your request explicitly.\n" +
"See " + SDK_ENDPOINT_MANAGEMENT_DOC_HTML + "\n";
public static final String SERVER_RESPONSE_HTTP_BODY_EMPTY =
"Failed to parse the response. The request was succeeded, but the server returned an empty HTTP body.";
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/exceptions/ErrorType.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.alicloud.exceptions;
public enum ErrorType {
// 客户端异常
Client,
// 服务端异常
Server,
// 限流
Throttling,
// default
Unknown,
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/exceptions/ServerException.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.alicloud.exceptions;
public class ServerException extends ClientException {
private static final long serialVersionUID = -7345371390798165336L;
public ServerException(String errorCode, String errorMessage) {
super(errorCode, errorMessage);
this.setErrorType(ErrorType.Server);
}
public ServerException(String errCode, String errMsg, String requestId) {
this(errCode, errMsg);
this.setRequestId(requestId);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/CallBack.java
|
package com.alicloud.http;
/**
* 用于异步调用时的回调逻辑
*
* @author VK.Gao
* @date 2017/03/02
*/
public interface CallBack {
/**
* 请求失败
*
* @param request 封装后的请求对象,包含部分http相关信息
* @param e 导致失败的异常
*/
void onFailure(HttpRequest request, Exception e);
/**
* 收到应答
*
* @param request 封装后的请求对象,包含部分http相关信息
* @param response 封装后的应答对象,包含部分http相关信息,可以调用.getBody()获取content
*/
void onResponse(HttpRequest request, HttpResponse response);
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/CompositeX509TrustManager.java
|
package com.alicloud.http;
import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class CompositeX509TrustManager implements X509TrustManager {
private final List<X509TrustManager> trustManagers;
private boolean ignoreSSLCert = false;
public boolean isIgnoreSSLCert() {
return ignoreSSLCert;
}
public void setIgnoreSSLCert(boolean ignoreSSLCert) {
this.ignoreSSLCert = ignoreSSLCert;
}
public CompositeX509TrustManager(List<X509TrustManager> trustManagers) {
this.trustManagers = trustManagers;
}
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
// do nothing
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
if (ignoreSSLCert) {
return;
}
for (X509TrustManager trustManager : trustManagers) {
try {
trustManager.checkServerTrusted(chain, authType);
return; // someone trusts them. success!
} catch (CertificateException e) {
// maybe someone else will trust them
}
}
throw new CertificateException("None of the TrustManagers trust this certificate chain");
}
@Override
public X509Certificate[] getAcceptedIssuers() {
List<X509Certificate> certificates = new ArrayList<X509Certificate>();
for (X509TrustManager trustManager : trustManagers) {
certificates.addAll(Arrays.asList(trustManager.getAcceptedIssuers()));
}
X509Certificate[] certificatesArray = new X509Certificate[certificates.size()];
return certificates.toArray(certificatesArray);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/FormatType.java
|
package com.alicloud.http;
import java.util.Arrays;
public enum FormatType {
/**
* XML("application/xml","text/xml")
* JSON:("application/json", "text/json")
* RAW:("application/octet-stream")
* FORM:("application/x-www-form-urlencoded")
*/
XML("application/xml", "text/xml"),
JSON("application/json", "text/json"),
RAW("application/octet-stream"),
FORM("application/x-www-form-urlencoded");
private String[] formats;
FormatType(String... formats) {
this.formats = formats;
}
public static String mapFormatToAccept(FormatType format) {
return format.formats[0];
}
public static FormatType mapAcceptToFormat(String accept) {
for (FormatType value : values()) {
if (Arrays.asList(value.formats).contains(accept)) {
return value;
}
}
return FormatType.RAW;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/HttpClientConfig.java
|
package com.alicloud.http;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
public class HttpClientConfig {
public static final long DEFAULT_CONNECTION_TIMEOUT = 5000;
public static final long DEFAULT_READ_TIMEOUT = 10000;
/**
* client type
*/
private HttpClientType clientType = null;
private String customClientClassName = null;
/**
* connectionPool
**/
private int maxIdleConnections = 5;
private long maxIdleTimeMillis = 60 * 1000L;
private long keepAliveDurationMillis = 5000L;
/**
* timeout
**/
private long connectionTimeoutMillis = DEFAULT_CONNECTION_TIMEOUT;
private long readTimeoutMillis = DEFAULT_READ_TIMEOUT;
private long writeTimeoutMillis = 15000L;
/**
* global protocolType
**/
private ProtocolType protocolType = ProtocolType.HTTP;
/**
* https
**/
private boolean ignoreSSLCerts = false;
@Deprecated
private SSLSocketFactory sslSocketFactory = null;
private KeyManager[] keyManagers = null;
private X509TrustManager[] x509TrustManagers = null;
private SecureRandom secureRandom = null;
private HostnameVerifier hostnameVerifier = null;
@Deprecated
private String certPath = null;
/**
* dispatcher
**/
private int maxRequests = 64;
private int maxRequestsPerHost = 5;
private Runnable idleCallback = null;
private ExecutorService executorService = null;
/**
* proxy configurations
*/
private String httpProxy = null;
private String httpsProxy = null;
private String noProxy = null;
/**
* extra params
*/
private Map<String, Object> extParams = new HashMap<String, Object>();
private boolean compatibleMode = false;
public static HttpClientConfig getDefault() {
HttpClientConfig config = new HttpClientConfig();
config.setClientType(HttpClientType.ApacheHttpClient);
return config;
}
public HttpClientType getClientType() {
return clientType;
}
public void setClientType(HttpClientType clientType) {
this.clientType = clientType;
}
@Deprecated
public String getCertPath() {
return certPath;
}
/**
* use HttpClientConfig.setX509TrustManagers() and HttpClientConfig.setKeyManagers() instead
*/
@Deprecated
public void setCertPath(String certPath) {
this.certPath = certPath;
}
public int getMaxIdleConnections() {
return maxIdleConnections;
}
public void setMaxIdleConnections(int maxIdleConnections) {
this.maxIdleConnections = maxIdleConnections;
}
public long getMaxIdleTimeMillis() {
return maxIdleTimeMillis;
}
public void setMaxIdleTimeMillis(long maxIdleTimeMillis) {
this.maxIdleTimeMillis = maxIdleTimeMillis;
}
public long getKeepAliveDurationMillis() {
return keepAliveDurationMillis;
}
public void setKeepAliveDurationMillis(long keepAliveDurationMillis) {
this.keepAliveDurationMillis = keepAliveDurationMillis;
}
public long getConnectionTimeoutMillis() {
return connectionTimeoutMillis;
}
public void setConnectionTimeoutMillis(long connectionTimeoutMillis) {
this.connectionTimeoutMillis = connectionTimeoutMillis;
}
public long getReadTimeoutMillis() {
return readTimeoutMillis;
}
public void setReadTimeoutMillis(long readTimeoutMillis) {
this.readTimeoutMillis = readTimeoutMillis;
}
public long getWriteTimeoutMillis() {
return writeTimeoutMillis;
}
public void setWriteTimeoutMillis(long writeTimeoutMillis) {
this.writeTimeoutMillis = writeTimeoutMillis;
}
@Deprecated
public SSLSocketFactory getSslSocketFactory() {
return this.sslSocketFactory;
}
/**
* use HttpClientConfig.setX509TrustManagers() and HttpClientConfig.setKeyManagers() instead
*/
@Deprecated
public void setSslSocketFactory(SSLSocketFactory sslSocketFactory) {
this.sslSocketFactory = sslSocketFactory;
}
public KeyManager[] getKeyManagers() {
return keyManagers;
}
public void setKeyManagers(KeyManager[] keyManagers) {
this.keyManagers = keyManagers;
}
public X509TrustManager[] getX509TrustManagers() {
return x509TrustManagers;
}
public void setX509TrustManagers(X509TrustManager[] x509TrustManagers) {
this.x509TrustManagers = x509TrustManagers;
}
public SecureRandom getSecureRandom() {
return secureRandom;
}
public void setSecureRandom(SecureRandom secureRandom) {
this.secureRandom = secureRandom;
}
public HostnameVerifier getHostnameVerifier() {
return hostnameVerifier;
}
public void setHostnameVerifier(HostnameVerifier hostnameVerifier) {
this.hostnameVerifier = hostnameVerifier;
}
public int getMaxRequests() {
return maxRequests;
}
public void setMaxRequests(int maxRequests) {
this.maxRequests = maxRequests;
}
public int getMaxRequestsPerHost() {
return maxRequestsPerHost;
}
public void setMaxRequestsPerHost(int maxRequestsPerHost) {
this.maxRequestsPerHost = maxRequestsPerHost;
}
public Runnable getIdleCallback() {
return idleCallback;
}
public void setIdleCallback(Runnable idleCallback) {
this.idleCallback = idleCallback;
}
public ExecutorService getExecutorService() {
return executorService;
}
public void setExecutorService(ExecutorService executorService) {
this.executorService = executorService;
}
public Map<String, Object> getExtParams() {
return extParams;
}
public void setExtParams(Map<String, Object> extParams) {
this.extParams = extParams;
}
public String getCustomClientClassName() {
return customClientClassName;
}
public void setCustomClientClassName(String customClientClassName) {
this.customClientClassName = customClientClassName;
}
public Object getExtParam(Object key) {
return extParams.get(key);
}
public Object setExtParam(String key, Object value) {
return extParams.put(key, value);
}
public boolean containsExtParam(Object key) {
return extParams.containsKey(key);
}
public boolean isIgnoreSSLCerts() {
return ignoreSSLCerts;
}
public void setIgnoreSSLCerts(boolean ignoreSSLCerts) {
this.ignoreSSLCerts = ignoreSSLCerts;
}
public boolean isCompatibleMode() {
return compatibleMode;
}
public void setCompatibleMode(boolean compatibleMode) {
this.compatibleMode = compatibleMode;
}
public ProtocolType getProtocolType() {
return protocolType;
}
public void setProtocolType(ProtocolType protocolType) {
this.protocolType = protocolType;
}
public String getHttpProxy() {
return httpProxy;
}
public void setHttpProxy(String httpProxy) {
this.httpProxy = httpProxy;
}
public String getHttpsProxy() {
return httpsProxy;
}
public void setHttpsProxy(String httpsProxy) {
this.httpsProxy = httpsProxy;
}
public String getNoProxy() {
return noProxy;
}
public void setNoProxy(String noProxy) {
this.noProxy = noProxy;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/HttpClientFactory.java
|
package com.alicloud.http;
import com.alicloud.http.clients.ApacheHttpClient;
import com.alicloud.http.clients.CompatibleUrlConnClient;
import com.alicloud.profile.IClientProfile;
import com.alicloud.utils.StringUtils;
import java.lang.reflect.Constructor;
public class HttpClientFactory {
public static String HTTP_CLIENT_IMPL_KEY = "aliyuncs.sdk.httpclient";
public static String COMPATIBLE_HTTP_CLIENT_CLASS_NAME = CompatibleUrlConnClient.class.getName();
public static IHttpClient buildClient(IClientProfile profile) {
try {
HttpClientConfig clientConfig = profile.getHttpClientConfig();
if (clientConfig == null) {
clientConfig = HttpClientConfig.getDefault();
profile.setHttpClientConfig(clientConfig);
}
String customClientClassName = null;
if (clientConfig.isCompatibleMode()) {
customClientClassName = COMPATIBLE_HTTP_CLIENT_CLASS_NAME;
} else if (clientConfig.getClientType() == HttpClientType.Custom && !StringUtils.isEmpty(clientConfig.getCustomClientClassName())) {
customClientClassName = clientConfig.getCustomClientClassName();
} else {
customClientClassName = System.getProperty(HTTP_CLIENT_IMPL_KEY);
}
if (StringUtils.isEmpty(customClientClassName)) {
customClientClassName = clientConfig.getClientType().getImplClass().getName();
}
Class httpClientClass = Class.forName(customClientClassName);
if (!IHttpClient.class.isAssignableFrom(httpClientClass)) {
throw new IllegalStateException(String.format("%s is not assignable from com.alicloud.http.IHttpClient", customClientClassName));
}
if (ApacheHttpClient.class.equals(httpClientClass)) {
IHttpClient client = ApacheHttpClient.getInstance();
client.init(clientConfig);
return client;
}
Constructor<? extends IHttpClient> constructor = httpClientClass.getConstructor(HttpClientConfig.class);
return constructor.newInstance(clientConfig);
} catch (Exception e) {
// keep compatibility
throw new IllegalStateException("HttpClientFactory buildClient failed", e);
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/HttpClientType.java
|
package com.alicloud.http;
import com.alicloud.http.clients.CompatibleUrlConnClient;
public enum HttpClientType {
/**
* define Compatiblen,HttpClient,okHttp,Custom
*/
Compatible(CompatibleUrlConnClient.class),
ApacheHttpClient(com.alicloud.http.clients.ApacheHttpClient.class),
OkHttp(null),
Custom(null),;
private Class<? extends IHttpClient> implClass;
HttpClientType(Class<? extends IHttpClient> implClass) {
this.implClass = implClass;
}
public Class<? extends IHttpClient> getImplClass() {
return implClass;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/HttpMessage.java
|
package com.alicloud.http;
import com.alicloud.exceptions.ClientException;
import com.alicloud.utils.ParameterHelper;
import lombok.ToString;
import javax.net.ssl.KeyManager;
import javax.net.ssl.X509TrustManager;
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ToString
public abstract class HttpMessage {
protected static final String CONTENT_TYPE = "Content-Type";
protected static final String CONTENT_MD5 = "Content-MD5";
protected static final String CONTENT_LENGTH = "Content-Length";
protected FormatType httpContentType = null;
protected byte[] httpContent = null;
protected String encoding = null;
protected Map<String, String> headers = new HashMap<String, String>();
protected Integer connectTimeout = null;
protected Integer readTimeout = null;
private String url = null;
private MethodType method = null;
protected boolean ignoreSSLCerts = false;
private KeyManager[] keyManagers = null;
private X509TrustManager[] x509TrustManagers = null;
public KeyManager[] getKeyManagers() {
return keyManagers;
}
public void setKeyManagers(KeyManager[] keyManagers) {
this.keyManagers = keyManagers;
}
public X509TrustManager[] getX509TrustManagers() {
return x509TrustManagers;
}
public void setX509TrustManagers(X509TrustManager[] x509TrustManagers) {
this.x509TrustManagers = x509TrustManagers;
}
public boolean isIgnoreSSLCerts() {
return ignoreSSLCerts;
}
public void setIgnoreSSLCerts(boolean ignoreSSLCerts) {
this.ignoreSSLCerts = ignoreSSLCerts;
}
public HttpMessage(String strUrl) {
this.url = strUrl;
}
public HttpMessage() {
}
/**
* @Deprecated : Use getSysUrl instead of this
*/
@Deprecated
public String getUrl() {
return url;
}
/**
* @Deprecated : Use setSysUrl instead of this
*/
@Deprecated
protected void setUrl(String url) {
this.url = url;
}
/**
* @Deprecated : Use getSysMethod instead of this
*/
@Deprecated
public MethodType getMethod() {
return method;
}
/**
* @Deprecated : Use setSysMethod instead of this
*/
@Deprecated
public void setMethod(MethodType method) {
this.method = method;
}
public FormatType getHttpContentType() {
return httpContentType;
}
public void setHttpContentType(FormatType httpContentType) {
this.httpContentType = httpContentType;
if (null != this.httpContent || null != httpContentType) {
this.headers.put(CONTENT_TYPE, getContentTypeValue(this.httpContentType, this.encoding));
} else {
this.headers.remove(CONTENT_TYPE);
}
}
public byte[] getHttpContent() {
return httpContent;
}
public void setHttpContent(byte[] content, String encoding, FormatType format) {
if (null == content) {
this.headers.remove(CONTENT_MD5);
this.headers.put(CONTENT_LENGTH, "0");
this.headers.remove(CONTENT_TYPE);
this.httpContentType = null;
this.httpContent = null;
this.encoding = null;
return;
}
// for GET HEADER DELETE OPTION method, sdk should ignore the content
if (getSysMethod() != null && !getSysMethod().hasContent()) {
content = new byte[0];
}
this.httpContent = content;
this.encoding = encoding;
String contentLen = String.valueOf(content.length);
String strMd5 = ParameterHelper.md5Sum(content);
this.headers.put(CONTENT_MD5, strMd5);
this.headers.put(CONTENT_LENGTH, contentLen);
if (null != format) {
this.headers.put(CONTENT_TYPE, FormatType.mapFormatToAccept(format));
}
}
/**
* @Deprecated : Use getSysEncoding instead of this
*/
@Deprecated
public String getEncoding() {
return encoding;
}
/**
* @Deprecated : Use setSysEncoding instead of this
*/
@Deprecated
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public void putHeaderParameter(String name, String value) {
if (null != name && null != value) {
this.headers.put(name, value);
}
}
public String getHeaderValue(String name) {
return this.headers.get(name);
}
/**
* @Deprecated : Use getSysConnectTimeout instead of this
*/
@Deprecated
public Integer getConnectTimeout() {
return connectTimeout;
}
/**
* @Deprecated : Use setSysConnectTimeout instead of this
*/
@Deprecated
public void setConnectTimeout(Integer connectTimeout) {
this.connectTimeout = connectTimeout;
}
/**
* @Deprecated : Use getSysReadTimeout instead of this
*/
@Deprecated
public Integer getReadTimeout() {
return readTimeout;
}
/**
* @Deprecated : Use setSysReadTimeout instead of this
*/
@Deprecated
public void setReadTimeout(Integer readTimeout) {
this.readTimeout = readTimeout;
}
/**
* @Deprecated : Use getSysHeaders instead of this
*/
@Deprecated
public Map<String, String> getHeaders() {
return Collections.unmodifiableMap(headers);
}
public String getContentTypeValue(FormatType contentType, String encoding) {
if (null != contentType && null != encoding) {
return FormatType.mapFormatToAccept(contentType) +
";charset=" + encoding.toLowerCase();
} else if (null != contentType) {
return FormatType.mapFormatToAccept(contentType);
}
return null;
}
public String getHttpContentString() throws ClientException {
String stringContent = "";
if (this.httpContent != null) {
try {
if (this.encoding == null) {
stringContent = new String(this.httpContent);
} else {
stringContent = new String(this.httpContent, this.encoding);
}
} catch (UnsupportedEncodingException exp) {
throw new ClientException("SDK.UnsupportedEncoding", "Can not parse response due to unsupported encoding.");
}
}
return stringContent;
}
public String getSysUrl() {
return url;
}
protected void setSysUrl(String url) {
this.url = url;
}
public MethodType getSysMethod() {
return method;
}
public void setSysMethod(MethodType method) {
this.method = method;
}
public String getSysEncoding() {
return encoding;
}
public void setSysEncoding(String encoding) {
this.encoding = encoding;
}
public Integer getSysConnectTimeout() {
return connectTimeout;
}
public void setSysConnectTimeout(Integer connectTimeout) {
this.connectTimeout = connectTimeout;
}
public Integer getSysReadTimeout() {
return readTimeout;
}
public void setSysReadTimeout(Integer readTimeout) {
this.readTimeout = readTimeout;
}
public Map<String, String> getSysHeaders() {
return Collections.unmodifiableMap(headers);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/HttpRequest.java
|
package com.alicloud.http;
import lombok.ToString;
import java.util.Map;
@ToString(callSuper = true)
public class HttpRequest extends HttpMessage {
public HttpRequest(String strUrl) {
super(strUrl);
}
public HttpRequest(String strUrl, Map<String, String> tmpHeaders) {
super(strUrl);
if (null != tmpHeaders) {
this.headers = tmpHeaders;
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/HttpResponse.java
|
package com.alicloud.http;
import lombok.ToString;
@ToString(callSuper = true)
public class HttpResponse extends HttpMessage {
private int status;
private String reasonPhrase;
public HttpResponse(String strUrl) {
super(strUrl);
}
public HttpResponse() {
}
@Override
public void setHttpContent(byte[] content, String encoding, FormatType format) {
this.httpContent = content;
this.encoding = encoding;
this.httpContentType = format;
}
@Override
public String getHeaderValue(String name) {
String value = this.headers.get(name);
if (null == value) {
value = this.headers.get(name.toLowerCase());
}
return value;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public boolean isSuccess() {
return 200 <= this.status && this.status < 300;
}
public String getReasonPhrase() {
return reasonPhrase;
}
public void setReasonPhrase(String reasonPhrase) {
this.reasonPhrase = reasonPhrase;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/HttpUtil.java
|
package com.alicloud.http;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.SocketAddress;
import java.net.URL;
import java.util.Map;
import java.util.Map.Entry;
import javax.xml.bind.DatatypeConverter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHost;
import com.alicloud.exceptions.ClientException;
import com.alicloud.utils.StringUtils;
public class HttpUtil {
private final static Log log = LogFactory.getLog(HttpUtil.class);
private static Boolean isHttpDebug;
private static Boolean isHttpContentDebug;
static {
Boolean flag = "sdk".equalsIgnoreCase(System.getenv("DEBUG"));
isHttpDebug = flag;
isHttpContentDebug = flag;
}
public static Boolean getIsHttpDebug() {
return isHttpDebug;
}
public static void setIsHttpDebug(Boolean isHttpDebug) {
HttpUtil.isHttpDebug = isHttpDebug;
}
public static Boolean getIsHttpContentDebug() {
return isHttpContentDebug;
}
public static void setIsHttpContentDebug(Boolean isHttpContentDebug) {
HttpUtil.isHttpContentDebug = isHttpContentDebug;
}
public static String debugHttpRequest(HttpRequest request) {
if (isHttpDebug) {
StringBuilder debugString = new StringBuilder();
String sysUrl = request.getSysUrl();
URL url = null;
try {
url = new URL(sysUrl);
debugString.append("> " + request.getSysMethod() + " " + url.getProtocol().toUpperCase() + "/1.1\n> ");
debugString.append("Host : " + url.getHost() + "\n> ");
} catch (MalformedURLException e) {
debugString.append("> " + request.getSysMethod() + " " + sysUrl + "\n> ");
debugString.append("Host : " + sysUrl + "\n> ");
}
Map<String, String> requestHeaders = request.getSysHeaders();
for (Entry<String, String> entry : requestHeaders.entrySet()) {
debugString.append(entry.getKey() + " : " + entry.getValue() + "\n> ");
}
debugString.append("Request URL : " + sysUrl + "\n> ");
if (isHttpContentDebug) {
try {
debugString.append("\n" + request.getHttpContentString());
} catch (ClientException e) {
debugString.append("\n" + "Can not parse response due to unsupported encoding : " + request
.getSysEncoding());
}
}
log.info("\n" + debugString);
return debugString.toString();
} else {
return null;
}
}
public static String debugHttpResponse(HttpResponse response) {
if (isHttpDebug) {
StringBuilder debugString = new StringBuilder();
String protocol = "HTTP/1.1";
debugString.append("< " + protocol + " " + response.getStatus() + "\n< ");
Map<String, String> responseHeaders = response.getSysHeaders();
for (Entry<String, String> entry : responseHeaders.entrySet()) {
debugString.append(entry.getKey() + " : " + entry.getValue() + "\n< ");
}
if (isHttpContentDebug) {
try {
debugString.append("\n" + response.getHttpContentString());
} catch (ClientException e) {
debugString.append("\n" + "Can not parse response due to unsupported encoding : " + response
.getSysEncoding());
}
}
log.info("\n" + debugString);
return debugString.toString();
} else {
return null;
}
}
public static Proxy getJDKProxy(String clientProxy, String envProxy, HttpRequest request) throws ClientException {
Proxy proxy = Proxy.NO_PROXY;
try {
String proxyStr = (!StringUtils.isEmpty(clientProxy) ? clientProxy : envProxy);
if (StringUtils.isEmpty(proxyStr)) {
return proxy;
}
URL proxyUrl = new URL(proxyStr);
String userInfo = proxyUrl.getUserInfo();
if (userInfo != null) {
byte[] bytes = userInfo.getBytes("UTF-8");
String auth = DatatypeConverter.printBase64Binary(bytes);
request.putHeaderParameter("Proxy-Authorization", "Basic " + auth);
}
String hostname = proxyUrl.getHost();
int port = proxyUrl.getPort();
if (port == -1) {
port = proxyUrl.getDefaultPort();
}
SocketAddress addr = new InetSocketAddress(hostname, port);
proxy = new Proxy(Proxy.Type.HTTP, addr);
} catch (IOException e) {
throw new ClientException("SDK.InvalidProxy", "proxy url is invalid");
}
return proxy;
}
public static HttpHost getApacheProxy(String clientProxy, String envProxy, HttpRequest request)
throws ClientException {
try {
String proxyStr = (!StringUtils.isEmpty(clientProxy) ? clientProxy : envProxy);
if (StringUtils.isEmpty(proxyStr)) {
return null;
}
URL proxyUrl = new URL(proxyStr);
String userInfo = proxyUrl.getUserInfo();
if (userInfo != null) {
byte[] bytes = userInfo.getBytes("UTF-8");
String auth = DatatypeConverter.printBase64Binary(bytes);
request.putHeaderParameter("Proxy-Authorization", "Basic " + auth);
}
return new HttpHost(proxyUrl.getHost(), proxyUrl.getPort(), proxyUrl.getProtocol());
} catch (IOException e) {
throw new ClientException("SDK.InvalidProxy", "proxy url is invalid");
}
}
public static boolean needProxy(String targetHost, String clientNoProxyList, String envNoProxyList) {
String noProxyList = (!StringUtils.isEmpty(clientNoProxyList) ? clientNoProxyList : envNoProxyList);
if (StringUtils.isEmpty(noProxyList)) {
return true;
}
String[] noProxyArr = noProxyList.split(",");
for (String host : noProxyArr) {
if (host.equals(targetHost)) {
return false;
}
}
return true;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/IHttpClient.java
|
package com.alicloud.http;
import com.alicloud.exceptions.ClientException;
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.Future;
public abstract class IHttpClient implements Closeable {
protected HttpClientConfig clientConfig;
public IHttpClient(HttpClientConfig clientConfig) throws ClientException {
if (clientConfig == null) {
clientConfig = HttpClientConfig.getDefault();
}
this.clientConfig = clientConfig;
init(clientConfig);
}
public IHttpClient() {
// do nothing
}
protected abstract void init(HttpClientConfig clientConfig) throws ClientException;
public abstract HttpResponse syncInvoke(HttpRequest apiRequest) throws IOException, ClientException;
public abstract Future<HttpResponse> asyncInvoke(final HttpRequest apiRequest, final CallBack callback)
throws IOException;
@Deprecated
public abstract void ignoreSSLCertificate();
@Deprecated
public abstract void restoreSSLCertificate();
public abstract boolean isSingleton();
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/MethodType.java
|
package com.alicloud.http;
public enum MethodType {
/**
* GET
* PUT
* POST
* DELETE
*/
GET(false),
PUT(true),
POST(true),
DELETE(false),
HEAD(false),
OPTIONS(false);
private boolean hasContent;
MethodType(boolean hasContent) {
this.hasContent = hasContent;
}
public boolean hasContent() {
return hasContent;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/ProtocolType.java
|
package com.alicloud.http;
public enum ProtocolType {
/**
* Define HTTP、HTTPS
*/
HTTP("http"),
HTTPS("https");
private final String protocol;
ProtocolType(String protocol) {
this.protocol = protocol;
}
@Override
public String toString() {
return protocol;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/UserAgentConfig.java
|
package com.alicloud.http;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import com.alicloud.utils.StringUtils;
public class UserAgentConfig {
static {
Properties sysProps = System.getProperties();
String coreVersion = "";
Properties props = new Properties();
try {
props.load(UserAgentConfig.class.getClassLoader().getResourceAsStream("project.properties"));
coreVersion = props.getProperty("sdk.project.version");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
DEFAULT_MESSAGE = String.format("AlibabaCloud (%s; %s) Java/%s %s/%s", sysProps.getProperty("os.name"), sysProps
.getProperty("os.arch"), sysProps.getProperty("java.runtime.version"), "Core", coreVersion);
}
private static String DEFAULT_MESSAGE;
private List<String> excludeList = new ArrayList<String>();
private final Map<String, String> userAgents = new LinkedHashMap<String, String>();
public UserAgentConfig() {
excludeList.add("java");
excludeList.add("Core");
}
public static String getDefaultMessage() {
return DEFAULT_MESSAGE;
}
public void append(String key, String value) {
if (StringUtils.isEmpty(key) || StringUtils.isEmpty(value)) {
return;
}
if (excludeList.contains(key.toLowerCase())) {
return;
}
this.userAgents.put(key, value);
}
public Map<String, String> getSysUserAgentsMap() {
return Collections.unmodifiableMap(this.userAgents);
}
public static String resolve(UserAgentConfig requestConfig, UserAgentConfig clientConfig) {
Map<String, String> finalMap = new LinkedHashMap<String, String>();
if (clientConfig != null && clientConfig.getSysUserAgentsMap().size() > 0) {
finalMap.putAll(clientConfig.getSysUserAgentsMap());
}
if (requestConfig != null && requestConfig.getSysUserAgentsMap().size() > 0) {
finalMap.putAll(requestConfig.getSysUserAgentsMap());
}
StringBuilder agents = new StringBuilder(DEFAULT_MESSAGE);
for (Map.Entry<String, String> entry : finalMap.entrySet()) {
agents.append(" ");
agents.append(entry.getKey());
agents.append("/");
agents.append(entry.getValue());
}
return agents.toString();
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/X509TrustAll.java
|
package com.alicloud.http;
import com.alicloud.IAcsClient;
@Deprecated
public final class X509TrustAll {
public static boolean ignoreSSLCerts = false;
@Deprecated
public static void restoreSSLCertificate() {
ignoreSSLCerts = false;
}
@Deprecated
public static void ignoreSSLCertificate() {
ignoreSSLCerts = true;
}
@Deprecated
public static void restoreSSLCertificate(IAcsClient client) {
ignoreSSLCerts = false;
}
@Deprecated
public static void ignoreSSLCertificate(IAcsClient client) {
ignoreSSLCerts = true;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/clients/ApacheHttpClient.java
|
package com.alicloud.http.clients;
import com.alicloud.exceptions.ClientException;
import com.alicloud.http.*;
import com.alicloud.utils.EnvironmentUtils;
import com.alicloud.utils.IOUtils;
import com.alicloud.utils.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.EntityBuilder;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.ConnectionKeepAliveStrategy;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
import javax.net.ssl.*;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.KeyStore;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
public class ApacheHttpClient extends IHttpClient {
protected static final String CONTENT_TYPE = "Content-Type";
protected static final String ACCEPT_ENCODING = "Accept-Encoding";
private static final String EXT_PARAM_KEY_BUILDER = "apache.httpclient.builder";
private static final int DEFAULT_THREAD_KEEP_ALIVE_TIME = 60;
private ExecutorService executorService;
private CloseableHttpClient httpClient;
private PoolingHttpClientConnectionManager connectionManager;
private AtomicBoolean initialized = new AtomicBoolean(false);
private CountDownLatch latch = new CountDownLatch(1);
private static volatile ApacheHttpClient client;
/**
* use ApacheHttpClient.getInstance() instead
*/
@Deprecated
public static ApacheHttpClient getInstance(HttpClientConfig config) throws ClientException {
throw new IllegalStateException("use ApacheHttpClient.getInstance() instead");
}
public static ApacheHttpClient getInstance() {
if (client == null) {
synchronized (ApacheHttpClient.class) {
if (client == null) {
client = new ApacheHttpClient();
}
}
}
return client;
}
private ApacheHttpClient() {
super();
}
private SSLConnectionSocketFactory createSSLConnectionSocketFactory() throws ClientException {
try {
List<TrustManager> trustManagerList = new ArrayList<TrustManager>();
X509TrustManager[] trustManagers = clientConfig.getX509TrustManagers();
if (null != trustManagers) {
trustManagerList.addAll(Arrays.asList(trustManagers));
}
// get trustManager using default certification from jdk
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init((KeyStore) null);
trustManagerList.addAll(Arrays.asList(tmf.getTrustManagers()));
final List<X509TrustManager> finalTrustManagerList = new ArrayList<X509TrustManager>();
for (TrustManager tm : trustManagerList) {
if (tm instanceof X509TrustManager) {
finalTrustManagerList.add((X509TrustManager) tm);
}
}
CompositeX509TrustManager compositeX509TrustManager = new CompositeX509TrustManager(finalTrustManagerList);
compositeX509TrustManager.setIgnoreSSLCert(clientConfig.isIgnoreSSLCerts());
KeyManager[] keyManagers = null;
if (clientConfig.getKeyManagers() != null) {
keyManagers = clientConfig.getKeyManagers();
}
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(keyManagers, new TrustManager[]{compositeX509TrustManager}, clientConfig.getSecureRandom());
HostnameVerifier hostnameVerifier = null;
if (clientConfig.isIgnoreSSLCerts()) {
hostnameVerifier = new NoopHostnameVerifier();
} else if (clientConfig.getHostnameVerifier() != null) {
hostnameVerifier = clientConfig.getHostnameVerifier();
} else {
hostnameVerifier = new DefaultHostnameVerifier();
}
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
return sslConnectionSocketFactory;
} catch (Exception e) {
throw new ClientException("SDK.InitFailed", "Init https with SSL socket failed", e);
}
}
private void initConnectionManager() throws ClientException {
// http
RegistryBuilder<ConnectionSocketFactory> socketFactoryRegistryBuilder = RegistryBuilder.create();
socketFactoryRegistryBuilder.register("http", new PlainConnectionSocketFactory());
// https
SSLConnectionSocketFactory sslConnectionSocketFactory = createSSLConnectionSocketFactory();
socketFactoryRegistryBuilder.register("https", sslConnectionSocketFactory);
// connPool
connectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistryBuilder.build());
connectionManager.setMaxTotal(clientConfig.getMaxRequests());
connectionManager.setDefaultMaxPerRoute(clientConfig.getMaxRequestsPerHost());
}
private HttpClientBuilder initHttpClientBuilder() {
HttpClientBuilder builder;
if (clientConfig.containsExtParam(EXT_PARAM_KEY_BUILDER)) {
builder = (HttpClientBuilder) clientConfig.getExtParam(EXT_PARAM_KEY_BUILDER);
} else {
builder = HttpClientBuilder.create();
}
return builder;
}
private void initExecutor() {
// async
if (clientConfig.getExecutorService() == null) {
executorService = new ThreadPoolExecutor(0, clientConfig.getMaxRequests(), DEFAULT_THREAD_KEEP_ALIVE_TIME,
TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new DefaultAsyncThreadFactory());
} else {
executorService = clientConfig.getExecutorService();
}
}
@Override
protected void init(final HttpClientConfig config0) throws ClientException {
if (!initialized.compareAndSet(false, true)) {
try {
latch.await();
} catch (InterruptedException e) {
throw new ClientException("SDK.InitFailed", "Init apacheHttpClient failed", e);
}
return;
}
final HttpClientConfig config = (config0 != null ? config0 : HttpClientConfig.getDefault());
this.clientConfig = config;
HttpClientBuilder builder = initHttpClientBuilder();
// default request config
RequestConfig defaultConfig = RequestConfig.custom().setConnectTimeout((int) config
.getConnectionTimeoutMillis()).setSocketTimeout((int) config.getReadTimeoutMillis())
.setConnectionRequestTimeout((int) config.getWriteTimeoutMillis()).build();
builder.setDefaultRequestConfig(defaultConfig);
initConnectionManager();
builder.setConnectionManager(connectionManager);
ApacheIdleConnectionCleaner.registerConnectionManager(connectionManager, config.getMaxIdleTimeMillis());
initExecutor();
// keepAlive
if (config.getKeepAliveDurationMillis() > 0) {
builder.setKeepAliveStrategy(new ConnectionKeepAliveStrategy() {
@Override
public long getKeepAliveDuration(org.apache.http.HttpResponse response, HttpContext context) {
long duration = DefaultConnectionKeepAliveStrategy.INSTANCE.getKeepAliveDuration(response, context);
if (duration > 0 && duration < config.getKeepAliveDurationMillis()) {
return duration;
} else {
return config.getKeepAliveDurationMillis();
}
}
});
}
httpClient = builder.build();
latch.countDown();
}
private HttpUriRequest parseToHttpRequest(HttpRequest apiReq) throws IOException, ClientException {
RequestBuilder builder = RequestBuilder.create(apiReq.getSysMethod().name());
builder.setUri(apiReq.getSysUrl());
if (apiReq.getSysMethod().hasContent() && apiReq.getHttpContent() != null && apiReq.getHttpContent().length > 0) {
EntityBuilder bodyBuilder = EntityBuilder.create();
String contentType = apiReq.getHeaderValue(CONTENT_TYPE);
if (StringUtils.isEmpty(contentType)) {
contentType = apiReq.getContentTypeValue(apiReq.getHttpContentType(), apiReq.getSysEncoding());
}
bodyBuilder.setContentType(ContentType.parse(contentType));
bodyBuilder.setBinary(apiReq.getHttpContent());
builder.setEntity(bodyBuilder.build());
}
builder.addHeader(ACCEPT_ENCODING, "identity");
// calcProxy will modify the "Proxy-Authorization" header of the request
HttpHost proxy = calcProxy(apiReq);
for (Map.Entry<String, String> entry : apiReq.getSysHeaders().entrySet()) {
if ("Content-Length".equalsIgnoreCase(entry.getKey())) {
continue;
}
builder.addHeader(entry.getKey(), entry.getValue());
}
int connectTimeout;
int readTimeout;
if (null != apiReq.getSysConnectTimeout()) {
connectTimeout = apiReq.getSysConnectTimeout();
} else {
connectTimeout = (int) clientConfig.getConnectionTimeoutMillis();
}
if (null != apiReq.getSysReadTimeout()) {
readTimeout = apiReq.getSysReadTimeout();
} else {
readTimeout = (int) clientConfig.getReadTimeoutMillis();
}
RequestConfig requestConfig = RequestConfig.custom().setProxy(proxy).setConnectTimeout(connectTimeout).setSocketTimeout(
readTimeout).setConnectionRequestTimeout((int) clientConfig.getWriteTimeoutMillis()).build();
builder.setConfig(requestConfig);
return builder.build();
}
private HttpHost calcProxy(HttpRequest apiReq) throws MalformedURLException, ClientException {
boolean needProxy = HttpUtil.needProxy(new URL(apiReq.getSysUrl()).getHost(), clientConfig.getNoProxy(), EnvironmentUtils.getNoProxy());
if (!needProxy) {
return null;
}
URL url = new URL(apiReq.getSysUrl());
HttpHost proxy = null;
if ("https".equalsIgnoreCase(url.getProtocol())) {
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpsProxy(), EnvironmentUtils.getHttpsProxy(), apiReq);
} else {
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpProxy(), EnvironmentUtils.getHttpProxy(), apiReq);
}
return proxy;
}
private HttpResponse parseToHttpResponse(org.apache.http.HttpResponse httpResponse) throws IOException {
com.alicloud.http.HttpResponse result = new com.alicloud.http.HttpResponse();
// status code
result.setStatus(httpResponse.getStatusLine().getStatusCode());
result.setReasonPhrase(httpResponse.getStatusLine().getReasonPhrase());
boolean existed = ((httpResponse.getEntity() != null && (httpResponse.getEntity().getContentLength() > 0 || httpResponse
.getEntity().isChunked())));
if (existed){
// content type
Header contentTypeHeader = httpResponse.getEntity().getContentType();
ContentType contentType = ContentType.parse(contentTypeHeader.getValue());
FormatType formatType = FormatType.mapAcceptToFormat(contentType.getMimeType());
result.setHttpContentType(formatType);
String charset = "utf-8";
if (contentType.getCharset() != null) {
charset = contentType.getCharset().toString();
}
// body
result.setHttpContent(EntityUtils.toByteArray(httpResponse.getEntity()), charset, formatType);
}
// headers
for (Header header : httpResponse.getAllHeaders()) {
result.putHeaderParameter(header.getName(), header.getValue());
}
return result;
}
@Override
public final HttpResponse syncInvoke(HttpRequest apiRequest) throws IOException, ClientException {
HttpUriRequest httpRequest = parseToHttpRequest(apiRequest);
CloseableHttpResponse httpResponse = null;
try {
httpResponse = httpClient.execute(httpRequest);
return parseToHttpResponse(httpResponse);
} finally {
IOUtils.closeQuietly(httpResponse);
}
}
@Override
public final Future<com.alicloud.http.HttpResponse> asyncInvoke(final HttpRequest apiRequest,
final CallBack callback) {
return executorService.submit(new Callable<com.alicloud.http.HttpResponse>() {
@Override
public com.alicloud.http.HttpResponse call() throws Exception {
com.alicloud.http.HttpResponse result;
try {
result = syncInvoke(apiRequest);
} catch (Exception e) {
if (callback != null) {
callback.onFailure(apiRequest, e);
}
throw e;
}
if (callback != null) {
callback.onResponse(apiRequest, result);
}
return result;
}
});
}
/**
* use HttpClientConfig.setIgnoreSSLCerts(true) instead
*/
@Override
public void ignoreSSLCertificate() {
throw new IllegalStateException("Apache httpclient does not support modify sslFactory after inited, "
+ "use HttpClientConfig.setIgnoreSSLCerts(true) while building client");
}
/**
* use HttpClientConfig.setIgnoreSSLCerts(false) instead
*/
@Override
public void restoreSSLCertificate() {
throw new IllegalStateException("Apache httpclient does not support modify sslFactory after inited, "
+ "use HttpClientConfig.setIgnoreSSLCerts(true) while building client");
}
@Override
public boolean isSingleton() {
return true;
}
@Override
public void close() throws IOException {
client = null;
if (initialized.compareAndSet(true, false)) {
executorService.shutdown();
ApacheIdleConnectionCleaner.removeConnectionManager(connectionManager);
connectionManager.shutdown();
IOUtils.closeQuietly(httpClient);
}
}
private class DefaultAsyncThreadFactory implements ThreadFactory {
private AtomicInteger counter = new AtomicInteger(0);
@Override
public Thread newThread(Runnable runnable) {
return new Thread(runnable, "Aliyun_SDK_Async_ThreadPool_" + counter.incrementAndGet());
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/clients/ApacheIdleConnectionCleaner.java
|
package com.alicloud.http.clients;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.conn.HttpClientConnectionManager;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
public class ApacheIdleConnectionCleaner extends Thread {
private static final Log LOG = LogFactory.getLog(ApacheIdleConnectionCleaner.class);
public static int getPeriodSec() {
return periodSec;
}
public static void setPeriodSec(int periodSec) {
ApacheIdleConnectionCleaner.periodSec = periodSec;
}
private static final int DEFAULT_PERIOD_SEC = 60;
private static int periodSec = DEFAULT_PERIOD_SEC;
private static final Map<HttpClientConnectionManager, Long> CONNMGRMAP = new ConcurrentHashMap<HttpClientConnectionManager, Long>();
private static volatile ApacheIdleConnectionCleaner instance;
private volatile boolean isShuttingDown;
private ApacheIdleConnectionCleaner() {
super("sdk-apache-idle-connection-cleaner");
setDaemon(true);
}
public static void registerConnectionManager(HttpClientConnectionManager connMgr, Long idleTimeMills) {
if (instance == null) {
synchronized (ApacheIdleConnectionCleaner.class) {
if (instance == null) {
instance = new ApacheIdleConnectionCleaner();
instance.start();
}
}
}
CONNMGRMAP.put(connMgr, idleTimeMills);
}
public static void removeConnectionManager(HttpClientConnectionManager connectionManager) {
CONNMGRMAP.remove(connectionManager);
if (CONNMGRMAP.isEmpty()) {
shutdown();
}
}
public static void shutdown() {
if (instance != null) {
instance.isShuttingDown = true;
instance.interrupt();
CONNMGRMAP.clear();
instance = null;
}
}
@Override
public void run() {
while (true) {
if (isShuttingDown) {
LOG.debug("Shutting down.");
return;
}
try {
Thread.sleep(periodSec * 1000);
for (Entry<HttpClientConnectionManager, Long> entry : CONNMGRMAP.entrySet()) {
try {
entry.getKey().closeIdleConnections(entry.getValue(), TimeUnit.MILLISECONDS);
} catch (Exception t) {
LOG.warn("close idle connections failed", t);
}
}
} catch (InterruptedException e) {
LOG.debug("interrupted.", e);
}
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/http/clients/CompatibleUrlConnClient.java
|
package com.alicloud.http.clients;
import com.alicloud.exceptions.ClientException;
import com.alicloud.http.*;
import com.alicloud.utils.EnvironmentUtils;
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import javax.net.ssl.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.Proxy;
import java.net.URL;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.Future;
public class CompatibleUrlConnClient extends IHttpClient {
protected static final String CONTENT_TYPE = "Content-Type";
protected static final String ACCEPT_ENCODING = "Accept-Encoding";
public CompatibleUrlConnClient(HttpClientConfig clientConfig) throws ClientException {
super(clientConfig);
}
public static HttpResponse compatibleGetResponse(HttpRequest request) throws IOException, ClientException {
CompatibleUrlConnClient client = new CompatibleUrlConnClient(null);
HttpResponse response = client.syncInvoke(request);
client.close();
return response;
}
@Override
protected void init(HttpClientConfig clientConfig) {
// do nothing
}
@Override
public HttpResponse syncInvoke(HttpRequest request) throws IOException, ClientException {
InputStream content = null;
HttpResponse response = null;
HttpURLConnection httpConn = buildHttpConnection(request);
OutputStream out = null;
try {
httpConn.connect();
if (null != request.getHttpContent() && request.getHttpContent().length > 0) {
out = httpConn.getOutputStream();
if (request.getSysMethod().hasContent()) {
out.write(request.getHttpContent());
}
out.flush();
}
content = httpConn.getInputStream();
response = new HttpResponse(httpConn.getURL().toString());
parseHttpConn(response, httpConn, content);
return response;
} catch (IOException e) {
content = httpConn.getErrorStream();
response = new HttpResponse(httpConn.getURL().toString());
parseHttpConn(response, httpConn, content);
return response;
} finally {
if (content != null) {
content.close();
}
httpConn.disconnect();
}
}
@Override
public Future<HttpResponse> asyncInvoke(HttpRequest apiRequest, CallBack callback) {
throw new IllegalStateException("not supported");
}
private boolean calcIgnoreSSLCert(HttpRequest request) {
boolean ignoreSSLCert = request.isIgnoreSSLCerts() ? request.isIgnoreSSLCerts() : clientConfig.isIgnoreSSLCerts();
return ignoreSSLCert;
}
private CompositeX509TrustManager calcX509TrustManager(HttpRequest request) throws KeyStoreException, NoSuchAlgorithmException {
X509TrustManager[] trustManagers = null;
if (clientConfig.getX509TrustManagers() != null) {
trustManagers = clientConfig.getX509TrustManagers();
}
if (request.getX509TrustManagers() != null) {
trustManagers = request.getX509TrustManagers();
}
List<TrustManager> trustManagerList = new ArrayList<TrustManager>();
if (null != trustManagers) {
trustManagerList.addAll(Arrays.asList(trustManagers));
}
// get trustManager using default certification from jdk
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init((KeyStore) null);
trustManagerList.addAll(Arrays.asList(tmf.getTrustManagers()));
final List<X509TrustManager> finalTrustManagerList = new ArrayList<X509TrustManager>();
for (TrustManager tm : trustManagerList) {
if (tm instanceof X509TrustManager) {
finalTrustManagerList.add((X509TrustManager) tm);
}
}
CompositeX509TrustManager compositeX509TrustManager = new CompositeX509TrustManager(finalTrustManagerList);
compositeX509TrustManager.setIgnoreSSLCert(calcIgnoreSSLCert(request));
return compositeX509TrustManager;
}
private KeyManager[] calcKeyManager(HttpRequest request) {
KeyManager[] keyManagers = null;
if (clientConfig.getKeyManagers() != null) {
keyManagers = clientConfig.getKeyManagers();
}
if (request.getKeyManagers() != null) {
keyManagers = request.getKeyManagers();
}
return keyManagers;
}
private SSLSocketFactory createSSLSocketFactory(HttpRequest request) throws ClientException {
try {
CompositeX509TrustManager compositeX509TrustManager = calcX509TrustManager(request);
KeyManager[] keyManagers = calcKeyManager(request);
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(keyManagers, new TrustManager[]{compositeX509TrustManager}, clientConfig.getSecureRandom());
return sslContext.getSocketFactory();
} catch (Exception e) {
throw new ClientException("SDK.InitFailed", "Init https with SSL socket failed", e);
}
}
private HostnameVerifier createHostnameVerifier(HttpRequest request) {
boolean ignoreSSLCert = request.isIgnoreSSLCerts() ? request.isIgnoreSSLCerts() : clientConfig.isIgnoreSSLCerts();
if (ignoreSSLCert) {
return new NoopHostnameVerifier();
} else if (clientConfig.getHostnameVerifier() != null) {
return clientConfig.getHostnameVerifier();
} else {
return new DefaultHostnameVerifier();
}
}
private void checkHttpRequest(HttpRequest request) {
String strUrl = request.getSysUrl();
if (null == strUrl) {
throw new IllegalArgumentException("URL is null for HttpRequest.");
}
if (null == request.getSysMethod()) {
throw new IllegalArgumentException("Method is not set for HttpRequest.");
}
}
private Proxy calcProxy(URL url, HttpRequest request) throws ClientException {
String targetHost = url.getHost();
boolean needProxy = HttpUtil.needProxy(targetHost, clientConfig.getNoProxy(), EnvironmentUtils.getNoProxy());
if (!needProxy) {
return Proxy.NO_PROXY;
}
Proxy proxy;
if ("https".equalsIgnoreCase(url.getProtocol())) {
String httpsProxy = EnvironmentUtils.getHttpsProxy();
proxy = HttpUtil.getJDKProxy(clientConfig.getHttpsProxy(), httpsProxy, request);
} else {
String httpProxy = EnvironmentUtils.getHttpProxy();
proxy = HttpUtil.getJDKProxy(clientConfig.getHttpProxy(), httpProxy, request);
}
return proxy;
}
private HttpURLConnection initHttpConnection(URL url, HttpRequest request) throws ClientException, IOException {
HttpURLConnection httpConn = null;
Proxy proxy = calcProxy(url, request);
if ("https".equalsIgnoreCase(url.getProtocol())) {
SSLSocketFactory sslSocketFactory = createSSLSocketFactory(request);
HttpsURLConnection httpsConn = (HttpsURLConnection) url.openConnection(proxy);
httpsConn.setSSLSocketFactory(sslSocketFactory);
HostnameVerifier hostnameVerifier = createHostnameVerifier(request);
httpsConn.setHostnameVerifier(hostnameVerifier);
httpConn = httpsConn;
}
if (httpConn == null) {
httpConn = (HttpURLConnection) url.openConnection(proxy);
}
httpConn.setRequestMethod(request.getSysMethod().toString());
httpConn.setInstanceFollowRedirects(false);
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
httpConn.setUseCaches(false);
setConnectionTimeout(httpConn, request);
setConnectionRequestProperty(httpConn, request);
return httpConn;
}
private void setConnectionTimeout(HttpURLConnection httpConn, HttpRequest request) {
if (request.getSysConnectTimeout() != null) {
httpConn.setConnectTimeout(request.getSysConnectTimeout());
} else {
httpConn.setConnectTimeout((int) clientConfig.getConnectionTimeoutMillis());
}
if (request.getSysReadTimeout() != null) {
httpConn.setReadTimeout(request.getSysReadTimeout());
} else {
httpConn.setReadTimeout((int) clientConfig.getReadTimeoutMillis());
}
}
private void setConnectionRequestProperty(HttpURLConnection httpConn, HttpRequest request) {
Map<String, String> mappedHeaders = request.getSysHeaders();
httpConn.setRequestProperty(ACCEPT_ENCODING, "identity");
for (Entry<String, String> entry : mappedHeaders.entrySet()) {
httpConn.setRequestProperty(entry.getKey(), entry.getValue());
}
if (null != request.getHeaderValue(CONTENT_TYPE)) {
httpConn.setRequestProperty(CONTENT_TYPE, request.getHeaderValue(CONTENT_TYPE));
} else {
String contentTypeValue = request.getContentTypeValue(request.getHttpContentType(), request
.getSysEncoding());
if (null != contentTypeValue) {
httpConn.setRequestProperty(CONTENT_TYPE, contentTypeValue);
}
}
}
private HttpURLConnection buildHttpConnection(HttpRequest request) throws IOException, ClientException {
checkHttpRequest(request);
String strUrl = request.getSysUrl();
URL url = null;
String[] urlArray = null;
if (MethodType.POST.equals(request.getSysMethod()) && null == request.getHttpContent()) {
urlArray = strUrl.split("\\?");
url = new URL(urlArray[0]);
} else {
url = new URL(strUrl);
}
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
HttpURLConnection httpConn = initHttpConnection(url, request);
if (MethodType.POST.equals(request.getSysMethod()) && null != urlArray && urlArray.length == 2) {
httpConn.getOutputStream().write(urlArray[1].getBytes());
}
return httpConn;
}
private void parseHttpConn(HttpResponse response, HttpURLConnection httpConn, InputStream content)
throws IOException {
byte[] buff = readContent(content);
response.setStatus(httpConn.getResponseCode());
response.setReasonPhrase(httpConn.getResponseMessage());
Map<String, List<String>> headers = httpConn.getHeaderFields();
for (Entry<String, List<String>> entry : headers.entrySet()) {
String key = entry.getKey();
if (null == key) {
continue;
}
List<String> values = entry.getValue();
StringBuilder builder = new StringBuilder(values.get(0));
for (int i = 1; i < values.size(); i++) {
builder.append(",");
builder.append(values.get(i));
}
response.putHeaderParameter(key, builder.toString());
}
String type = response.getHeaderValue("Content-Type");
if (null != buff && null != type) {
response.setSysEncoding("UTF-8");
String[] split = type.split(";");
response.setHttpContentType(FormatType.mapAcceptToFormat(split[0].trim()));
if (split.length > 1 && split[1].contains("=")) {
String[] codings = split[1].split("=");
response.setSysEncoding(codings[1].trim().toUpperCase());
}
}
response.setHttpContent(buff, response.getSysEncoding(), response.getHttpContentType());
}
private byte[] readContent(InputStream content) throws IOException {
if (content == null) {
return null;
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
byte[] buff = new byte[1024];
while (true) {
final int read = content.read(buff);
if (read == -1) {
break;
}
outputStream.write(buff, 0, read);
}
return outputStream.toByteArray();
}
/**
* use HttpClientConfig.setIgnoreSSLCerts(true) instead
*/
@Override
public void ignoreSSLCertificate() {
throw new IllegalStateException("use HttpClientConfig.setIgnoreSSLCerts(true) instead");
}
/**
* use HttpClientConfig.setIgnoreSSLCerts(false) instead
*/
@Override
public void restoreSSLCertificate() {
throw new IllegalStateException("use HttpClientConfig.setIgnoreSSLCerts(false) instead");
}
@Override
public boolean isSingleton() {
return false;
}
@Override
public void close() {
// do nothing
}
/**
* use HttpClientConfig.setIgnoreSSLCerts(true/false) instead
*/
@Deprecated
public static final class HttpsCertIgnoreHelper {
/**
* use HttpClientConfig.setIgnoreSSLCerts(false) instead
*/
@Deprecated
public static void restoreSSLCertificate() {
X509TrustAll.ignoreSSLCerts = false;
}
/**
* use HttpClientConfig.setIgnoreSSLCerts(true) instead
*/
@Deprecated
public static void ignoreSSLCertificate() {
X509TrustAll.ignoreSSLCerts = true;
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/profile/DefaultProfile.java
|
package com.alicloud.profile;
import com.alicloud.auth.*;
import com.alicloud.endpoint.DefaultEndpointResolver;
import com.alicloud.exceptions.ClientException;
import com.alicloud.http.FormatType;
import com.alicloud.http.HttpClientConfig;
import org.slf4j.Logger;
import static com.alicloud.utils.LogUtils.DEFAULT_LOG_FORMAT;
@SuppressWarnings("deprecation")
public class DefaultProfile implements IClientProfile {
private static DefaultProfile profile = null;
private String regionId = null;
private FormatType acceptFormat = null;
private ICredentialProvider icredential = null;
private Credential credential;
private String certPath;
private HttpClientConfig httpClientConfig = HttpClientConfig.getDefault();
private boolean usingInternalLocationService = false;
private boolean usingVpcEndpoint = false;
private Logger logger;
private String logFormat = DEFAULT_LOG_FORMAT;
private DefaultProfile() {
}
private DefaultProfile(String regionId) {
this.regionId = regionId;
}
private DefaultProfile(String regionId, Credential creden) {
this.credential = creden;
this.regionId = regionId;
}
private DefaultProfile(String region, ICredentialProvider icredential) {
this.regionId = region;
this.icredential = icredential;
}
public synchronized static DefaultProfile getProfile() {
if (null == profile) {
profile = new DefaultProfile();
}
return profile;
}
public synchronized static DefaultProfile getProfile(String regionId, ICredentialProvider icredential) {
profile = new DefaultProfile(regionId, icredential);
return profile;
}
public synchronized static DefaultProfile getProfile(String regionId, String accessKeyId, String secret) {
Credential creden = new Credential(accessKeyId, secret);
profile = new DefaultProfile(regionId, creden);
return profile;
}
public synchronized static DefaultProfile getProfile(String regionId, String accessKeyId, String secret,
String stsToken) {
Credential creden = new Credential(accessKeyId, secret, stsToken);
profile = new DefaultProfile(regionId, creden);
return profile;
}
public synchronized static DefaultProfile getProfile(String regionId) {
return new DefaultProfile(regionId);
}
/**
* @Deprecated : Use addEndpoint(String regionId, String product, String endpoint) instead of this
*/
@Deprecated
public synchronized static void addEndpoint(String endpointName, String regionId, String product, String domain)
throws ClientException {
addEndpoint(endpointName, regionId, product, domain, true);
}
/**
* @Deprecated : Use addEndpoint(String regionId, String product, String endpoint) instead of this
*/
@Deprecated
public synchronized static void addEndpoint(String endpointName, String regionId, String product, String domain,
boolean isNeverExpire) {
// endpointName, isNeverExpire take no effect
addEndpoint(regionId, product, domain);
}
public synchronized static void addEndpoint(String regionId, String product, String endpoint) {
DefaultEndpointResolver.predefinedEndpointResolver.putEndpointEntry(regionId, product, endpoint);
}
@Override
public synchronized String getRegionId() {
return regionId;
}
@Override
public synchronized FormatType getFormat() {
return acceptFormat;
}
@Override
public synchronized Credential getCredential() {
if (null == credential && null != icredential) {
credential = icredential.fresh();
}
return credential;
}
@Override
@Deprecated
public ISigner getSigner() {
return null;
}
@Override
public void setCredentialsProvider(AlibabaCloudCredentialsProvider credentialsProvider) {
if (credential != null) {
return;
}
credential = new CredentialsBackupCompatibilityAdaptor(credentialsProvider);
}
@Override
public String getCertPath() {
return certPath;
}
@Override
public void setCertPath(String certPath) {
this.certPath = certPath;
}
@Override
public HttpClientConfig getHttpClientConfig() {
return httpClientConfig;
}
@Override
public void setHttpClientConfig(HttpClientConfig httpClientConfig) {
this.httpClientConfig = httpClientConfig;
}
@Override
public void enableUsingInternalLocationService() {
usingInternalLocationService = true;
}
@Override
public boolean isUsingInternalLocationService() {
return usingInternalLocationService;
}
@Override
public boolean isUsingVpcEndpoint() {
return usingVpcEndpoint;
}
@Override
public void enableUsingVpcEndpoint() {
this.usingVpcEndpoint = true;
}
/**
* @deprecated : use enableUsingInternalLocationService instead of this.
*/
@Override
@Deprecated
public void setUsingInternalLocationService() {
enableUsingInternalLocationService();
}
@Override
public Logger getLogger() {
return logger;
}
@Override
public void setLogger(Logger logger) {
this.logger = logger;
}
@Override
public String getLogFormat() {
return logFormat;
}
@Override
public void setLogFormat(String logFormat) {
this.logFormat = logFormat;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/profile/IClientProfile.java
|
package com.alicloud.profile;
import com.alicloud.auth.AlibabaCloudCredentialsProvider;
import com.alicloud.auth.Credential;
import com.alicloud.auth.ISigner;
import com.alicloud.http.FormatType;
import com.alicloud.http.HttpClientConfig;
import org.slf4j.Logger;
@SuppressWarnings("deprecation")
public interface IClientProfile {
/**
* @Deprecated : Use Signer.getSigner(AlibabaCloudCredentials credentials) instead of this
*/
@Deprecated
ISigner getSigner();
String getRegionId();
FormatType getFormat();
/**
* @Deprecated : Use AlibabaCloudCredentialsProvider getCredentials() instead of this
*/
@Deprecated
Credential getCredential();
/**
* This method exists because ClientProfile holds too much modules like endpoint management
*
* @param credentialsProvider
*/
void setCredentialsProvider(AlibabaCloudCredentialsProvider credentialsProvider);
/**
* use HttpClientConfig.getCertPath instead
*/
@Deprecated
String getCertPath();
/**
* use HttpClientConfig.setCertPath instead
*
* @param certPath
*/
@Deprecated
void setCertPath(String certPath);
/**
* http client configs
*/
HttpClientConfig getHttpClientConfig();
void setHttpClientConfig(HttpClientConfig httpClientConfig);
void enableUsingInternalLocationService();
boolean isUsingInternalLocationService();
boolean isUsingVpcEndpoint();
void enableUsingVpcEndpoint();
/**
* @Deprecated : Use enableUsingInternalLocationService instead of this
*/
@Deprecated
void setUsingInternalLocationService();
Logger getLogger();
void setLogger(Logger logger);
String getLogFormat();
void setLogFormat(String logFormat);
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/reader/JsonReader.java
|
package com.alicloud.reader;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.HashMap;
import java.util.Map;
@Deprecated
public class JsonReader implements Reader {
private static final Object ARRAY_END_TOKEN = new Object();
private static final Object OBJECT_END_TOKEN = new Object();
private static final Object COMMA_TOKEN = new Object();
private static final Object COLON_TOKEN = new Object();
private static final int FIRST_POSITION = 0;
private static final int CURRENT_POSITION = 1;
private static final int NEXT_POSITION = 2;
private static Map<Character, Character> escapes = new HashMap<Character, Character>();
static {
escapes.put(Character.valueOf('\\'), Character.valueOf('\\'));
escapes.put(Character.valueOf('/'), Character.valueOf('/'));
escapes.put(Character.valueOf('"'), Character.valueOf('"'));
escapes.put(Character.valueOf('t'), Character.valueOf('\t'));
escapes.put(Character.valueOf('n'), Character.valueOf('\n'));
escapes.put(Character.valueOf('r'), Character.valueOf('\r'));
escapes.put(Character.valueOf('b'), Character.valueOf('\b'));
escapes.put(Character.valueOf('f'), Character.valueOf('\f'));
}
private CharacterIterator ct;
private char c;
private Object token;
private StringBuffer stringBuffer = new StringBuffer();
private Map<String, String> map = new HashMap<String, String>();
public static String trimFromLast(String str, String stripString) {
int pos = str.lastIndexOf(stripString);
if (pos > -1) {
return str.substring(0, pos);
} else {
return str;
}
}
@Override
public Map<String, String> read(String response, String endpoint) {
return read(new StringCharacterIterator(response), endpoint, FIRST_POSITION);
}
@Override
public Map<String, String> readForHideArrayItem(String response, String endpoint) {
return readForHideItem(new StringCharacterIterator(response), endpoint, FIRST_POSITION);
}
public Map<String, String> read(CharacterIterator ci, String endpoint, int start) {
ct = ci;
switch (start) {
case FIRST_POSITION:
c = ct.first();
break;
case CURRENT_POSITION:
c = ct.current();
break;
case NEXT_POSITION:
c = ct.next();
break;
default:
break;
}
readJson(endpoint);
return map;
}
public Map<String, String> readForHideItem(CharacterIterator ci, String endpoint, int start) {
ct = ci;
switch (start) {
case FIRST_POSITION:
c = ct.first();
break;
case CURRENT_POSITION:
c = ct.current();
break;
case NEXT_POSITION:
c = ct.next();
break;
}
readJsonForHideItem(endpoint);
return map;
}
private Object readJson(String baseKey) {
skipWhiteSpace();
char ch = c;
nextChar();
switch (ch) {
case '{':
processObject(baseKey);
break;
case '}':
token = OBJECT_END_TOKEN;
break;
case '[':
if (c == '"') {
processList(baseKey);
break;
} else {
processArray(baseKey);
break;
}
case ']':
token = ARRAY_END_TOKEN;
break;
case '"':
token = processString();
break;
case ',':
token = COMMA_TOKEN;
break;
case ':':
token = COLON_TOKEN;
break;
case 't':
nextChar();
nextChar();
nextChar();
token = Boolean.TRUE;
break;
case 'n':
nextChar();
nextChar();
nextChar();
token = null;
break;
case 'f':
nextChar();
nextChar();
nextChar();
nextChar();
token = Boolean.FALSE;
break;
default:
c = ct.previous();
if (Character.isDigit(c) || c == '-') {
token = processNumber();
}
}
return token;
}
private Object readJsonForHideItem(String baseKey) {
skipWhiteSpace();
char ch = c;
nextChar();
switch (ch) {
case '{':
processObjectForHideItemName(baseKey);
break;
case '}':
token = OBJECT_END_TOKEN;
break;
case '[':
if (c == '"') {
processListForHideItem(baseKey);
break;
} else {
processArrayForHideItem(baseKey);
break;
}
case ']':
token = ARRAY_END_TOKEN;
break;
case '"':
token = processString();
break;
case ',':
token = COMMA_TOKEN;
break;
case ':':
token = COLON_TOKEN;
break;
case 't':
nextChar();
nextChar();
nextChar();
token = Boolean.TRUE;
break;
case 'n':
nextChar();
nextChar();
nextChar();
token = null;
break;
case 'f':
nextChar();
nextChar();
nextChar();
nextChar();
token = Boolean.FALSE;
break;
default:
c = ct.previous();
if (Character.isDigit(c) || c == '-') {
token = processNumber();
}
}
return token;
}
private void processObject(String baseKey) {
String key = baseKey + "." + readJson(baseKey);
while (!token.equals(OBJECT_END_TOKEN)) {
readJson(key);
if (!token.equals(OBJECT_END_TOKEN)) {
Object object = readJson(key);
if (object instanceof String || object instanceof Number || object instanceof Boolean) {
map.put(key, String.valueOf(object));
}
if (readJson(key) == COMMA_TOKEN) {
key = String.valueOf(readJson(key));
key = baseKey + "." + key;
}
}
}
}
private void processObjectForHideItemName(String baseKey) {
String key = baseKey + "." + readJsonForHideItem(baseKey);
while (!token.equals(OBJECT_END_TOKEN)) {
readJsonForHideItem(key);
if (!token.equals(OBJECT_END_TOKEN)) {
Object object = readJsonForHideItem(key);
if (object instanceof String || object instanceof Number || object instanceof Boolean) {
map.put(key, String.valueOf(object));
}
if (readJson(key) == COMMA_TOKEN) {
key = String.valueOf(readJson(key));
key = baseKey + "." + key;
}
}
}
}
private void processList(String baseKey) {
Object value = readJson(baseKey);
int index = 0;
while (!token.equals(ARRAY_END_TOKEN)) {
String key = trimFromLast(baseKey, ".") + "[" + (index++) + "]";
map.put(key, String.valueOf(value));
if (readJson(baseKey) == COMMA_TOKEN) {
value = readJson(baseKey);
}
}
map.put(trimFromLast(baseKey, ".") + ".Length", String.valueOf(index));
}
private void processListForHideItem(String baseKey) {
Object value = readJsonForHideItem(baseKey);
int index = 0;
while (!token.equals(ARRAY_END_TOKEN)) {
String key = baseKey + "[" + (index++) + "]";
map.put(key, String.valueOf(value));
if (readJsonForHideItem(baseKey) == COMMA_TOKEN) {
value = readJsonForHideItem(baseKey);
}
}
map.put(baseKey + ".Length", String.valueOf(index));
}
private void processArray(String baseKey) {
int index = 0;
String preKey = baseKey.substring(0, baseKey.lastIndexOf("."));
String key = preKey + "[" + index + "]";
Object value = readJson(key);
while (!token.equals(ARRAY_END_TOKEN)) {
map.put(preKey + ".Length", String.valueOf(index + 1));
if (value instanceof String) {
map.put(key, String.valueOf(value));
}
if (readJson(baseKey) == COMMA_TOKEN) {
key = preKey + "[" + (++index) + "]";
value = readJson(key);
}
}
}
private void processArrayForHideItem(String baseKey) {
int index = 0;
String preKey = baseKey;
String key = preKey + "[" + index + "]";
Object value = readJsonForHideItem(key);
while (!token.equals(ARRAY_END_TOKEN)) {
map.put(preKey + ".Length", String.valueOf(index + 1));
if (value instanceof String) {
map.put(key, String.valueOf(value));
}
if (readJsonForHideItem(baseKey) == COMMA_TOKEN) {
key = preKey + "[" + (++index) + "]";
value = readJsonForHideItem(key);
}
}
}
private Object processNumber() {
stringBuffer.setLength(0);
if ('-' == c) {
addChar();
}
addDigits();
if ('.' == c) {
addChar();
addDigits();
}
if ('e' == c || 'E' == c) {
addChar();
if ('+' == c || '-' == c) {
addChar();
}
addDigits();
}
return stringBuffer.toString();
}
private void addDigits() {
while (Character.isDigit(c)) {
addChar();
}
}
private void skipWhiteSpace() {
while (Character.isWhitespace(c)) {
nextChar();
}
}
private char nextChar() {
c = ct.next();
return c;
}
private Object processString() {
stringBuffer.setLength(0);
while (c != '"') {
if (c == '\\') {
nextChar();
Object value = escapes.get(Character.valueOf(c));
if (value != null) {
addChar(((Character) value).charValue());
}
} else {
addChar();
}
}
nextChar();
return stringBuffer.toString();
}
private void addChar(char ch) {
stringBuffer.append(ch);
nextChar();
}
private void addChar() {
addChar(c);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/reader/Reader.java
|
package com.alicloud.reader;
import com.alicloud.exceptions.ClientException;
import java.util.Map;
@Deprecated
public interface Reader {
Map<String, String> read(String response, String endpoint) throws ClientException;
Map<String, String> readForHideArrayItem(String response, String endpoint) throws ClientException;
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/reader/ReaderFactory.java
|
package com.alicloud.reader;
import com.alicloud.http.FormatType;
@Deprecated
public class ReaderFactory {
public static Reader createInstance(FormatType format) {
if (FormatType.JSON == format) {
return new JsonReader();
}
if (FormatType.XML == format) {
return new XmlReader();
}
throw new IllegalStateException("Server response has a bad format type: " + format);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/reader/XmlReader.java
|
package com.alicloud.reader;
import com.alicloud.exceptions.ClientException;
import com.alicloud.utils.XmlUtils;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Deprecated
public class XmlReader implements Reader {
Map<String, String> map = new HashMap<String, String>();
@Override
public Map<String, String> read(String response, String endpoint) throws ClientException {
Element root;
try {
root = XmlUtils.getRootElementFromString(response);
read(root, endpoint, false);
} catch (ParserConfigurationException e) {
new ClientException("SDK.InvalidXMLParser", e.toString());
} catch (SAXException e) {
new ClientException("SDK.InvalidXMLFormat", e.toString());
} catch (IOException e) {
new ClientException("SDK.InvalidContent", e.toString());
}
return map;
}
@Override
public Map<String, String> readForHideArrayItem(String response, String endpoint) throws ClientException {
return read(response, endpoint);
}
private void read(Element element, String path, boolean appendPath) {
path = buildPath(element, path, appendPath);
List<Element> childElements = XmlUtils.getChildElements(element);
if (childElements.size() == 0) {
map.put(path, element.getTextContent());
return;
}
List<Element> listElements = XmlUtils.getChildElements(element, childElements.get(0).getNodeName());
//be list
if (listElements.size() > 1 && childElements.size() == listElements.size()) {
elementsAsList(childElements, path);
//may be list
} else if (listElements.size() == 1 && childElements.size() == 1) {
//as list
elementsAsList(listElements, path);
//as not list
read(childElements.get(0), path, true);
//not list
} else {
for (Element childElement : childElements) {
read(childElement, path, true);
}
}
}
private String buildPath(Element element, String path, boolean appendPath) {
return appendPath ? path + "." + element.getNodeName() : path;
}
private void elementsAsList(List<Element> listElements, String path) {
map.put(path + ".Length", String.valueOf(listElements.size()));
for (int i = 0; i < listElements.size(); i++) {
read(listElements.get(i), path + "[" + i + "]", false);
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/regions/ProductDomain.java
|
package com.alicloud.regions;
public class ProductDomain {
private String productName;
private String domainName;
public ProductDomain(String product, String domain) {
this.productName = product;
this.domainName = domain;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getDomainName() {
return domainName;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/transform/UnmarshallerContext.java
|
package com.alicloud.transform;
import com.alicloud.http.HttpResponse;
import com.alicloud.utils.FlattenMapUtil;
import java.util.List;
import java.util.Map;
public class UnmarshallerContext {
private int httpStatus;
private Map<String, String> responseMap;
private HttpResponse httpResponse;
public Integer integerValue(String key) {
String value = responseMap.get(key);
if (null == value || 0 == value.length()) {
return null;
}
return Integer.valueOf(value);
}
public String stringValue(String key) {
return responseMap.get(key);
}
public Long longValue(String key) {
String value = responseMap.get(key);
if (null == value || 0 == value.length()) {
return null;
}
return Long.valueOf(responseMap.get(key));
}
public Boolean booleanValue(String key) {
String value = responseMap.get(key);
if (null == value || 0 == value.length()) {
return null;
}
return Boolean.valueOf(responseMap.get(key));
}
public Float floatValue(String key) {
String value = responseMap.get(key);
if (null == value || 0 == value.length()) {
return null;
}
return Float.valueOf(responseMap.get(key));
}
public Double doubleValue(String key) {
String value = responseMap.get(key);
if (null == value || 0 == value.length()) {
return null;
}
return Double.valueOf(responseMap.get(key));
}
public int lengthValue(String key) {
String value = responseMap.get(key);
if (null == value || 0 == value.length()) {
return 0;
}
return Integer.valueOf(responseMap.get(key));
}
public List<Map<Object, Object>> listMapValue(String key) {
return FlattenMapUtil.toListMap(responseMap, key);
}
public Map<Object, Object> mapValue(String key) {
return FlattenMapUtil.toMap(responseMap, key);
}
public int getHttpStatus() {
return httpStatus;
}
public void setHttpStatus(int httpStatus) {
this.httpStatus = httpStatus;
}
public Map<String, String> getResponseMap() {
return responseMap;
}
public void setResponseMap(Map<String, String> responseMap) {
this.responseMap = responseMap;
}
public HttpResponse getHttpResponse() {
return httpResponse;
}
public void setHttpResponse(HttpResponse httpResponse) {
this.httpResponse = httpResponse;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/unmarshaller/JsonUnmashaller.java
|
package com.alicloud.unmarshaller;
import com.alicloud.AcsResponse;
import com.alicloud.exceptions.ClientException;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
public class JsonUnmashaller implements Unmarshaller {
@Override
public <T extends AcsResponse> T unmarshal(Class<T> clazz, String content) throws ClientException {
try {
return (new Gson()).fromJson(content, clazz);
} catch (JsonSyntaxException e) {
throw newUnmarshalException(clazz, content, e);
}
}
private ClientException newUnmarshalException(Class<?> clazz, String content, Exception e) {
return new ClientException("SDK.UnmarshalFailed",
"unmarshal response from json content failed, clazz = " + clazz.getSimpleName() + ", origin response = " + content, e);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/unmarshaller/Unmarshaller.java
|
package com.alicloud.unmarshaller;
import com.alicloud.AcsResponse;
import com.alicloud.exceptions.ClientException;
public interface Unmarshaller {
<T extends AcsResponse> T unmarshal(Class<T> clasz, String content) throws ClientException;
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/unmarshaller/UnmarshallerFactory.java
|
package com.alicloud.unmarshaller;
import com.alicloud.http.FormatType;
public class UnmarshallerFactory {
public static Unmarshaller getUnmarshaller(FormatType format) throws IllegalStateException {
switch (format) {
case JSON:
return new JsonUnmashaller();
case XML:
return new XmlUnmashaller();
default:
throw new IllegalStateException("Unsupported response format: " + format);
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/unmarshaller/XmlUnmashaller.java
|
package com.alicloud.unmarshaller;
import com.alicloud.AcsResponse;
import com.alicloud.exceptions.ClientException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import java.io.StringReader;
public class XmlUnmashaller implements Unmarshaller {
@Override
public <T extends AcsResponse> T unmarshal(Class<T> clazz, String content) throws ClientException {
try {
JAXBContext jc = JAXBContext.newInstance(clazz);
javax.xml.bind.Unmarshaller unmarshaller = jc.createUnmarshaller();
return (T) unmarshaller.unmarshal(new StringReader(content));
} catch (JAXBException e) {
throw newUnmarshalException(clazz, content, e);
}
}
private ClientException newUnmarshalException(Class<?> clazz, String xmlContent, Exception e) {
return new ClientException("SDK.UnmarshalFailed",
"unmarshal response from xml content failed, clazz = " + clazz.getSimpleName() + ", origin response = " + xmlContent, e);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/AuthUtils.java
|
package com.alicloud.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class AuthUtils {
private static volatile String clientType = System.getenv("ALIBABA_CLOUD_PROFILE");
private static volatile String environmentAccessKeyId;
private static volatile String environmentAccesskeySecret;
private static volatile String environmentECSMetaData;
private static volatile String environmentCredentialsFile;
private static volatile String privateKey;
public static String getPrivateKey(String filePath) {
if (null == privateKey) {
synchronized (AuthUtils.class) {
if (null == privateKey) {
FileInputStream in = null;
byte[] buffer;
try {
in = new FileInputStream(new File(filePath));
buffer = new byte[in.available()];
in.read(buffer);
privateKey = new String(buffer, "UTF-8");
} catch (IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
}
return privateKey;
}
public static void setPrivateKey(String key) {
privateKey = key;
}
public static String getClientType() {
if (null == clientType) {
AuthUtils.clientType = "default";
return AuthUtils.clientType;
} else {
return AuthUtils.clientType;
}
}
public static void setClientType(String clientType) {
AuthUtils.clientType = clientType;
}
public static String getEnvironmentAccessKeyId() {
if (null == AuthUtils.environmentAccessKeyId) {
return System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID");
} else {
return AuthUtils.environmentAccessKeyId;
}
}
public static void setEnvironmentAccessKeyId(String environmentAccessKeyId) {
AuthUtils.environmentAccessKeyId = environmentAccessKeyId;
}
public static String getEnvironmentAccessKeySecret() {
if (null == AuthUtils.environmentAccesskeySecret) {
return System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET");
} else {
return AuthUtils.environmentAccesskeySecret;
}
}
public static void setEnvironmentAccessKeySecret(String environmentAccesskeySecret) {
AuthUtils.environmentAccesskeySecret = environmentAccesskeySecret;
}
public static String getEnvironmentECSMetaData() {
if (null == AuthUtils.environmentECSMetaData) {
return System.getenv("ALIBABA_CLOUD_ECS_METADATA");
} else {
return AuthUtils.environmentECSMetaData;
}
}
public static void setEnvironmentECSMetaData(String environmentECSMetaData) {
AuthUtils.environmentECSMetaData = environmentECSMetaData;
}
public static String getEnvironmentCredentialsFile() {
if (null == AuthUtils.environmentCredentialsFile) {
return System.getenv("ALIBABA_CLOUD_CREDENTIALS_FILE");
} else {
return AuthUtils.environmentCredentialsFile;
}
}
public static void setEnvironmentCredentialsFile(String environmentCredentialsFile) {
AuthUtils.environmentCredentialsFile = environmentCredentialsFile;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/Base64Helper.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.alicloud.utils;
import java.io.UnsupportedEncodingException;
public class Base64Helper {
private static final String BASE64_CODE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/";
private static final int[] BASE64_DECODE = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
private static byte[] zeroPad(int length, byte[] bytes) {
byte[] padded = new byte[length];
System.arraycopy(bytes, 0, padded, 0, bytes.length);
return padded;
}
public synchronized static String encode(byte[] buff) {
if (null == buff) {
return null;
}
StringBuilder strBuilder = new StringBuilder("");
int paddingCount = (3 - (buff.length % 3)) % 3;
byte[] stringArray = zeroPad(buff.length + paddingCount, buff);
for (int i = 0; i < stringArray.length; i += 3) {
int j = ((stringArray[i] & 0xff) << 16) +
((stringArray[i + 1] & 0xff) << 8) +
(stringArray[i + 2] & 0xff);
strBuilder.append(BASE64_CODE.charAt((j >> 18) & 0x3f));
strBuilder.append(BASE64_CODE.charAt((j >> 12) & 0x3f));
strBuilder.append(BASE64_CODE.charAt((j >> 6) & 0x3f));
strBuilder.append(BASE64_CODE.charAt(j & 0x3f));
}
int intPos = strBuilder.length();
for (int i = paddingCount; i > 0; i--) {
strBuilder.setCharAt(intPos - i, '=');
}
return strBuilder.toString();
}
public synchronized static String encode(String string, String encoding)
throws UnsupportedEncodingException {
if (null == string || null == encoding) {
return null;
}
byte[] stringArray = string.getBytes(encoding);
return encode(stringArray);
}
public synchronized static String decode(String string, String encoding) throws
UnsupportedEncodingException {
if (null == string || null == encoding) {
return null;
}
int posIndex = 0;
int decodeLen = string.endsWith("==") ? (string.length() - 2) :
string.endsWith("=") ? (string.length() - 1) : string.length();
byte[] buff = new byte[decodeLen * 3 / 4];
int count4 = decodeLen - decodeLen % 4;
for (int i = 0; i < count4; i += 4) {
int c0 = BASE64_DECODE[string.charAt(i)];
int c1 = BASE64_DECODE[string.charAt(i + 1)];
int c2 = BASE64_DECODE[string.charAt(i + 2)];
int c3 = BASE64_DECODE[string.charAt(i + 3)];
buff[posIndex++] = (byte) (((c0 << 2) | (c1 >> 4)) & 0xFF);
buff[posIndex++] = (byte) ((((c1 & 0xF) << 4) | (c2 >> 2)) & 0xFF);
buff[posIndex++] = (byte) ((((c2 & 3) << 6) | c3) & 0xFF);
}
if (2 <= decodeLen % 4) {
int c0 = BASE64_DECODE[string.charAt(count4)];
int c1 = BASE64_DECODE[string.charAt(count4 + 1)];
buff[posIndex++] = (byte) (((c0 << 2) | (c1 >> 4)) & 0xFF);
if (3 == decodeLen % 4) {
int c2 = BASE64_DECODE[string.charAt(count4 + 2)];
buff[posIndex++] = (byte) ((((c1 & 0xF) << 4) | (c2 >> 2)) & 0xFF);
}
}
return new String(buff, encoding);
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/EnvironmentUtils.java
|
package com.alicloud.utils;
public class EnvironmentUtils {
private static volatile String httpProxy;
private static volatile String httpsProxy;
private static volatile String noProxy;
public static String getHttpProxy() {
if (null == httpProxy) {
String proxy0 = System.getenv("HTTP_PROXY");
String proxy1 = System.getenv("http_proxy");
return (!StringUtils.isEmpty(proxy0) ? proxy0 : proxy1);
} else {
return httpProxy;
}
}
public static void setHttpProxy(String httpProxy) {
EnvironmentUtils.httpProxy = httpProxy;
}
public static String getHttpsProxy() {
if (null == httpsProxy) {
return System.getenv("HTTPS_PROXY");
} else {
return httpsProxy;
}
}
public static void setHttpsProxy(String httpsProxy) {
EnvironmentUtils.httpsProxy = httpsProxy;
}
public static String getNoProxy() {
if (null == noProxy) {
return System.getenv("NO_PROXY");
} else {
return noProxy;
}
}
public static void setNoProxy(String noProxy) {
EnvironmentUtils.noProxy = noProxy;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/FlattenMapUtil.java
|
package com.alicloud.utils;
import java.util.*;
public class FlattenMapUtil {
public static List<Map<Object, Object>> toListMap(Map<String, String> flattenMap, String prefix) {
MapUtils mapUtils = new MapUtils();
return mapUtils.convertMapToListMap(flattenMap, prefix);
}
public static Map<Object, Object> toMap(Map<String, String> flattenMap, String prefix) {
MapUtils mapUtils = new MapUtils();
return mapUtils.convertMapToMap(flattenMap, prefix);
}
public static Object put(Map<String, String> flattenMap, Object object, String[] subKeys, int subKeysIndex) {
if (subKeysIndex >= subKeys.length) {
return object;
}
String key = subKeys[subKeysIndex];
if (key.endsWith("]")) {
int index = parseIndex(key);
if (index == -1) {
return null;
}
ArrayList<Object> arrayList;
if (object == null) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < subKeysIndex; i++) {
sb.append(subKeys[i]).append(".");
}
sb.append(key);
int length = parseLength(flattenMap, sb.toString());
if (length == -1) {
return null;
}
arrayList = new ArrayList<Object>(Collections.nCopies(length, null));
} else {
arrayList = (ArrayList<Object>) object;
}
if (subKeys.length == subKeysIndex + 1) {
arrayList.set(index, flattenMap.get(stringJoin(".", subKeys)));
return arrayList;
} else {
arrayList.set(index, put(flattenMap, arrayList.get(index), subKeys, subKeysIndex + 1));
return arrayList;
}
} else {
HashMap<Object, Object> hashMap;
if (object == null) {
hashMap = new HashMap<Object, Object>();
} else {
hashMap = (HashMap<Object, Object>) object;
}
if (subKeys.length == subKeysIndex + 1) {
hashMap.put(key, flattenMap.get(stringJoin(".", subKeys)));
return hashMap;
} else {
hashMap.put(key, put(flattenMap, hashMap.get(key), subKeys, subKeysIndex + 1));
return hashMap;
}
}
}
public static Object putForMap(Map<String, String> flattenMap, Object object, String[] subKeys, int subKeysIndex) {
if (subKeysIndex >= subKeys.length) {
return object;
}
String key = subKeys[subKeysIndex];
if (key.endsWith("]")) {
int index = parseIndex(key);
if (index == -1) {
return null;
}
if (object != null && !(object instanceof HashMap)) {
return null;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < subKeysIndex; i++) {
sb.append(subKeys[i]).append(".");
}
sb.append(key);
int length = parseLength(flattenMap, sb.toString());
if (length == -1) {
return null;
}
String name = parseArrayName(key);
ArrayList<Object> arrayList;
HashMap<Object, Object> hashMap;
if (object != null) {
hashMap = (HashMap<Object, Object>) object;
if (!(hashMap.get(name) instanceof ArrayList)) {
arrayList = new ArrayList<Object>(Collections.nCopies(length, null));
hashMap.put(name, arrayList);
} else {
arrayList = (ArrayList<Object>) hashMap.get(name);
}
} else {
hashMap = new HashMap<Object, Object>();
arrayList = new ArrayList<Object>(Collections.nCopies(length, null));
hashMap.put(name, arrayList);
object = hashMap;
}
if (subKeys.length == subKeysIndex + 1) {
arrayList.set(index, flattenMap.get(stringJoin(".", subKeys)));
return object;
} else {
arrayList.set(index, putForMap(flattenMap, arrayList.get(index), subKeys, subKeysIndex + 1));
return object;
}
} else {
HashMap<Object, Object> hashMap;
if (object == null) {
hashMap = new HashMap<Object, Object>();
} else {
hashMap = (HashMap<Object, Object>) object;
}
if (subKeys.length == subKeysIndex + 1) {
hashMap.put(key, flattenMap.get(stringJoin(".", subKeys)));
return hashMap;
} else {
hashMap.put(key, putForMap(flattenMap, hashMap.get(key), subKeys, subKeysIndex + 1));
return hashMap;
}
}
}
public static int parseIndex(String key) {
int start = key.indexOf("[");
int end = key.indexOf("]");
if (start == -1 || end == -1 || end <= start) {
return -1;
}
try {
return Integer.parseInt(key.substring(start + 1, end));
} catch (Exception e) {
return -1;
}
}
public static int parseLength(Map<String, String> flattenMap, String key) {
int end = key.lastIndexOf("[");
if (end == -1) {
return -1;
}
try {
return Integer.parseInt(flattenMap.get(key.substring(0, end) + ".Length"));
} catch (Exception e) {
return -1;
}
}
public static String parseArrayName(String key) {
if (key == null) {
return null;
}
int end = key.lastIndexOf("[");
if (end == -1) {
return null;
}
return key.substring(0, end);
}
public static String stringJoin(String delimiter, String... sequences) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < sequences.length; i++) {
sb.append(sequences[i]);
if (i < sequences.length - 1) {
sb.append(delimiter);
}
}
return sb.toString();
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/IOUtils.java
|
package com.alicloud.utils;
import java.io.Closeable;
import java.io.IOException;
public class IOUtils {
public static void closeQuietly(Closeable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (IOException ioe) {
// ignore
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/LogUtils.java
|
package com.alicloud.utils;
import com.alicloud.exceptions.ClientException;
import com.alicloud.http.HttpRequest;
import com.alicloud.http.HttpResponse;
import lombok.Getter;
import lombok.Setter;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class LogUtils {
public final static String REQUEST = "{request}";
public final static String RESPONSE = "{response}";
public final static String TS = "{ts}";
public final static String DATE_ISO_8601 = "{date_iso_8601}";
public final static String DATE_COMMON_LOG = "{date_common_log}";
public final static String HOST = "{host}";
public final static String METHOD = "{method}";
public final static String URI = "{uri}";
public final static String VERSION = "{version}";
public final static String TARGET = "{target}";
public final static String HOSTNAME = "{hostname}";
public final static String CODE = "{code}";
public final static String PHRASE = "{phrase}";
public final static String REQ_HEADERS = "{req_headers}";
public final static String RES_HEADERS = "{res_headers}";
public final static String REQ_BODY = "{req_body}";
public final static String RES_BODY = "{res_body}";
public final static String PID = "{pid}";
public final static String COST = "{cost}";
public final static String START_TIME = "{start_time}";
public final static String TIME = "{time}";
public final static String ERROR = "{error}";
public final static String DEFAULT_LOG_FORMAT =
"{method} {uri} HTTP/{version} {code} {cost} {hostname} {pid} {error}";
public final static Pattern REQ_HEADER_PATTERN = Pattern.compile("\\{req_header_(.*?)\\}");
public final static Pattern RES_HEADER_PATTERN = Pattern.compile("\\{res_header_(.*?)\\}");
public static String fillContent(String format, LogUnit logUnit) {
String content = format.replace(REQUEST, logUnit.getHttpRequest().toString())
.replace(TS, logUnit.getTs())
.replace(DATE_ISO_8601, logUnit.getTs())
.replace(DATE_COMMON_LOG, logUnit.getTs())
.replace(HOST, logUnit.getHost())
.replace(METHOD, logUnit.getMethod())
.replace(URI, logUnit.getUrl())
.replace(VERSION, logUnit.getVersion())
.replace(TARGET, logUnit.getTarget())
.replace(HOSTNAME, logUnit.getHostname())
.replace(ERROR, logUnit.getError())
.replace(REQ_HEADERS, logUnit.getReqHeaders())
.replace(RES_HEADERS, logUnit.getResHeaders())
.replace(REQ_BODY, logUnit.getReqBody())
.replace(PID, logUnit.getPid())
.replace(COST, logUnit.getCost())
.replace(START_TIME, logUnit.getStartTime())
.replace(TIME, logUnit.getTime());
if (null != logUnit.getHttpResponse()) {
content = content.replace(RESPONSE, logUnit.getHttpResponse().toString()).
replace(RES_BODY, logUnit.getResBody()).
replace(PHRASE, logUnit.getPhrase()).
replace(CODE, logUnit.getCode());
}
Matcher m = REQ_HEADER_PATTERN.matcher(content);
while (m.find()) {
String headerKey = m.group(1);
if (null != logUnit.getHttpRequest().getHeaderValue(headerKey)) {
content = content.replace(m.group(), logUnit.getHttpRequest().getHeaderValue(headerKey));
}
}
m = RES_HEADER_PATTERN.matcher(content);
while (m.find()) {
String headerKey = m.group(1);
if (null != logUnit.getHttpResponse().getHeaderValue(headerKey)) {
content = content.replace(m.group(), logUnit.getHttpResponse().getHeaderValue(headerKey));
}
}
return content;
}
public static String utcNow() {
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss:SSS'Z'");
df.setTimeZone(tz);
return df.format(new Date());
}
public static String localeNow() {
TimeZone tz = TimeZone.getDefault();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss:SSS'Z'");
df.setTimeZone(tz);
return df.format(new Date());
}
public static long getCurrentPID() {
String processName =
java.lang.management.ManagementFactory.getRuntimeMXBean().getName();
return Long.parseLong(processName.split("@")[0]);
}
public static String getLocalHostName() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return "unknown host name";
}
public static LogUnit createLogUnit(HttpRequest httpRequest, HttpResponse httpResponse) {
return new LogUnit(httpRequest, httpResponse);
}
@Getter
@Setter
public static class LogUnit {
private HttpRequest httpRequest;
private HttpResponse httpResponse;
private String ts;
private String host;
private String method;
private String url;
private String version = "1.1";
private String target;
private String hostname;
private String code;
private String phrase;
private String reqHeaders;
private String resHeaders;
private String reqBody;
private String resBody;
private String pid;
private String cost;
private String startTime;
private String time;
private String error;
public LogUnit(HttpRequest httpRequest, HttpResponse httpResponse) {
this.httpRequest = httpRequest;
this.httpResponse = httpResponse;
this.ts = utcNow();
try {
URL url = new URL(httpRequest.getSysUrl());
this.host = url.getHost();
this.target = "";
String path = url.getPath();
String query = url.getQuery();
String ref = url.getRef();
if (null != path) {
this.target += path;
}
if (null != query) {
this.target += "?" + query;
}
if (null != ref) {
this.target += "#" + ref;
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
this.method = httpRequest.getSysMethod().name();
this.url = httpRequest.getSysUrl();
this.hostname = getLocalHostName();
this.reqHeaders = httpRequest.getSysHeaders().toString();
try {
this.reqBody = httpRequest.getHttpContentString();
if (null != httpResponse) {
this.resHeaders = httpResponse.getSysHeaders().toString();
this.code = String.valueOf(httpResponse.getStatus());
this.phrase = (httpResponse.getReasonPhrase() != null ? httpResponse.getReasonPhrase() : "");
this.resBody = httpResponse.getHttpContentString();
}
} catch (ClientException e) {
e.printStackTrace();
}
this.pid = String.valueOf(getCurrentPID());
this.time = localeNow();
}
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/MapUtils.java
|
package com.alicloud.utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MapUtils {
public List<Map<Object, Object>> convertMapToListMap(Map<String, String> flattenMap, String prefix) {
List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
for (Map.Entry<String, String> entry : flattenMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.contains(prefix)) {
String[] keys = key.replace(prefix, "").split("\\.");
String pre = prefix + keys[0];
if (keys[0].contains("[")) {
String mapKey = key.replace(pre + ".", "");
int index = Integer.parseInt(keys[0].replace("[", "").replace("]", ""));
list = setList(list, index, mapKey, value);
}
}
}
return list;
}
public Map<Object, Object> convertMapToMap(Map<String, String> flattenMap, String prefix) {
Map<Object, Object> map = new HashMap<Object, Object>();
for (Map.Entry<String, String> entry : flattenMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.contains(prefix)) {
String[] keys = key.replace(prefix, "").split("\\.");
String pre = prefix + keys[0];
String mapKey = key.replace(pre + ".", "");
map = setMap(map, mapKey, value);
}
}
return map;
}
private List<Map<Object, Object>> setList(List<Map<Object, Object>> targetList, int index, String key,
String value) {
List<Map<Object, Object>> list = targetList;
if (null == list) {
list = new ArrayList<Map<Object, Object>>();
}
while (list.size() <= index) {
list.add(new HashMap<Object, Object>());
}
list.set(index, setMap(list.get(index), key, value));
return list;
}
private Map<Object, Object> setMap(Map<Object, Object> targetMap, String key, String value) {
Map<Object, Object> map = targetMap;
if (null == map) {
map = new HashMap<Object, Object>();
}
if (key.contains("[")) {
String[] keys = key.split("\\.");
String listKey = key.substring(0, key.indexOf("["));
int index = Integer.parseInt(key.substring(key.indexOf("[") + 1, key.indexOf("]")));
List<Map<Object, Object>> listObj = (List<Map<Object, Object>>) map.get(listKey);
listObj = setList(listObj, index, key.replace(keys[0] + ".", ""), value);
map.put(listKey, listObj);
} else if (key.contains(".")) {
String[] keys = key.split("\\.");
String mapKey = keys[0];
// exclude *.Length
if (!(map.get(mapKey) instanceof List) && !"Length".equals(keys[1])) {
map.put(mapKey, setMap((Map<Object, Object>) map.get(mapKey),
key.replace(keys[0] + ".", ""), value));
}
} else {
map.put(key, value);
}
return map;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/ParameterHelper.java
|
package com.alicloud.utils;
import com.google.gson.Gson;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class ParameterHelper {
private final static String TIME_ZONE = "GMT";
private final static String FORMAT_ISO8601 = "yyyy-MM-dd'T'HH:mm:ss'Z'";
private final static String FORMAT_RFC2616 = "EEE, dd MMM yyyy HH:mm:ss zzz";
public ParameterHelper() {
}
public static String getUniqueNonce() {
StringBuffer uniqueNonce = new StringBuffer();
UUID uuid = UUID.randomUUID();
uniqueNonce.append(uuid.toString());
uniqueNonce.append(System.currentTimeMillis());
uniqueNonce.append(Thread.currentThread().getId());
return uniqueNonce.toString();
}
public static String getISO8601Time(Date date) {
SimpleDateFormat df = new SimpleDateFormat(FORMAT_ISO8601);
df.setTimeZone(new SimpleTimeZone(0, TIME_ZONE));
return df.format(date);
}
public static String getRFC2616Date(Date date) {
SimpleDateFormat df = new SimpleDateFormat(FORMAT_RFC2616, Locale.ENGLISH);
df.setTimeZone(new SimpleTimeZone(0, TIME_ZONE));
return df.format(date);
}
public static Date parse(String strDate) throws ParseException {
if (null == strDate || "".equals(strDate)) {
return null;
}
// The format contains 4 '
if (strDate.length() == FORMAT_ISO8601.length() - 4) {
return parseISO8601(strDate);
} else if (strDate.length() == FORMAT_RFC2616.length()) {
return parseRFC2616(strDate);
}
return null;
}
public static Date parseISO8601(String strDate) throws ParseException {
if (null == strDate || "".equals(strDate)) {
return null;
}
// The format contains 4 ' symbol
if (strDate.length() != (FORMAT_ISO8601.length() - 4)) {
return null;
}
SimpleDateFormat df = new SimpleDateFormat(FORMAT_ISO8601);
df.setTimeZone(new SimpleTimeZone(0, TIME_ZONE));
return df.parse(strDate);
}
public static Date parseRFC2616(String strDate) throws ParseException {
if (null == strDate || "".equals(strDate) || strDate.length() != FORMAT_RFC2616.length()) {
return null;
}
SimpleDateFormat df = new SimpleDateFormat(FORMAT_RFC2616, Locale.ENGLISH);
df.setTimeZone(new SimpleTimeZone(0, TIME_ZONE));
return df.parse(strDate);
}
public static String md5Sum(byte[] buff) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(buff);
return Base64Helper.encode(messageDigest);
} catch (Exception e) {
// TODO: should not eat the excepiton
}
return null;
}
public static byte[] getXmlData(Map<String, String> params) throws UnsupportedEncodingException {
StringBuilder xml = new StringBuilder();
xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
Iterator<Map.Entry<String, String>> entries = params.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, String> entry = entries.next();
xml.append("<" + entry.getKey() + ">");
xml.append(entry.getValue());
xml.append("</" + entry.getKey() + ">");
}
return xml.toString().getBytes("UTF-8");
}
public static byte[] getJsonData(Map<String, String> params) throws UnsupportedEncodingException {
String json = new Gson().toJson(params);
return json.getBytes("UTF-8");
}
public static byte[] getFormData(Map<String, String> params) throws UnsupportedEncodingException {
StringBuilder result = new StringBuilder();
boolean first = true;
for (Map.Entry<String, String> entry : params.entrySet()) {
if (first) {
first = false;
} else {
result.append("&");
}
result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
result.append("=");
result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
}
return result.toString().getBytes("UTF-8");
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/StringUtils.java
|
package com.alicloud.utils;
public class StringUtils {
public static boolean isEmpty(final CharSequence cs) {
return cs == null || cs.length() == 0;
}
}
|
0
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud
|
java-sources/com/aliyun/alicloud-java-sdk-core/4.4.9/com/alicloud/utils/XmlUtils.java
|
package com.alicloud.utils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
public final class XmlUtils {
public static Document getDocument(String payload)
throws ParserConfigurationException, SAXException, IOException {
if (payload == null || payload.length() < 1) {
return null;
}
StringReader sr = new StringReader(payload);
InputSource source = new InputSource(sr);
Document doc = null;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
doc = builder.parse(source);
} finally {
IOUtils.closeQuietly(source.getByteStream());
}
return doc;
}
public static Element getRootElementFromString(String payload)
throws ParserConfigurationException, SAXException, IOException {
Document doc = getDocument(payload);
if (doc == null) {
return null;
}
return doc.getDocumentElement();
}
public static List<Element> getChildElements(Element parent, String tagName) {
if (null == parent) {
return null;
}
NodeList nodes = parent.getElementsByTagName(tagName);
List<Element> elements = new ArrayList<Element>();
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
if (node.getParentNode() == parent) {
elements.add((Element) node);
}
}
return elements;
}
public static List<Element> getChildElements(Element parent) {
if (null == parent) {
return null;
}
NodeList nodes = parent.getChildNodes();
List<Element> elements = new ArrayList<Element>();
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
elements.add((Element) node);
}
}
return elements;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/Client.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713;
import com.aliyun.tea.*;
import com.aliyun.alicloudproc20210713.models.*;
public class Client extends com.aliyun.teaopenapi.Client {
public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
super(config);
this._endpointRule = "";
this.checkConfig(config);
this._endpoint = this.getEndpoint("alicloudproc", _regionId, _endpointRule, _network, _suffix, _endpointMap, _endpoint);
}
public String getEndpoint(String productId, String regionId, String endpointRule, String network, String suffix, java.util.Map<String, String> endpointMap, String endpoint) throws Exception {
if (!com.aliyun.teautil.Common.empty(endpoint)) {
return endpoint;
}
if (!com.aliyun.teautil.Common.isUnset(endpointMap) && !com.aliyun.teautil.Common.empty(endpointMap.get(regionId))) {
return endpointMap.get(regionId);
}
return com.aliyun.endpointutil.Client.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
public BillingCenterICommandServiceProcessMessageResponse billingCenterICommandServiceProcessMessageWithOptions(BillingCenterICommandServiceProcessMessageRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "BillingCenterICommandServiceProcessMessage"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new BillingCenterICommandServiceProcessMessageResponse());
}
public BillingCenterICommandServiceProcessMessageResponse billingCenterICommandServiceProcessMessage(BillingCenterICommandServiceProcessMessageRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.billingCenterICommandServiceProcessMessageWithOptions(request, runtime);
}
public BillingCenterIVerifyServiceVerifyOrderResponse billingCenterIVerifyServiceVerifyOrderWithOptions(BillingCenterIVerifyServiceVerifyOrderRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "BillingCenterIVerifyServiceVerifyOrder"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new BillingCenterIVerifyServiceVerifyOrderResponse());
}
public BillingCenterIVerifyServiceVerifyOrderResponse billingCenterIVerifyServiceVerifyOrder(BillingCenterIVerifyServiceVerifyOrderRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.billingCenterIVerifyServiceVerifyOrderWithOptions(request, runtime);
}
public BillingCommissionCanRefundResponse billingCommissionCanRefundWithOptions(BillingCommissionCanRefundRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "BillingCommissionCanRefund"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new BillingCommissionCanRefundResponse());
}
public BillingCommissionCanRefundResponse billingCommissionCanRefund(BillingCommissionCanRefundRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.billingCommissionCanRefundWithOptions(request, runtime);
}
public BillingCommissionPayOrderCallbackResponse billingCommissionPayOrderCallbackWithOptions(BillingCommissionPayOrderCallbackRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "BillingCommissionPayOrderCallback"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new BillingCommissionPayOrderCallbackResponse());
}
public BillingCommissionPayOrderCallbackResponse billingCommissionPayOrderCallback(BillingCommissionPayOrderCallbackRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.billingCommissionPayOrderCallbackWithOptions(request, runtime);
}
public BillingCommissionRefundResponse billingCommissionRefundWithOptions(BillingCommissionRefundRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "BillingCommissionRefund"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new BillingCommissionRefundResponse());
}
public BillingCommissionRefundResponse billingCommissionRefund(BillingCommissionRefundRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.billingCommissionRefundWithOptions(request, runtime);
}
public MemberOrderPaidCallBackResponse memberOrderPaidCallBackWithOptions(MemberOrderPaidCallBackRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "MemberOrderPaidCallBack"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new MemberOrderPaidCallBackResponse());
}
public MemberOrderPaidCallBackResponse memberOrderPaidCallBack(MemberOrderPaidCallBackRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.memberOrderPaidCallBackWithOptions(request, runtime);
}
public MemberOrderRefundResponse memberOrderRefundWithOptions(MemberOrderRefundRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "MemberOrderRefund"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new MemberOrderRefundResponse());
}
public MemberOrderRefundResponse memberOrderRefund(MemberOrderRefundRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.memberOrderRefundWithOptions(request, runtime);
}
public MemberOrderVerifyResponse memberOrderVerifyWithOptions(MemberOrderVerifyRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "MemberOrderVerify"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new MemberOrderVerifyResponse());
}
public MemberOrderVerifyResponse memberOrderVerify(MemberOrderVerifyRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.memberOrderVerifyWithOptions(request, runtime);
}
public SupplierOrderLifeResponse supplierOrderLifeWithOptions(SupplierOrderLifeRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "SupplierOrderLife"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new SupplierOrderLifeResponse());
}
public SupplierOrderLifeResponse supplierOrderLife(SupplierOrderLifeRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.supplierOrderLifeWithOptions(request, runtime);
}
public SupplierOrderProduceResponse supplierOrderProduceWithOptions(SupplierOrderProduceRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "SupplierOrderProduce"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new SupplierOrderProduceResponse());
}
public SupplierOrderProduceResponse supplierOrderProduce(SupplierOrderProduceRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.supplierOrderProduceWithOptions(request, runtime);
}
public SupplierOrderVerifyResponse supplierOrderVerifyWithOptions(SupplierOrderVerifyRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.data)) {
query.put("data", request.data);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "SupplierOrderVerify"),
new TeaPair("version", "2021-07-13"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "RPC"),
new TeaPair("reqBodyType", "formData"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new SupplierOrderVerifyResponse());
}
public SupplierOrderVerifyResponse supplierOrderVerify(SupplierOrderVerifyRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
return this.supplierOrderVerifyWithOptions(request, runtime);
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCenterICommandServiceProcessMessageRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCenterICommandServiceProcessMessageRequest extends TeaModel {
@NameInMap("data")
public String data;
public static BillingCenterICommandServiceProcessMessageRequest build(java.util.Map<String, ?> map) throws Exception {
BillingCenterICommandServiceProcessMessageRequest self = new BillingCenterICommandServiceProcessMessageRequest();
return TeaModel.build(map, self);
}
public BillingCenterICommandServiceProcessMessageRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCenterICommandServiceProcessMessageResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCenterICommandServiceProcessMessageResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public BillingCenterICommandServiceProcessMessageResponseBody body;
public static BillingCenterICommandServiceProcessMessageResponse build(java.util.Map<String, ?> map) throws Exception {
BillingCenterICommandServiceProcessMessageResponse self = new BillingCenterICommandServiceProcessMessageResponse();
return TeaModel.build(map, self);
}
public BillingCenterICommandServiceProcessMessageResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public BillingCenterICommandServiceProcessMessageResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public BillingCenterICommandServiceProcessMessageResponse setBody(BillingCenterICommandServiceProcessMessageResponseBody body) {
this.body = body;
return this;
}
public BillingCenterICommandServiceProcessMessageResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCenterICommandServiceProcessMessageResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCenterICommandServiceProcessMessageResponseBody extends TeaModel {
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("requestId")
public String requestId;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static BillingCenterICommandServiceProcessMessageResponseBody build(java.util.Map<String, ?> map) throws Exception {
BillingCenterICommandServiceProcessMessageResponseBody self = new BillingCenterICommandServiceProcessMessageResponseBody();
return TeaModel.build(map, self);
}
public BillingCenterICommandServiceProcessMessageResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public BillingCenterICommandServiceProcessMessageResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public BillingCenterICommandServiceProcessMessageResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public BillingCenterICommandServiceProcessMessageResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public BillingCenterICommandServiceProcessMessageResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public BillingCenterICommandServiceProcessMessageResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCenterIVerifyServiceVerifyOrderRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCenterIVerifyServiceVerifyOrderRequest extends TeaModel {
@NameInMap("data")
public String data;
public static BillingCenterIVerifyServiceVerifyOrderRequest build(java.util.Map<String, ?> map) throws Exception {
BillingCenterIVerifyServiceVerifyOrderRequest self = new BillingCenterIVerifyServiceVerifyOrderRequest();
return TeaModel.build(map, self);
}
public BillingCenterIVerifyServiceVerifyOrderRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCenterIVerifyServiceVerifyOrderResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCenterIVerifyServiceVerifyOrderResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public BillingCenterIVerifyServiceVerifyOrderResponseBody body;
public static BillingCenterIVerifyServiceVerifyOrderResponse build(java.util.Map<String, ?> map) throws Exception {
BillingCenterIVerifyServiceVerifyOrderResponse self = new BillingCenterIVerifyServiceVerifyOrderResponse();
return TeaModel.build(map, self);
}
public BillingCenterIVerifyServiceVerifyOrderResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public BillingCenterIVerifyServiceVerifyOrderResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public BillingCenterIVerifyServiceVerifyOrderResponse setBody(BillingCenterIVerifyServiceVerifyOrderResponseBody body) {
this.body = body;
return this;
}
public BillingCenterIVerifyServiceVerifyOrderResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCenterIVerifyServiceVerifyOrderResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCenterIVerifyServiceVerifyOrderResponseBody extends TeaModel {
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("requestId")
public String requestId;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static BillingCenterIVerifyServiceVerifyOrderResponseBody build(java.util.Map<String, ?> map) throws Exception {
BillingCenterIVerifyServiceVerifyOrderResponseBody self = new BillingCenterIVerifyServiceVerifyOrderResponseBody();
return TeaModel.build(map, self);
}
public BillingCenterIVerifyServiceVerifyOrderResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public BillingCenterIVerifyServiceVerifyOrderResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public BillingCenterIVerifyServiceVerifyOrderResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public BillingCenterIVerifyServiceVerifyOrderResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public BillingCenterIVerifyServiceVerifyOrderResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public BillingCenterIVerifyServiceVerifyOrderResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCommissionCanRefundRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCommissionCanRefundRequest extends TeaModel {
@NameInMap("data")
public String data;
public static BillingCommissionCanRefundRequest build(java.util.Map<String, ?> map) throws Exception {
BillingCommissionCanRefundRequest self = new BillingCommissionCanRefundRequest();
return TeaModel.build(map, self);
}
public BillingCommissionCanRefundRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCommissionCanRefundResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCommissionCanRefundResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public BillingCommissionCanRefundResponseBody body;
public static BillingCommissionCanRefundResponse build(java.util.Map<String, ?> map) throws Exception {
BillingCommissionCanRefundResponse self = new BillingCommissionCanRefundResponse();
return TeaModel.build(map, self);
}
public BillingCommissionCanRefundResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public BillingCommissionCanRefundResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public BillingCommissionCanRefundResponse setBody(BillingCommissionCanRefundResponseBody body) {
this.body = body;
return this;
}
public BillingCommissionCanRefundResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCommissionCanRefundResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCommissionCanRefundResponseBody extends TeaModel {
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("requestId")
public String requestId;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static BillingCommissionCanRefundResponseBody build(java.util.Map<String, ?> map) throws Exception {
BillingCommissionCanRefundResponseBody self = new BillingCommissionCanRefundResponseBody();
return TeaModel.build(map, self);
}
public BillingCommissionCanRefundResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public BillingCommissionCanRefundResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public BillingCommissionCanRefundResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public BillingCommissionCanRefundResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public BillingCommissionCanRefundResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public BillingCommissionCanRefundResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCommissionPayOrderCallbackRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCommissionPayOrderCallbackRequest extends TeaModel {
@NameInMap("data")
public String data;
public static BillingCommissionPayOrderCallbackRequest build(java.util.Map<String, ?> map) throws Exception {
BillingCommissionPayOrderCallbackRequest self = new BillingCommissionPayOrderCallbackRequest();
return TeaModel.build(map, self);
}
public BillingCommissionPayOrderCallbackRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCommissionPayOrderCallbackResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCommissionPayOrderCallbackResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public BillingCommissionPayOrderCallbackResponseBody body;
public static BillingCommissionPayOrderCallbackResponse build(java.util.Map<String, ?> map) throws Exception {
BillingCommissionPayOrderCallbackResponse self = new BillingCommissionPayOrderCallbackResponse();
return TeaModel.build(map, self);
}
public BillingCommissionPayOrderCallbackResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public BillingCommissionPayOrderCallbackResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public BillingCommissionPayOrderCallbackResponse setBody(BillingCommissionPayOrderCallbackResponseBody body) {
this.body = body;
return this;
}
public BillingCommissionPayOrderCallbackResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCommissionPayOrderCallbackResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCommissionPayOrderCallbackResponseBody extends TeaModel {
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("requestId")
public String requestId;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static BillingCommissionPayOrderCallbackResponseBody build(java.util.Map<String, ?> map) throws Exception {
BillingCommissionPayOrderCallbackResponseBody self = new BillingCommissionPayOrderCallbackResponseBody();
return TeaModel.build(map, self);
}
public BillingCommissionPayOrderCallbackResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public BillingCommissionPayOrderCallbackResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public BillingCommissionPayOrderCallbackResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public BillingCommissionPayOrderCallbackResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public BillingCommissionPayOrderCallbackResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public BillingCommissionPayOrderCallbackResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCommissionRefundRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCommissionRefundRequest extends TeaModel {
@NameInMap("data")
public String data;
public static BillingCommissionRefundRequest build(java.util.Map<String, ?> map) throws Exception {
BillingCommissionRefundRequest self = new BillingCommissionRefundRequest();
return TeaModel.build(map, self);
}
public BillingCommissionRefundRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCommissionRefundResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCommissionRefundResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public BillingCommissionRefundResponseBody body;
public static BillingCommissionRefundResponse build(java.util.Map<String, ?> map) throws Exception {
BillingCommissionRefundResponse self = new BillingCommissionRefundResponse();
return TeaModel.build(map, self);
}
public BillingCommissionRefundResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public BillingCommissionRefundResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public BillingCommissionRefundResponse setBody(BillingCommissionRefundResponseBody body) {
this.body = body;
return this;
}
public BillingCommissionRefundResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/BillingCommissionRefundResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class BillingCommissionRefundResponseBody extends TeaModel {
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("requestId")
public String requestId;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static BillingCommissionRefundResponseBody build(java.util.Map<String, ?> map) throws Exception {
BillingCommissionRefundResponseBody self = new BillingCommissionRefundResponseBody();
return TeaModel.build(map, self);
}
public BillingCommissionRefundResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public BillingCommissionRefundResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public BillingCommissionRefundResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public BillingCommissionRefundResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public BillingCommissionRefundResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public BillingCommissionRefundResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/MemberOrderPaidCallBackRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class MemberOrderPaidCallBackRequest extends TeaModel {
@NameInMap("data")
public String data;
public static MemberOrderPaidCallBackRequest build(java.util.Map<String, ?> map) throws Exception {
MemberOrderPaidCallBackRequest self = new MemberOrderPaidCallBackRequest();
return TeaModel.build(map, self);
}
public MemberOrderPaidCallBackRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/MemberOrderPaidCallBackResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class MemberOrderPaidCallBackResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public MemberOrderPaidCallBackResponseBody body;
public static MemberOrderPaidCallBackResponse build(java.util.Map<String, ?> map) throws Exception {
MemberOrderPaidCallBackResponse self = new MemberOrderPaidCallBackResponse();
return TeaModel.build(map, self);
}
public MemberOrderPaidCallBackResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public MemberOrderPaidCallBackResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public MemberOrderPaidCallBackResponse setBody(MemberOrderPaidCallBackResponseBody body) {
this.body = body;
return this;
}
public MemberOrderPaidCallBackResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/MemberOrderPaidCallBackResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class MemberOrderPaidCallBackResponseBody extends TeaModel {
@NameInMap("RequestId")
public String requestId;
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static MemberOrderPaidCallBackResponseBody build(java.util.Map<String, ?> map) throws Exception {
MemberOrderPaidCallBackResponseBody self = new MemberOrderPaidCallBackResponseBody();
return TeaModel.build(map, self);
}
public MemberOrderPaidCallBackResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public MemberOrderPaidCallBackResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public MemberOrderPaidCallBackResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public MemberOrderPaidCallBackResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public MemberOrderPaidCallBackResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public MemberOrderPaidCallBackResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/MemberOrderRefundRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class MemberOrderRefundRequest extends TeaModel {
@NameInMap("data")
public String data;
public static MemberOrderRefundRequest build(java.util.Map<String, ?> map) throws Exception {
MemberOrderRefundRequest self = new MemberOrderRefundRequest();
return TeaModel.build(map, self);
}
public MemberOrderRefundRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/MemberOrderRefundResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class MemberOrderRefundResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public MemberOrderRefundResponseBody body;
public static MemberOrderRefundResponse build(java.util.Map<String, ?> map) throws Exception {
MemberOrderRefundResponse self = new MemberOrderRefundResponse();
return TeaModel.build(map, self);
}
public MemberOrderRefundResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public MemberOrderRefundResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public MemberOrderRefundResponse setBody(MemberOrderRefundResponseBody body) {
this.body = body;
return this;
}
public MemberOrderRefundResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/MemberOrderRefundResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class MemberOrderRefundResponseBody extends TeaModel {
@NameInMap("RequestId")
public String requestId;
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("success")
public String success;
@NameInMap("synchro")
public String synchro;
public static MemberOrderRefundResponseBody build(java.util.Map<String, ?> map) throws Exception {
MemberOrderRefundResponseBody self = new MemberOrderRefundResponseBody();
return TeaModel.build(map, self);
}
public MemberOrderRefundResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public MemberOrderRefundResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public MemberOrderRefundResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public MemberOrderRefundResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public MemberOrderRefundResponseBody setSuccess(String success) {
this.success = success;
return this;
}
public String getSuccess() {
return this.success;
}
public MemberOrderRefundResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/MemberOrderVerifyRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class MemberOrderVerifyRequest extends TeaModel {
@NameInMap("data")
public String data;
public static MemberOrderVerifyRequest build(java.util.Map<String, ?> map) throws Exception {
MemberOrderVerifyRequest self = new MemberOrderVerifyRequest();
return TeaModel.build(map, self);
}
public MemberOrderVerifyRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/MemberOrderVerifyResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class MemberOrderVerifyResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public MemberOrderVerifyResponseBody body;
public static MemberOrderVerifyResponse build(java.util.Map<String, ?> map) throws Exception {
MemberOrderVerifyResponse self = new MemberOrderVerifyResponse();
return TeaModel.build(map, self);
}
public MemberOrderVerifyResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public MemberOrderVerifyResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public MemberOrderVerifyResponse setBody(MemberOrderVerifyResponseBody body) {
this.body = body;
return this;
}
public MemberOrderVerifyResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/MemberOrderVerifyResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class MemberOrderVerifyResponseBody extends TeaModel {
@NameInMap("RequestId")
public String requestId;
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static MemberOrderVerifyResponseBody build(java.util.Map<String, ?> map) throws Exception {
MemberOrderVerifyResponseBody self = new MemberOrderVerifyResponseBody();
return TeaModel.build(map, self);
}
public MemberOrderVerifyResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public MemberOrderVerifyResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public MemberOrderVerifyResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public MemberOrderVerifyResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public MemberOrderVerifyResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public MemberOrderVerifyResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/SupplierOrderLifeRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class SupplierOrderLifeRequest extends TeaModel {
@NameInMap("data")
public String data;
public static SupplierOrderLifeRequest build(java.util.Map<String, ?> map) throws Exception {
SupplierOrderLifeRequest self = new SupplierOrderLifeRequest();
return TeaModel.build(map, self);
}
public SupplierOrderLifeRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/SupplierOrderLifeResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class SupplierOrderLifeResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public SupplierOrderLifeResponseBody body;
public static SupplierOrderLifeResponse build(java.util.Map<String, ?> map) throws Exception {
SupplierOrderLifeResponse self = new SupplierOrderLifeResponse();
return TeaModel.build(map, self);
}
public SupplierOrderLifeResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public SupplierOrderLifeResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public SupplierOrderLifeResponse setBody(SupplierOrderLifeResponseBody body) {
this.body = body;
return this;
}
public SupplierOrderLifeResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/SupplierOrderLifeResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class SupplierOrderLifeResponseBody extends TeaModel {
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("requestId")
public String requestId;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static SupplierOrderLifeResponseBody build(java.util.Map<String, ?> map) throws Exception {
SupplierOrderLifeResponseBody self = new SupplierOrderLifeResponseBody();
return TeaModel.build(map, self);
}
public SupplierOrderLifeResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public SupplierOrderLifeResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public SupplierOrderLifeResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public SupplierOrderLifeResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public SupplierOrderLifeResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public SupplierOrderLifeResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/SupplierOrderProduceRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class SupplierOrderProduceRequest extends TeaModel {
@NameInMap("data")
public String data;
public static SupplierOrderProduceRequest build(java.util.Map<String, ?> map) throws Exception {
SupplierOrderProduceRequest self = new SupplierOrderProduceRequest();
return TeaModel.build(map, self);
}
public SupplierOrderProduceRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/SupplierOrderProduceResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class SupplierOrderProduceResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public SupplierOrderProduceResponseBody body;
public static SupplierOrderProduceResponse build(java.util.Map<String, ?> map) throws Exception {
SupplierOrderProduceResponse self = new SupplierOrderProduceResponse();
return TeaModel.build(map, self);
}
public SupplierOrderProduceResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public SupplierOrderProduceResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public SupplierOrderProduceResponse setBody(SupplierOrderProduceResponseBody body) {
this.body = body;
return this;
}
public SupplierOrderProduceResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/SupplierOrderProduceResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class SupplierOrderProduceResponseBody extends TeaModel {
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("requestId")
public String requestId;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static SupplierOrderProduceResponseBody build(java.util.Map<String, ?> map) throws Exception {
SupplierOrderProduceResponseBody self = new SupplierOrderProduceResponseBody();
return TeaModel.build(map, self);
}
public SupplierOrderProduceResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public SupplierOrderProduceResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public SupplierOrderProduceResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public SupplierOrderProduceResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public SupplierOrderProduceResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public SupplierOrderProduceResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/SupplierOrderVerifyRequest.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class SupplierOrderVerifyRequest extends TeaModel {
@NameInMap("data")
public String data;
public static SupplierOrderVerifyRequest build(java.util.Map<String, ?> map) throws Exception {
SupplierOrderVerifyRequest self = new SupplierOrderVerifyRequest();
return TeaModel.build(map, self);
}
public SupplierOrderVerifyRequest setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/SupplierOrderVerifyResponse.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class SupplierOrderVerifyResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public SupplierOrderVerifyResponseBody body;
public static SupplierOrderVerifyResponse build(java.util.Map<String, ?> map) throws Exception {
SupplierOrderVerifyResponse self = new SupplierOrderVerifyResponse();
return TeaModel.build(map, self);
}
public SupplierOrderVerifyResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public SupplierOrderVerifyResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public SupplierOrderVerifyResponse setBody(SupplierOrderVerifyResponseBody body) {
this.body = body;
return this;
}
public SupplierOrderVerifyResponseBody getBody() {
return this.body;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713
|
java-sources/com/aliyun/alicloudproc20210713/1.0.0/com/aliyun/alicloudproc20210713/models/SupplierOrderVerifyResponseBody.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20210713.models;
import com.aliyun.tea.*;
public class SupplierOrderVerifyResponseBody extends TeaModel {
@NameInMap("RequestId")
public String requestId;
@NameInMap("code")
public String code;
@NameInMap("data")
public String data;
@NameInMap("message")
public String message;
@NameInMap("success")
public Boolean success;
@NameInMap("synchro")
public String synchro;
public static SupplierOrderVerifyResponseBody build(java.util.Map<String, ?> map) throws Exception {
SupplierOrderVerifyResponseBody self = new SupplierOrderVerifyResponseBody();
return TeaModel.build(map, self);
}
public SupplierOrderVerifyResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public SupplierOrderVerifyResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public SupplierOrderVerifyResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public SupplierOrderVerifyResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public SupplierOrderVerifyResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public SupplierOrderVerifyResponseBody setSynchro(String synchro) {
this.synchro = synchro;
return this;
}
public String getSynchro() {
return this.synchro;
}
}
|
0
|
java-sources/com/aliyun/alicloudproc20240104/1.0.0/com/aliyun
|
java-sources/com/aliyun/alicloudproc20240104/1.0.0/com/aliyun/alicloudproc20240104/Client.java
|
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alicloudproc20240104;
import com.aliyun.tea.*;
import com.aliyun.alicloudproc20240104.models.*;
public class Client extends com.aliyun.teaopenapi.Client {
public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
super(config);
this._endpointRule = "";
this.checkConfig(config);
this._endpoint = this.getEndpoint("alicloudproc", _regionId, _endpointRule, _network, _suffix, _endpointMap, _endpoint);
}
public String getEndpoint(String productId, String regionId, String endpointRule, String network, String suffix, java.util.Map<String, String> endpointMap, String endpoint) throws Exception {
if (!com.aliyun.teautil.Common.empty(endpoint)) {
return endpoint;
}
if (!com.aliyun.teautil.Common.isUnset(endpointMap) && !com.aliyun.teautil.Common.empty(endpointMap.get(regionId))) {
return endpointMap.get(regionId);
}
return com.aliyun.endpointutil.Client.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
public CreateSourcingProjectResponse createSourcingProjectWithOptions(CreateSourcingProjectRequest tmpReq, java.util.Map<String, String> headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(tmpReq);
CreateSourcingProjectShrinkRequest request = new CreateSourcingProjectShrinkRequest();
com.aliyun.openapiutil.Client.convert(tmpReq, request);
if (!com.aliyun.teautil.Common.isUnset(tmpReq.address)) {
request.addressShrink = com.aliyun.openapiutil.Client.arrayToStringWithSpecifiedStyle(tmpReq.address, "Address", "json");
}
if (!com.aliyun.teautil.Common.isUnset(tmpReq.company)) {
request.companyShrink = com.aliyun.openapiutil.Client.arrayToStringWithSpecifiedStyle(tmpReq.company, "Company", "json");
}
if (!com.aliyun.teautil.Common.isUnset(tmpReq.contact)) {
request.contactShrink = com.aliyun.openapiutil.Client.arrayToStringWithSpecifiedStyle(tmpReq.contact, "Contact", "json");
}
if (!com.aliyun.teautil.Common.isUnset(tmpReq.extendInfo)) {
request.extendInfoShrink = com.aliyun.openapiutil.Client.arrayToStringWithSpecifiedStyle(tmpReq.extendInfo, "ExtendInfo", "json");
}
if (!com.aliyun.teautil.Common.isUnset(tmpReq.subjects)) {
request.subjectsShrink = com.aliyun.openapiutil.Client.arrayToStringWithSpecifiedStyle(tmpReq.subjects, "Subjects", "json");
}
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.addressShrink)) {
query.put("Address", request.addressShrink);
}
if (!com.aliyun.teautil.Common.isUnset(request.bizId)) {
query.put("BizId", request.bizId);
}
if (!com.aliyun.teautil.Common.isUnset(request.bizNo)) {
query.put("BizNo", request.bizNo);
}
if (!com.aliyun.teautil.Common.isUnset(request.bizType)) {
query.put("BizType", request.bizType);
}
if (!com.aliyun.teautil.Common.isUnset(request.companyShrink)) {
query.put("Company", request.companyShrink);
}
if (!com.aliyun.teautil.Common.isUnset(request.contactShrink)) {
query.put("Contact", request.contactShrink);
}
if (!com.aliyun.teautil.Common.isUnset(request.createTime)) {
query.put("CreateTime", request.createTime);
}
if (!com.aliyun.teautil.Common.isUnset(request.expireTime)) {
query.put("ExpireTime", request.expireTime);
}
if (!com.aliyun.teautil.Common.isUnset(request.extendInfoShrink)) {
query.put("ExtendInfo", request.extendInfoShrink);
}
if (!com.aliyun.teautil.Common.isUnset(request.sourceUrl)) {
query.put("SourceUrl", request.sourceUrl);
}
if (!com.aliyun.teautil.Common.isUnset(request.subBizType)) {
query.put("SubBizType", request.subBizType);
}
if (!com.aliyun.teautil.Common.isUnset(request.subjectsShrink)) {
query.put("Subjects", request.subjectsShrink);
}
if (!com.aliyun.teautil.Common.isUnset(request.title)) {
query.put("Title", request.title);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", headers),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "CreateSourcingProject"),
new TeaPair("version", "2024-01-04"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/srm/lite/sourcing/create"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "json"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new CreateSourcingProjectResponse());
}
public CreateSourcingProjectResponse createSourcingProject(CreateSourcingProjectRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
java.util.Map<String, String> headers = new java.util.HashMap<>();
return this.createSourcingProjectWithOptions(request, headers, runtime);
}
public UpdateSourcingProjectResponse updateSourcingProjectWithOptions(UpdateSourcingProjectRequest request, java.util.Map<String, String> headers, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
com.aliyun.teautil.Common.validateModel(request);
java.util.Map<String, Object> query = new java.util.HashMap<>();
if (!com.aliyun.teautil.Common.isUnset(request.bizId)) {
query.put("BizId", request.bizId);
}
if (!com.aliyun.teautil.Common.isUnset(request.status)) {
query.put("Status", request.status);
}
if (!com.aliyun.teautil.Common.isUnset(request.updateTime)) {
query.put("UpdateTime", request.updateTime);
}
com.aliyun.teaopenapi.models.OpenApiRequest req = com.aliyun.teaopenapi.models.OpenApiRequest.build(TeaConverter.buildMap(
new TeaPair("headers", headers),
new TeaPair("query", com.aliyun.openapiutil.Client.query(query))
));
com.aliyun.teaopenapi.models.Params params = com.aliyun.teaopenapi.models.Params.build(TeaConverter.buildMap(
new TeaPair("action", "UpdateSourcingProject"),
new TeaPair("version", "2024-01-04"),
new TeaPair("protocol", "HTTPS"),
new TeaPair("pathname", "/srm/lite/sourcing/update"),
new TeaPair("method", "POST"),
new TeaPair("authType", "AK"),
new TeaPair("style", "ROA"),
new TeaPair("reqBodyType", "json"),
new TeaPair("bodyType", "json")
));
return TeaModel.toModel(this.callApi(params, req, runtime), new UpdateSourcingProjectResponse());
}
public UpdateSourcingProjectResponse updateSourcingProject(UpdateSourcingProjectRequest request) throws Exception {
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
java.util.Map<String, String> headers = new java.util.HashMap<>();
return this.updateSourcingProjectWithOptions(request, headers, runtime);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.