Skip to content

Commit 8bf2284

Browse files
author
SDKAuto
committed
CodeGen from PR 33771 in Azure/azure-rest-api-specs
Merge 9a9c7333b2f477bfcf6505d1fb334720c425655e into b65cbab6abfdad4135f411bb1aaaeb76d27e4e70
1 parent a458671 commit 8bf2284

File tree

6 files changed

+1176
-14
lines changed

6 files changed

+1176
-14
lines changed

sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md

Lines changed: 465 additions & 4 deletions
Large diffs are not rendered by default.

sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyClientImpl.java

Lines changed: 441 additions & 6 deletions
Large diffs are not rendered by default.

sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/models/JsonWebKeySignatureAlgorithm.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,22 @@ public static JsonWebKeySignatureAlgorithm fromString(String name) {
109109
public static Collection<JsonWebKeySignatureAlgorithm> values() {
110110
return values(JsonWebKeySignatureAlgorithm.class);
111111
}
112+
113+
/**
114+
* HMAC using SHA-256, as described in https://tools.ietf.org/html/rfc7518.
115+
*/
116+
@Generated
117+
public static final JsonWebKeySignatureAlgorithm HS256 = fromString("HS256");
118+
119+
/**
120+
* HMAC using SHA-384, as described in https://tools.ietf.org/html/rfc7518.
121+
*/
122+
@Generated
123+
public static final JsonWebKeySignatureAlgorithm HS384 = fromString("HS384");
124+
125+
/**
126+
* HMAC using SHA-512, as described in https://tools.ietf.org/html/rfc7518.
127+
*/
128+
@Generated
129+
public static final JsonWebKeySignatureAlgorithm HS512 = fromString("HS512");
112130
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) TypeSpec Code Generator.
4+
5+
package com.azure.security.keyvault.keys.implementation.models;
6+
7+
import com.azure.core.annotation.Fluent;
8+
import com.azure.core.annotation.Generated;
9+
import com.azure.core.util.Base64Url;
10+
import com.azure.core.util.CoreUtils;
11+
import com.azure.json.JsonReader;
12+
import com.azure.json.JsonSerializable;
13+
import com.azure.json.JsonToken;
14+
import com.azure.json.JsonWriter;
15+
import java.io.IOException;
16+
import java.util.Objects;
17+
18+
/**
19+
* The key attestation information.
20+
*/
21+
@Fluent
22+
public final class KeyAttestation implements JsonSerializable<KeyAttestation> {
23+
/*
24+
* A base64url-encoded string containing certificates in PEM format, used for attestation validation.
25+
*/
26+
@Generated
27+
private Base64Url certificatePemFile;
28+
29+
/*
30+
* The attestation blob bytes encoded as base64url string corresponding to a private key.
31+
*/
32+
@Generated
33+
private Base64Url privateKeyAttestation;
34+
35+
/*
36+
* The attestation blob bytes encoded as base64url string corresponding to a public key in case of asymmetric key.
37+
*/
38+
@Generated
39+
private Base64Url publicKeyAttestation;
40+
41+
/*
42+
* The version of the attestation.
43+
*/
44+
@Generated
45+
private String version;
46+
47+
/**
48+
* Creates an instance of KeyAttestation class.
49+
*/
50+
@Generated
51+
public KeyAttestation() {
52+
}
53+
54+
/**
55+
* Get the certificatePemFile property: A base64url-encoded string containing certificates in PEM format, used for
56+
* attestation validation.
57+
*
58+
* @return the certificatePemFile value.
59+
*/
60+
@Generated
61+
public byte[] getCertificatePemFile() {
62+
if (this.certificatePemFile == null) {
63+
return null;
64+
}
65+
return this.certificatePemFile.decodedBytes();
66+
}
67+
68+
/**
69+
* Set the certificatePemFile property: A base64url-encoded string containing certificates in PEM format, used for
70+
* attestation validation.
71+
*
72+
* @param certificatePemFile the certificatePemFile value to set.
73+
* @return the KeyAttestation object itself.
74+
*/
75+
@Generated
76+
public KeyAttestation setCertificatePemFile(byte[] certificatePemFile) {
77+
if (certificatePemFile == null) {
78+
this.certificatePemFile = null;
79+
} else {
80+
this.certificatePemFile = Base64Url.encode(CoreUtils.clone(certificatePemFile));
81+
}
82+
return this;
83+
}
84+
85+
/**
86+
* Get the privateKeyAttestation property: The attestation blob bytes encoded as base64url string corresponding to a
87+
* private key.
88+
*
89+
* @return the privateKeyAttestation value.
90+
*/
91+
@Generated
92+
public byte[] getPrivateKeyAttestation() {
93+
if (this.privateKeyAttestation == null) {
94+
return null;
95+
}
96+
return this.privateKeyAttestation.decodedBytes();
97+
}
98+
99+
/**
100+
* Set the privateKeyAttestation property: The attestation blob bytes encoded as base64url string corresponding to a
101+
* private key.
102+
*
103+
* @param privateKeyAttestation the privateKeyAttestation value to set.
104+
* @return the KeyAttestation object itself.
105+
*/
106+
@Generated
107+
public KeyAttestation setPrivateKeyAttestation(byte[] privateKeyAttestation) {
108+
if (privateKeyAttestation == null) {
109+
this.privateKeyAttestation = null;
110+
} else {
111+
this.privateKeyAttestation = Base64Url.encode(CoreUtils.clone(privateKeyAttestation));
112+
}
113+
return this;
114+
}
115+
116+
/**
117+
* Get the publicKeyAttestation property: The attestation blob bytes encoded as base64url string corresponding to a
118+
* public key in case of asymmetric key.
119+
*
120+
* @return the publicKeyAttestation value.
121+
*/
122+
@Generated
123+
public byte[] getPublicKeyAttestation() {
124+
if (this.publicKeyAttestation == null) {
125+
return null;
126+
}
127+
return this.publicKeyAttestation.decodedBytes();
128+
}
129+
130+
/**
131+
* Set the publicKeyAttestation property: The attestation blob bytes encoded as base64url string corresponding to a
132+
* public key in case of asymmetric key.
133+
*
134+
* @param publicKeyAttestation the publicKeyAttestation value to set.
135+
* @return the KeyAttestation object itself.
136+
*/
137+
@Generated
138+
public KeyAttestation setPublicKeyAttestation(byte[] publicKeyAttestation) {
139+
if (publicKeyAttestation == null) {
140+
this.publicKeyAttestation = null;
141+
} else {
142+
this.publicKeyAttestation = Base64Url.encode(CoreUtils.clone(publicKeyAttestation));
143+
}
144+
return this;
145+
}
146+
147+
/**
148+
* Get the version property: The version of the attestation.
149+
*
150+
* @return the version value.
151+
*/
152+
@Generated
153+
public String getVersion() {
154+
return this.version;
155+
}
156+
157+
/**
158+
* Set the version property: The version of the attestation.
159+
*
160+
* @param version the version value to set.
161+
* @return the KeyAttestation object itself.
162+
*/
163+
@Generated
164+
public KeyAttestation setVersion(String version) {
165+
this.version = version;
166+
return this;
167+
}
168+
169+
/**
170+
* {@inheritDoc}
171+
*/
172+
@Generated
173+
@Override
174+
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
175+
jsonWriter.writeStartObject();
176+
jsonWriter.writeStringField("certificatePemFile", Objects.toString(this.certificatePemFile, null));
177+
jsonWriter.writeStringField("privateKeyAttestation", Objects.toString(this.privateKeyAttestation, null));
178+
jsonWriter.writeStringField("publicKeyAttestation", Objects.toString(this.publicKeyAttestation, null));
179+
jsonWriter.writeStringField("version", this.version);
180+
return jsonWriter.writeEndObject();
181+
}
182+
183+
/**
184+
* Reads an instance of KeyAttestation from the JsonReader.
185+
*
186+
* @param jsonReader The JsonReader being read.
187+
* @return An instance of KeyAttestation if the JsonReader was pointing to an instance of it, or null if it was
188+
* pointing to JSON null.
189+
* @throws IOException If an error occurs while reading the KeyAttestation.
190+
*/
191+
@Generated
192+
public static KeyAttestation fromJson(JsonReader jsonReader) throws IOException {
193+
return jsonReader.readObject(reader -> {
194+
KeyAttestation deserializedKeyAttestation = new KeyAttestation();
195+
while (reader.nextToken() != JsonToken.END_OBJECT) {
196+
String fieldName = reader.getFieldName();
197+
reader.nextToken();
198+
199+
if ("certificatePemFile".equals(fieldName)) {
200+
deserializedKeyAttestation.certificatePemFile
201+
= reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString()));
202+
} else if ("privateKeyAttestation".equals(fieldName)) {
203+
deserializedKeyAttestation.privateKeyAttestation
204+
= reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString()));
205+
} else if ("publicKeyAttestation".equals(fieldName)) {
206+
deserializedKeyAttestation.publicKeyAttestation
207+
= reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString()));
208+
} else if ("version".equals(fieldName)) {
209+
deserializedKeyAttestation.version = reader.getString();
210+
} else {
211+
reader.skipChildren();
212+
}
213+
}
214+
215+
return deserializedKeyAttestation;
216+
});
217+
}
218+
}

sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/models/KeyAttributes.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
258258
jsonWriter.writeNumberField("nbf", this.notBefore);
259259
jsonWriter.writeNumberField("exp", this.expires);
260260
jsonWriter.writeBooleanField("exportable", this.exportable);
261+
jsonWriter.writeJsonField("attestation", this.attestation);
261262
return jsonWriter.writeEndObject();
262263
}
263264

@@ -294,11 +295,41 @@ public static KeyAttributes fromJson(JsonReader jsonReader) throws IOException {
294295
deserializedKeyAttributes.exportable = reader.getNullable(JsonReader::getBoolean);
295296
} else if ("hsmPlatform".equals(fieldName)) {
296297
deserializedKeyAttributes.hsmPlatform = reader.getString();
298+
} else if ("attestation".equals(fieldName)) {
299+
deserializedKeyAttributes.attestation = KeyAttestation.fromJson(reader);
297300
} else {
298301
reader.skipChildren();
299302
}
300303
}
301304
return deserializedKeyAttributes;
302305
});
303306
}
307+
308+
/*
309+
* The key or key version attestation information.
310+
*/
311+
@Generated
312+
private KeyAttestation attestation;
313+
314+
/**
315+
* Get the attestation property: The key or key version attestation information.
316+
*
317+
* @return the attestation value.
318+
*/
319+
@Generated
320+
public KeyAttestation getAttestation() {
321+
return this.attestation;
322+
}
323+
324+
/**
325+
* Set the attestation property: The key or key version attestation information.
326+
*
327+
* @param attestation the attestation value to set.
328+
* @return the KeyAttributes object itself.
329+
*/
330+
@Generated
331+
public KeyAttributes setAttestation(KeyAttestation attestation) {
332+
this.attestation = attestation;
333+
return this;
334+
}
304335
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
directory: specification/keyvault/Security.KeyVault.Keys
2-
commit: a0eb4f02951e8b7dd80e72e108b9cf7618718bc9
2+
commit: e5eca2279ea7f0cf8c93e7c543ffc033a18e5f7f
33
repo: Azure/azure-rest-api-specs
4-
cleanup: true
5-
additionalDirectories:
6-
- specification/keyvault/Security.KeyVault.Common/
4+
additionalDirectories:
5+
- specification/keyvault/Security.KeyVault.Common

0 commit comments

Comments
 (0)