Skip to content

Commit bea290b

Browse files
committed
Support key policy and secret policy OpenAPI.
1 parent d3d39c7 commit bea290b

16 files changed

+636
-3
lines changed

aliyun-java-sdk-kms/ChangeLog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2024-05-08 Version: 2.16.4
2+
- Support key policy and secret policy OpenAPI.
3+
14
2023-09-11 Version: 2.16.3
25
- add Instance, NetworkRule, Policy, ApplicationAccessPoint, ClientKey OpenAPIs
36

aliyun-java-sdk-kms/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.aliyun</groupId>
55
<artifactId>aliyun-java-sdk-kms</artifactId>
66
<packaging>jar</packaging>
7-
<version>2.16.3</version>
7+
<version>2.16.4</version>
88
<name>aliyun-java-sdk-kms</name>
99
<url>http://www.aliyun.com</url>
1010
<description>Aliyun Open API SDK for Java

aliyun-java-sdk-kms/src/main/java/com/aliyuncs/kms/model/v20160120/CreateKeyRequest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public class CreateKeyRequest extends RpcAcsRequest<CreateKeyResponse> {
4242

4343
private String keyUsage;
4444

45-
private String dKMSInstanceId;
45+
private String dKMSInstanceId;
46+
47+
private String policy;
4648
public CreateKeyRequest() {
4749
super("Kms", "2016-01-20", "CreateKey", "kms");
4850
setProtocol(ProtocolType.HTTPS);
@@ -150,6 +152,17 @@ public void setDKMSInstanceId(String dKMSInstanceId) {
150152
if(dKMSInstanceId != null){
151153
putQueryParameter("DKMSInstanceId", dKMSInstanceId);
152154
}
155+
}
156+
157+
public String getPolicy() {
158+
return this.policy;
159+
}
160+
161+
public void setPolicy(String policy) {
162+
this.policy = policy;
163+
if(policy != null){
164+
putQueryParameter("Policy", policy);
165+
}
153166
}
154167

155168
@Override

aliyun-java-sdk-kms/src/main/java/com/aliyuncs/kms/model/v20160120/CreateSecretRequest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ public class CreateSecretRequest extends RpcAcsRequest<CreateSecretResponse> {
4848

4949
private String secretName;
5050

51-
private String secretDataType;
51+
private String secretDataType;
52+
53+
private String policy;
5254
public CreateSecretRequest() {
5355
super("Kms", "2016-01-20", "CreateSecret", "kms");
5456
setProtocol(ProtocolType.HTTPS);
@@ -189,6 +191,17 @@ public void setSecretDataType(String secretDataType) {
189191
if(secretDataType != null){
190192
putQueryParameter("SecretDataType", secretDataType);
191193
}
194+
}
195+
196+
public String getPolicy() {
197+
return this.policy;
198+
}
199+
200+
public void setPolicy(String policy) {
201+
this.policy = policy;
202+
if(policy != null){
203+
putQueryParameter("Policy", policy);
204+
}
192205
}
193206

194207
@Override
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
15+
package com.aliyuncs.kms.model.v20160120;
16+
17+
import com.aliyuncs.RpcAcsRequest;
18+
import com.aliyuncs.http.ProtocolType;
19+
import com.aliyuncs.http.MethodType;
20+
import com.aliyuncs.kms.Endpoint;
21+
22+
/**
23+
* @author auto create
24+
* @version
25+
*/
26+
public class GetKeyPolicyRequest extends RpcAcsRequest<GetKeyPolicyResponse> {
27+
28+
29+
private String keyId;
30+
31+
private String policyName;
32+
public GetKeyPolicyRequest() {
33+
super("Kms", "2016-01-20", "GetKeyPolicy", "kms");
34+
setProtocol(ProtocolType.HTTPS);
35+
setMethod(MethodType.POST);
36+
try {
37+
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
38+
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
39+
} catch (Exception e) {}
40+
}
41+
42+
public String getKeyId() {
43+
return this.keyId;
44+
}
45+
46+
public void setKeyId(String keyId) {
47+
this.keyId = keyId;
48+
if(keyId != null){
49+
putQueryParameter("KeyId", keyId);
50+
}
51+
}
52+
53+
public String getPolicyName() {
54+
return this.policyName;
55+
}
56+
57+
public void setPolicyName(String policyName) {
58+
this.policyName = policyName;
59+
if(policyName != null){
60+
putQueryParameter("PolicyName", policyName);
61+
}
62+
}
63+
64+
@Override
65+
public Class<GetKeyPolicyResponse> getResponseClass() {
66+
return GetKeyPolicyResponse.class;
67+
}
68+
69+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
15+
package com.aliyuncs.kms.model.v20160120;
16+
17+
import com.aliyuncs.AcsResponse;
18+
import com.aliyuncs.kms.transform.v20160120.GetKeyPolicyResponseUnmarshaller;
19+
import com.aliyuncs.transform.UnmarshallerContext;
20+
21+
/**
22+
* @author auto create
23+
* @version
24+
*/
25+
public class GetKeyPolicyResponse extends AcsResponse {
26+
27+
private String requestId;
28+
29+
private String policy;
30+
31+
public String getRequestId() {
32+
return this.requestId;
33+
}
34+
35+
public void setRequestId(String requestId) {
36+
this.requestId = requestId;
37+
}
38+
39+
public String getPolicy() {
40+
return this.policy;
41+
}
42+
43+
public void setPolicy(String policy) {
44+
this.policy = policy;
45+
}
46+
47+
@Override
48+
public GetKeyPolicyResponse getInstance(UnmarshallerContext context) {
49+
return GetKeyPolicyResponseUnmarshaller.unmarshall(this, context);
50+
}
51+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
15+
package com.aliyuncs.kms.model.v20160120;
16+
17+
import com.aliyuncs.RpcAcsRequest;
18+
import com.aliyuncs.http.ProtocolType;
19+
import com.aliyuncs.http.MethodType;
20+
import com.aliyuncs.kms.Endpoint;
21+
22+
/**
23+
* @author auto create
24+
* @version
25+
*/
26+
public class GetSecretPolicyRequest extends RpcAcsRequest<GetSecretPolicyResponse> {
27+
28+
29+
private String policyName;
30+
31+
private String secretName;
32+
public GetSecretPolicyRequest() {
33+
super("Kms", "2016-01-20", "GetSecretPolicy", "kms");
34+
setProtocol(ProtocolType.HTTPS);
35+
setMethod(MethodType.POST);
36+
try {
37+
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
38+
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
39+
} catch (Exception e) {}
40+
}
41+
42+
public String getPolicyName() {
43+
return this.policyName;
44+
}
45+
46+
public void setPolicyName(String policyName) {
47+
this.policyName = policyName;
48+
if(policyName != null){
49+
putQueryParameter("PolicyName", policyName);
50+
}
51+
}
52+
53+
public String getSecretName() {
54+
return this.secretName;
55+
}
56+
57+
public void setSecretName(String secretName) {
58+
this.secretName = secretName;
59+
if(secretName != null){
60+
putQueryParameter("SecretName", secretName);
61+
}
62+
}
63+
64+
@Override
65+
public Class<GetSecretPolicyResponse> getResponseClass() {
66+
return GetSecretPolicyResponse.class;
67+
}
68+
69+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
15+
package com.aliyuncs.kms.model.v20160120;
16+
17+
import com.aliyuncs.AcsResponse;
18+
import com.aliyuncs.kms.transform.v20160120.GetSecretPolicyResponseUnmarshaller;
19+
import com.aliyuncs.transform.UnmarshallerContext;
20+
21+
/**
22+
* @author auto create
23+
* @version
24+
*/
25+
public class GetSecretPolicyResponse extends AcsResponse {
26+
27+
private String requestId;
28+
29+
private String policy;
30+
31+
public String getRequestId() {
32+
return this.requestId;
33+
}
34+
35+
public void setRequestId(String requestId) {
36+
this.requestId = requestId;
37+
}
38+
39+
public String getPolicy() {
40+
return this.policy;
41+
}
42+
43+
public void setPolicy(String policy) {
44+
this.policy = policy;
45+
}
46+
47+
@Override
48+
public GetSecretPolicyResponse getInstance(UnmarshallerContext context) {
49+
return GetSecretPolicyResponseUnmarshaller.unmarshall(this, context);
50+
}
51+
}

0 commit comments

Comments
 (0)