Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[oss gateway util] add java support for hcs-mgw, bump util v0.0.4, bump tea v0.0.18 #84

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions alibabacloud-gateway-oss/Teafile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"scope": "alibabacloud",
"name": "GatewayOSS",
"version": "0.0.17",
"version": "0.0.18",
"main": "./main.tea",
"maintainers": [
{
Expand All @@ -27,7 +27,7 @@
"releases": {
"ts": "@alicloud/gateway-oss:^0.0.8",
"go": "github.com/alibabacloud-go/alibabacloud-gateway-oss/client:v0.0.11",
"java": "com.aliyun:alibabacloud-gateway-oss:0.0.11",
"java": "com.aliyun:alibabacloud-gateway-oss:0.0.12",
"python": "alibabacloud_gateway_oss:0.0.9",
"python2": "alibabacloud_gateway_oss_py2:0.0.9",
"csharp": "AlibabaCloud.GatewayOss:0.0.10",
Expand Down
4 changes: 2 additions & 2 deletions alibabacloud-gateway-oss/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.aliyun</groupId>
<artifactId>alibabacloud-gateway-oss</artifactId>
<version>0.0.11</version>
<version>0.0.12</version>
<packaging>jar</packaging>
<name>alibabacloud-gateway-oss</name>
<description>
Expand Down Expand Up @@ -119,7 +119,7 @@
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibabacloud-gateway-oss-util</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void modifyRequest(com.aliyun.gateway.spi.models.InterceptorContext conte

}

String host = this.getHost(config.endpointType, bucketName, config.endpoint);
String host = this.getHost(config.endpointType, bucketName, config.endpoint, context);
request.headers = TeaConverter.merge(String.class,
TeaConverter.buildMap(
new TeaPair("host", host),
Expand Down Expand Up @@ -349,7 +349,11 @@ public String getEndpoint(String regionId, String network, String endpoint) thro
return "oss-" + regionId + ".aliyuncs.com";
}

public String getHost(String endpointType, String bucketName, String endpoint) throws Exception {
public String getHost(String endpointType, String bucketName, String endpoint, com.aliyun.gateway.spi.models.InterceptorContext context) throws Exception {
if (com.aliyun.darabonbastring.Client.contains(endpoint, ".mgw.aliyuncs.com") && !com.aliyun.teautil.Common.isUnset(context.request.hostMap.get("userid"))) {
return "" + context.request.hostMap.get("userid") + "." + endpoint + "";
}

if (com.aliyun.teautil.Common.empty(bucketName)) {
return endpoint;
}
Expand Down
7 changes: 5 additions & 2 deletions alibabacloud-gateway-oss/main.tea
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async function modifyRequest(context: SPI.InterceptorContext, attributeMap: SPI.
request.headers.content-type = 'application/octet-stream';
}
}
var host = getHost(config.endpointType, bucketName, config.endpoint);
var host = getHost(config.endpointType, bucketName, config.endpoint, context);
request.headers = {
host = host,
date = Util.getDateUTCString(),
Expand Down Expand Up @@ -260,7 +260,10 @@ async function getEndpoint(regionId: string, network: string, endpoint: string)
return `oss-${regionId}.aliyuncs.com`;
}

async function getHost(endpointType: string, bucketName: string, endpoint: string): string {
async function getHost(endpointType: string, bucketName: string, endpoint: string, context: SPI.InterceptorContext): string {
if (String.contains(endpoint,'.mgw.aliyuncs.com') && !Util.isUnset(context.request.hostMap.userid)) {
return `${context.request.hostMap.userid}.${endpoint}`;
}
if (Util.empty(bucketName)) {
return endpoint;
}
Expand Down
2 changes: 1 addition & 1 deletion alibabacloud-gateway-oss/util/Teafile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"scope": "alibabacloud",
"name": "GatewayOSS_Util",
"version": "0.0.3",
"version": "0.0.4",
"main": "./main.tea",
"maintainers": [
{
Expand Down
2 changes: 1 addition & 1 deletion alibabacloud-gateway-oss/util/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.aliyun</groupId>
<artifactId>alibabacloud-gateway-oss-util</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
<packaging>jar</packaging>
<name>alibabacloud-gateway-oss-util</name>
<description>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.gateway.oss.util.models;

import com.aliyun.tea.*;

public class AddressDetail extends TeaModel {
/**
* <p>This parameter is required.</p>
*
* <strong>example:</strong>
* <p>test_access_id</p>
*/
@NameInMap("AccessId")
public String accessId;

/**
* <p>This parameter is required.</p>
*
* <strong>example:</strong>
* <p>test_secret_key</p>
*/
@NameInMap("AccessSecret")
public String accessSecret;

/**
* <p>This parameter is required.</p>
*
* <strong>example:</strong>
* <p>ossinv</p>
*/
@NameInMap("AddressType")
public String addressType;

@NameInMap("AgentList")
public String agentList;

/**
* <p>This parameter is required.</p>
*
* <strong>example:</strong>
* <p>test_bucket</p>
*/
@NameInMap("Bucket")
public String bucket;

/**
* <p>This parameter is required.</p>
*
* <strong>example:</strong>
* <p>test_domain</p>
*/
@NameInMap("Domain")
public String domain;

/**
* <strong>example:</strong>
* <p>test_inv_access_id</p>
*/
@NameInMap("InvAccessId")
public String invAccessId;

/**
* <strong>example:</strong>
* <p>test_inv_secret_key</p>
*/
@NameInMap("InvAccessSecret")
public String invAccessSecret;

/**
* <strong>example:</strong>
* <p>test_inv_bucket</p>
*/
@NameInMap("InvBucket")
public String invBucket;

/**
* <strong>example:</strong>
* <p>test_inv_domain</p>
*/
@NameInMap("InvDomain")
public String invDomain;

/**
* <strong>example:</strong>
* <p>oss</p>
*/
@NameInMap("InvLocation")
public String invLocation;

/**
* <strong>example:</strong>
* <p>manifest.json</p>
*/
@NameInMap("InvPath")
public String invPath;

/**
* <strong>example:</strong>
* <p>test_inv_region_id</p>
*/
@NameInMap("InvRegionId")
public String invRegionId;

/**
* <strong>example:</strong>
* <p>test_inv_role</p>
*/
@NameInMap("InvRole")
public String invRole;

/**
* <strong>example:</strong>
* <p>test_prefix</p>
*/
@NameInMap("Prefix")
public String prefix;

/**
* <strong>example:</strong>
* <p>test_region_id</p>
*/
@NameInMap("RegionId")
public String regionId;

/**
* <strong>example:</strong>
* <p>test_role</p>
*/
@NameInMap("Role")
public String role;

public static AddressDetail build(java.util.Map<String, ?> map) throws Exception {
AddressDetail self = new AddressDetail();
return TeaModel.build(map, self);
}

public AddressDetail setAccessId(String accessId) {
this.accessId = accessId;
return this;
}
public String getAccessId() {
return this.accessId;
}

public AddressDetail setAccessSecret(String accessSecret) {
this.accessSecret = accessSecret;
return this;
}
public String getAccessSecret() {
return this.accessSecret;
}

public AddressDetail setAddressType(String addressType) {
this.addressType = addressType;
return this;
}
public String getAddressType() {
return this.addressType;
}

public AddressDetail setAgentList(String agentList) {
this.agentList = agentList;
return this;
}
public String getAgentList() {
return this.agentList;
}

public AddressDetail setBucket(String bucket) {
this.bucket = bucket;
return this;
}
public String getBucket() {
return this.bucket;
}

public AddressDetail setDomain(String domain) {
this.domain = domain;
return this;
}
public String getDomain() {
return this.domain;
}

public AddressDetail setInvAccessId(String invAccessId) {
this.invAccessId = invAccessId;
return this;
}
public String getInvAccessId() {
return this.invAccessId;
}

public AddressDetail setInvAccessSecret(String invAccessSecret) {
this.invAccessSecret = invAccessSecret;
return this;
}
public String getInvAccessSecret() {
return this.invAccessSecret;
}

public AddressDetail setInvBucket(String invBucket) {
this.invBucket = invBucket;
return this;
}
public String getInvBucket() {
return this.invBucket;
}

public AddressDetail setInvDomain(String invDomain) {
this.invDomain = invDomain;
return this;
}
public String getInvDomain() {
return this.invDomain;
}

public AddressDetail setInvLocation(String invLocation) {
this.invLocation = invLocation;
return this;
}
public String getInvLocation() {
return this.invLocation;
}

public AddressDetail setInvPath(String invPath) {
this.invPath = invPath;
return this;
}
public String getInvPath() {
return this.invPath;
}

public AddressDetail setInvRegionId(String invRegionId) {
this.invRegionId = invRegionId;
return this;
}
public String getInvRegionId() {
return this.invRegionId;
}

public AddressDetail setInvRole(String invRole) {
this.invRole = invRole;
return this;
}
public String getInvRole() {
return this.invRole;
}

public AddressDetail setPrefix(String prefix) {
this.prefix = prefix;
return this;
}
public String getPrefix() {
return this.prefix;
}

public AddressDetail setRegionId(String regionId) {
this.regionId = regionId;
return this;
}
public String getRegionId() {
return this.regionId;
}

public AddressDetail setRole(String role) {
this.role = role;
return this;
}
public String getRole() {
return this.role;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.gateway.oss.util.models;

import com.aliyun.tea.*;

public class Audit extends TeaModel {
/**
* <strong>example:</strong>
* <p>off</p>
*/
@NameInMap("LogMode")
public String logMode;

public static Audit build(java.util.Map<String, ?> map) throws Exception {
Audit self = new Audit();
return TeaModel.build(map, self);
}

public Audit setLogMode(String logMode) {
this.logMode = logMode;
return this;
}
public String getLogMode() {
return this.logMode;
}

}
Loading
Loading