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

[Key Vault] Added TSP configuration for Key Vault Certificates #43417

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/keyvault/azure-security-keyvault-certificates",
"Tag": "java/keyvault/azure-security-keyvault-certificates_e018897fab"
"Tag": "java/keyvault/azure-security-keyvault-certificates_f79afcd807"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- This file is generated by the /eng/scripts/linting_suppression_generator.py script. -->

<suppressions>
<suppress files="com.azure.security.keyvault.certificates.implementation.CertificateClientImpl.java" checks="JavaDocFormatting" />
<suppress files="com.azure.security.keyvault.certificates.implementation.KeyVaultCredentialPolicy.java" checks="JavadocMethodCheck" />
<suppress files="com.azure.security.keyvault.certificates.implementation.CertificateClientImpl.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.security.keyvault.certificates.implementation.CertificateIssuerHelper.java" checks="MissingJavadocMethodCheck" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<Class name="com.azure.security.keyvault.certificates.implementation.models.CertificateUpdateParameters" />
<Class name="com.azure.security.keyvault.certificates.implementation.models.Contacts" />
<Class name="com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateListResult" />
<Class name="com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateBundle" />
<Class name="com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateItem" />
<Class name="com.azure.security.keyvault.certificates.implementation.models.OrganizationDetails" />
<Class name="com.azure.security.keyvault.certificates.implementation.models.X509CertificateProperties" />
<Class name="com.azure.security.keyvault.certificates.models.CertificatePolicy" />
Expand Down Expand Up @@ -59,6 +61,7 @@
<Class name="com.azure.security.keyvault.certificates.implementation.models.CertificateItem" />
<Class name="com.azure.security.keyvault.certificates.implementation.models.CertificateRestoreParameters" />
<Class name="com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateBundle" />
<Class name="com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateItem" />
<Class name="com.azure.security.keyvault.certificates.models.CertificateProperties" />
</Or>
</Match>
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private CertificateClientImpl buildInnerClient() {
CertificateServiceVersion serviceVersion = version != null ? version : CertificateServiceVersion.getLatest();

if (pipeline != null) {
return new CertificateClientImpl(pipeline, serviceVersion.getVersion());
return new CertificateClientImpl(vaultUrl, serviceVersion);
}

if (credential == null) {
Expand Down Expand Up @@ -246,7 +246,7 @@ private CertificateClientImpl buildInnerClient() {
.clientOptions(localClientOptions)
.build();

return new CertificateClientImpl(pipeline, serviceVersion.getVersion());
return new CertificateClientImpl(pipeline, vaultUrl, serviceVersion);
}

/**
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ public final class CertificateIssuerHelper {
private static CertificateIssuerAccessor accessor;

public interface CertificateIssuerAccessor {
CertificateIssuer createCertificateIssuer(IssuerBundle impl);
CertificateIssuer createCertificateIssuer(IssuerBundle issuerBundle);

IssuerBundle getImpl(CertificateIssuer certificateIssuer);
IssuerBundle getIssuerBundle(CertificateIssuer certificateIssuer);
}

public static CertificateIssuer createCertificateIssuer(IssuerBundle impl) {
public static CertificateIssuer createCertificateIssuer(IssuerBundle issuerBundle) {
if (accessor == null) {
new CertificateIssuer("");
}

assert accessor != null;
return accessor.createCertificateIssuer(impl);
return accessor.createCertificateIssuer(issuerBundle);
}

public static IssuerBundle getIssuerBundle(CertificateIssuer certificateIssuer) {
Expand All @@ -29,7 +29,7 @@ public static IssuerBundle getIssuerBundle(CertificateIssuer certificateIssuer)
}

assert accessor != null;
return accessor.getImpl(certificateIssuer);
return accessor.getIssuerBundle(certificateIssuer);
}

public static void setAccessor(CertificateIssuerAccessor accessor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package com.azure.security.keyvault.certificates.implementation;

import com.azure.security.keyvault.certificates.implementation.models.CertificateItem;
import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateItem;
import com.azure.security.keyvault.certificates.models.CertificateProperties;
import com.azure.security.keyvault.certificates.models.DeletedCertificate;

Expand All @@ -11,6 +12,8 @@ public final class CertificatePropertiesHelper {

public interface CertificatePropertiesAccessor {
CertificateProperties createCertificateProperties(CertificateItem item);

CertificateProperties createCertificateProperties(DeletedCertificateItem item);
}

public static CertificateProperties createCertificateProperties(CertificateItem item) {
Expand All @@ -25,6 +28,18 @@ public static CertificateProperties createCertificateProperties(CertificateItem
return accessor.createCertificateProperties(item);
}

public static CertificateProperties createCertificateProperties(DeletedCertificateItem item) {
if (accessor == null) {
// CertificateProperties doesn't have a public constructor but DeletedCertificate does and creates an
// instance of CertificateProperties. This will result in CertificateProperties being loaded by the class
// loader.
new DeletedCertificate();
}

assert accessor != null;
return accessor.createCertificateProperties(item);
}

public static void setAccessor(CertificatePropertiesAccessor accessor) {
CertificatePropertiesHelper.accessor = accessor;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

// Code generated by Microsoft (R) TypeSpec Code Generator.
package com.azure.security.keyvault.certificates.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.annotation.Generated;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.security.keyvault.certificates.models.CertificatePolicyAction;
import java.io.IOException;

/**
* The action that will be executed.
*/
@Fluent
public final class Action implements JsonSerializable<Action> {

/*
* The type of the action.
*/
@Generated
private CertificatePolicyAction actionType;

/**
* Creates an instance of Action class.
*/
@Generated
public Action() {
}

/**
* Get the actionType property: The type of the action.
*
*
* @return the actionType value.
*/
@Generated
public CertificatePolicyAction getActionType() {
return this.actionType;
}

/**
* Set the actionType property: The type of the action.
*
*
* @param actionType the actionType value to set.
* @return the Action object itself.
*/
@Generated
public Action setActionType(CertificatePolicyAction actionType) {
this.actionType = actionType;
return this;
Expand All @@ -51,6 +55,7 @@ public Action setActionType(CertificatePolicyAction actionType) {
/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
Expand All @@ -60,26 +65,25 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {

/**
* Reads an instance of Action from the JsonReader.
*
*
* @param jsonReader The JsonReader being read.
* @return An instance of Action if the JsonReader was pointing to an instance of it, or null if it was pointing to
* JSON null.
* @throws IOException If an error occurs while reading the Action.
*/
@Generated
public static Action fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Action deserializedAction = new Action();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("action_type".equals(fieldName)) {
deserializedAction.actionType = CertificatePolicyAction.fromString(reader.getString());
} else {
reader.skipChildren();
}
}

return deserializedAction;
});
}
Expand Down
Loading
Loading