Skip to content

Commit

Permalink
feat: support extends parameters for all language
Browse files Browse the repository at this point in the history
  • Loading branch information
yndu13 committed May 11, 2024
1 parent 87eb01d commit 4ec9524
Show file tree
Hide file tree
Showing 30 changed files with 345 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testGo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [1.13, 1.14, 1.15, 1.16]
go: ["1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21"]
fail-fast: false

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/testJava.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
strategy:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
java: [7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19]
java: [7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testPython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testTS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
fail-fast: false

steps:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ java/bin/
java/.classpath
.vscode/
cc/*.o
*.sum
python/**/__pycache__/
cache/
21 changes: 21 additions & 0 deletions csharp/core/Models/ExtendsParameters.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* This is a utility module
*/
// This file is auto-generated, don't edit it. Thanks.

using System;
using System.Collections.Generic;
using System.IO;

using Tea;

namespace AlibabaCloud.TeaUtil.Models
{
public class ExtendsParameters : TeaModel {
[NameInMap("headers")]
[Validation(Required=false)]
public Dictionary<string, string> Headers { get; set; }

}

}
7 changes: 7 additions & 0 deletions csharp/core/Models/RuntimeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,12 @@ public class RuntimeOptions : TeaModel
[Validation(Required = false)]
public bool? KeepAlive { get; set; }

/// <summary>
/// Extends Parameters
/// </summary>
[NameInMap("extendsParameters")]
[Validation(Required=false)]
public ExtendsParameters ExtendsParameters { get; set; }

}
}
2 changes: 1 addition & 1 deletion csharp/core/TeaUtil.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Tea" Version="1.0.2" />
<PackageReference Include="Tea" Version="1.0.11" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions csharp/tests/Models/RuntimeObjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public void Test_RuntimeObject()
runtime.Socks5Proxy = "socks5Proxy";
runtime.KeepAlive = false;

ExtendsParameters extendsParameters = new ExtendsParameters();
extendsParameters.Headers = new Dictionary<string, string>{

Check failure on line 33 in csharp/tests/Models/RuntimeObjectTest.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'Dictionary<,>' could not be found (are you missing a using directive or an assembly reference?)
{"key", "value"},
};
runtime.extendsParameters = extendsParameters;

Check failure on line 36 in csharp/tests/Models/RuntimeObjectTest.cs

View workflow job for this annotation

GitHub Actions / build

'RuntimeOptions' does not contain a definition for 'extendsParameters' and no accessible extension method 'extendsParameters' accepting a first argument of type 'RuntimeOptions' could be found (are you missing a using directive or an assembly reference?)

Assert.NotNull(runtime);
Assert.True(runtime.Autoretry);
Assert.Equal(1, runtime.BackoffPeriod);
Expand All @@ -48,6 +54,8 @@ public void Test_RuntimeObject()
Assert.Equal("socks5", runtime.Socks5NetWork);
Assert.Equal("socks5Proxy", runtime.Socks5Proxy);
Assert.False(runtime.KeepAlive);
Assert.NotNull(runtime.extendsParameters);

Check failure on line 57 in csharp/tests/Models/RuntimeObjectTest.cs

View workflow job for this annotation

GitHub Actions / build

'RuntimeOptions' does not contain a definition for 'extendsParameters' and no accessible extension method 'extendsParameters' accepting a first argument of type 'RuntimeOptions' could be found (are you missing a using directive or an assembly reference?)
Assert.Equal("value", runtime.extendsParameters.Headers["key"]);

Check failure on line 58 in csharp/tests/Models/RuntimeObjectTest.cs

View workflow job for this annotation

GitHub Actions / build

'RuntimeOptions' does not contain a definition for 'extendsParameters' and no accessible extension method 'extendsParameters' accepting a first argument of type 'RuntimeOptions' could be found (are you missing a using directive or an assembly reference?)
}
}
}
5 changes: 1 addition & 4 deletions golang/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ module github.com/alibabacloud-go/tea-utils/v2

go 1.14

require (
github.com/alibabacloud-go/tea v1.1.0
golang.org/x/net v0.17.0 // indirect
)
require github.com/alibabacloud-go/tea v1.2.2
59 changes: 59 additions & 0 deletions golang/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
github.com/alibabacloud-go/debug v1.0.0 h1:3eIEQWfay1fB24PQIEzXAswlVJtdQok8f3EVN5VrBnA=
github.com/alibabacloud-go/debug v1.0.0/go.mod h1:8gfgZCCAC3+SCzjWtY053FrOcd4/qlH6IHTI4QyICOc=
github.com/alibabacloud-go/tea v1.2.2 h1:aTsR6Rl3ANWPfqeQugPglfurloyBJY85eFy7Gc1+8oU=
github.com/alibabacloud-go/tea v1.2.2/go.mod h1:CF3vOzEMAG+bR4WOql8gc2G9H3EkH3ZLAQdpmpXMgwk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
6 changes: 5 additions & 1 deletion golang/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ func Test_SetFunc(t *testing.T) {
SetReadTimeout(50).
SetSocks5NetWork("tcp").
SetSocks5Proxy("sock5proxy").
SetKeepAlive(false)
SetKeepAlive(false).
SetExtendsParameters(new(ExtendsParameters).SetHeaders(map[string]*string{
"key": tea.String("value"),
}))
utils.AssertEqual(t, true, tea.BoolValue(runtime.Autoretry))
utils.AssertEqual(t, true, tea.BoolValue(runtime.IgnoreSSL))
utils.AssertEqual(t, "key", tea.StringValue(runtime.Key))
Expand All @@ -47,6 +50,7 @@ func Test_SetFunc(t *testing.T) {
utils.AssertEqual(t, "tcp", tea.StringValue(runtime.Socks5NetWork))
utils.AssertEqual(t, "sock5proxy", tea.StringValue(runtime.Socks5Proxy))
utils.AssertEqual(t, false, tea.BoolValue(runtime.KeepAlive))
utils.AssertEqual(t, "value", tea.StringValue(runtime.ExtendsParameters.Headers["key"]))
runtime.GoString()
}

Expand Down
10 changes: 5 additions & 5 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

Expand All @@ -55,7 +55,7 @@
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>tea</artifactId>
<version>1.0.5</version>
<version>1.2.8</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -67,7 +67,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<version>2.10.1</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -103,7 +103,7 @@
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-staging</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// This file is auto-generated, don't edit it. Thanks.
package com.aliyun.teautil.models;

import com.aliyun.tea.*;

public class ExtendsParameters extends TeaModel {
@NameInMap("headers")
public java.util.Map<String, String> headers;

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

public ExtendsParameters setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}

}
14 changes: 14 additions & 0 deletions java/src/main/java/com/aliyun/teautil/models/RuntimeOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ public class RuntimeOptions extends TeaModel {
@NameInMap("keepAlive")
public Boolean keepAlive;

/**
* <p>Extends Parameters</p>
*/
@NameInMap("extendsParameters")
public ExtendsParameters extendsParameters;

public static RuntimeOptions build(java.util.Map<String, ?> map) throws Exception {
RuntimeOptions self = new RuntimeOptions();
return TeaModel.build(map, self);
Expand Down Expand Up @@ -228,4 +234,12 @@ public Boolean getKeepAlive() {
return this.keepAlive;
}

public RuntimeOptions setExtendsParameters(ExtendsParameters extendsParameters) {
this.extendsParameters = extendsParameters;
return this;
}
public ExtendsParameters getExtendsParameters() {
return this.extendsParameters;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ public void setAndGetTest() throws Exception {
map.put("maxIdleConns", 300);
map.put("keepAlive", true);

Map<String, String> headers = new HashMap<String, String>();
headers.put("key", "value");
Map<String, Object> extendsParameters = new HashMap<String, Object>();
extendsParameters.put("headers", headers);
map.put("extendsParameters", extendsParameters);

RuntimeOptions opts = RuntimeOptions.build(map);
Assert.assertEquals(false, opts.autoretry);
Assert.assertEquals(false, opts.ignoreSSL);
Expand All @@ -42,5 +48,6 @@ public void setAndGetTest() throws Exception {
Assert.assertEquals("noProxy", opts.noProxy);
Assert.assertEquals(300, (int) opts.maxIdleConns);
Assert.assertEquals(true, opts.keepAlive);
Assert.assertEquals("value", opts.extendsParameters.headers.get("key"));
}
}
30 changes: 30 additions & 0 deletions php/src/Utils/ExtendsParameters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\Tea\Utils\Utils;

use AlibabaCloud\Tea\Model;

class ExtendsParameters extends Model {
public function validate() {}
public function toMap() {
$res = [];
if (null !== $this->headers) {
$res['headers'] = $this->headers;
}
return $res;
}
/**
* @param array $map
* @return ExtendsParameters
*/
public static function fromMap($map = []) {
$model = new self();
if(isset($map['headers'])){
$model->headers = $map['headers'];
}
return $model;
}
public $headers;

}
12 changes: 12 additions & 0 deletions php/src/Utils/RuntimeOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public function toMap() {
if (null !== $this->keepAlive) {
$res['keepAlive'] = $this->keepAlive;
}
if (null !== $this->extendsParameters) {
$res['extendsParameters'] = null !== $this->extendsParameters ? $this->extendsParameters->toMap() : null;
}
return $res;
}
/**
Expand Down Expand Up @@ -148,6 +151,9 @@ public static function fromMap($map = []) {
if(isset($map['keepAlive'])){
$model->keepAlive = $map['keepAlive'];
}
if(isset($map['extendsParameters'])){
$model->extendsParameters = ExtendsParameters::fromMap($map['extendsParameters']);
}
return $model;
}
/**
Expand Down Expand Up @@ -258,4 +264,10 @@ public static function fromMap($map = []) {
*/
public $keepAlive;

/**
* @description Extends Parameters
* @var ExtendsParameters
*/
public $extendsParameters;

}
Loading

0 comments on commit 4ec9524

Please sign in to comment.