Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ *
beginSign(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.beginSignAsync(
+ codeSigningAccountName, certificateProfileName, codeSigningSubmissionOptions, requestOptions);
+ }
+
+ /**
+ * Gets the codesigning root certificate on the certificate chain for that account and profile name.
+ *
+ * The root certificate is generated as part of the initial account creation and it is used to sign the bits for
+ * the profile provided.
+ *
+ * @param codeSigningAccountName CodeSigning account name.
+ * @param certificateProfileName Certificate profile name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response body on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getSignRootCertificate(String codeSigningAccountName, String certificateProfileName) {
+ // Generated convenience method for getSignRootCertificateWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getSignRootCertificateWithResponse(codeSigningAccountName, certificateProfileName, requestOptions)
+ .flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Gets a list of extended key usage object identifiers that are allowed for this account and profile combination.
+ *
+ * The list of extended key usages are used to determine the purpose of the certificate usage as part of the
+ * codesigning operation.
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ExtendedKeyUsage items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listSignEkus(String codeSigningAccountName, String certificateProfileName) {
+ // Generated convenience method for listSignEkus
+ RequestOptions requestOptions = new RequestOptions();
+ PagedFlux pagedFluxResponse =
+ listSignEkus(codeSigningAccountName, certificateProfileName, requestOptions);
+ return PagedFlux.create(
+ () ->
+ (continuationToken, pageSize) -> {
+ Flux> flux =
+ (continuationToken == null)
+ ? pagedFluxResponse.byPage().take(1)
+ : pagedFluxResponse.byPage(continuationToken).take(1);
+ return flux.map(
+ pagedResponse ->
+ new PagedResponseBase(
+ pagedResponse.getRequest(),
+ pagedResponse.getStatusCode(),
+ pagedResponse.getHeaders(),
+ pagedResponse.getValue().stream()
+ .map(
+ protocolMethodData ->
+ protocolMethodData.toObject(
+ ExtendedKeyUsage.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(),
+ null));
+ });
+ }
+
+ /**
+ * Submit a codesign operation.
+ *
+ * Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param codeSigningSubmissionOptions The codesign request information to be signed by the service.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginSign(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ CodeSigningSubmissionOptions codeSigningSubmissionOptions) {
+ // Generated convenience method for beginSignWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginSignWithModelAsync(
+ codeSigningAccountName,
+ certificateProfileName,
+ BinaryData.fromObject(codeSigningSubmissionOptions),
+ requestOptions);
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/CodeSigningClient.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/CodeSigningClient.java
new file mode 100644
index 000000000000..863a9f87a8c4
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/CodeSigningClient.java
@@ -0,0 +1,245 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning;
+
+import com.azure.codesigning.implementation.CodeSigningClientImpl;
+import com.azure.codesigning.models.CodeSignOperationStatus;
+import com.azure.codesigning.models.CodeSigningSubmissionOptions;
+import com.azure.codesigning.models.ExtendedKeyUsage;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceClient;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.exception.ClientAuthenticationException;
+import com.azure.core.exception.HttpResponseException;
+import com.azure.core.exception.ResourceModifiedException;
+import com.azure.core.exception.ResourceNotFoundException;
+import com.azure.core.experimental.models.PollResult;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.polling.SyncPoller;
+
+/** Initializes a new instance of the synchronous CodeSigningClient type. */
+@ServiceClient(builder = CodeSigningClientBuilder.class)
+public final class CodeSigningClient {
+ @Generated private final CodeSigningClientImpl serviceClient;
+
+ /**
+ * Initializes an instance of CodeSigningClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ CodeSigningClient(CodeSigningClientImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Gets the codesigning root certificate on the certificate chain for that account and profile name.
+ *
+ * The root certificate is generated as part of the initial account creation and it is used to sign the bits for
+ * the profile provided.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * BinaryData
+ * }
+ *
+ * @param codeSigningAccountName CodeSigning account name.
+ * @param certificateProfileName Certificate profile name.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the response body along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getSignRootCertificateWithResponse(
+ String codeSigningAccountName, String certificateProfileName, RequestOptions requestOptions) {
+ return this.serviceClient.getSignRootCertificateWithResponse(
+ codeSigningAccountName, certificateProfileName, requestOptions);
+ }
+
+ /**
+ * Gets a list of extended key usage object identifiers that are allowed for this account and profile combination.
+ *
+ * The list of extended key usages are used to determine the purpose of the certificate usage as part of the
+ * codesigning operation.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * {
+ * ekus (Required): [
+ * String (Required)
+ * ]
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ExtendedKeyUsage items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listSignEkus(
+ String codeSigningAccountName, String certificateProfileName, RequestOptions requestOptions) {
+ return this.serviceClient.listSignEkus(codeSigningAccountName, certificateProfileName, requestOptions);
+ }
+
+ /**
+ * Submit a codesign operation.
+ *
+ * Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ *
Request Body Schema
+ *
+ *
{@code
+ * {
+ * signatureAlgorithm: String(RS256/RS384/RS512/PS256/PS384/PS512/ES256/ES384/ES512/ES256K) (Required)
+ * digest: byte[] (Required)
+ * fileHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * authenticodeHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * {
+ * id: String (Required)
+ * status: String (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param codeSigningSubmissionOptions The codesign request information to be signed by the service.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginSign(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions) {
+ return this.serviceClient.beginSign(
+ codeSigningAccountName, certificateProfileName, codeSigningSubmissionOptions, requestOptions);
+ }
+
+ /**
+ * Gets the codesigning root certificate on the certificate chain for that account and profile name.
+ *
+ * The root certificate is generated as part of the initial account creation and it is used to sign the bits for
+ * the profile provided.
+ *
+ * @param codeSigningAccountName CodeSigning account name.
+ * @param certificateProfileName Certificate profile name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public BinaryData getSignRootCertificate(String codeSigningAccountName, String certificateProfileName) {
+ // Generated convenience method for getSignRootCertificateWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getSignRootCertificateWithResponse(codeSigningAccountName, certificateProfileName, requestOptions)
+ .getValue();
+ }
+
+ /**
+ * Gets a list of extended key usage object identifiers that are allowed for this account and profile combination.
+ *
+ *
The list of extended key usages are used to determine the purpose of the certificate usage as part of the
+ * codesigning operation.
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ExtendedKeyUsage items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listSignEkus(String codeSigningAccountName, String certificateProfileName) {
+ // Generated convenience method for listSignEkus
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient
+ .listSignEkus(codeSigningAccountName, certificateProfileName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(ExtendedKeyUsage.class));
+ }
+
+ /**
+ * Submit a codesign operation.
+ *
+ * Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param codeSigningSubmissionOptions The codesign request information to be signed by the service.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginSign(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ CodeSigningSubmissionOptions codeSigningSubmissionOptions) {
+ // Generated convenience method for beginSignWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginSignWithModel(
+ codeSigningAccountName,
+ certificateProfileName,
+ BinaryData.fromObject(codeSigningSubmissionOptions),
+ requestOptions);
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/CodeSigningClientBuilder.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/CodeSigningClientBuilder.java
new file mode 100644
index 000000000000..61696db63617
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/CodeSigningClientBuilder.java
@@ -0,0 +1,297 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning;
+
+import com.azure.codesigning.implementation.CodeSigningClientImpl;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ServiceClientBuilder;
+import com.azure.core.client.traits.ConfigurationTrait;
+import com.azure.core.client.traits.HttpTrait;
+import com.azure.core.client.traits.TokenCredentialTrait;
+import com.azure.core.credential.TokenCredential;
+import com.azure.core.http.HttpClient;
+import com.azure.core.http.HttpHeaders;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.HttpPipelinePosition;
+import com.azure.core.http.policy.AddDatePolicy;
+import com.azure.core.http.policy.AddHeadersFromContextPolicy;
+import com.azure.core.http.policy.AddHeadersPolicy;
+import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
+import com.azure.core.http.policy.HttpLogOptions;
+import com.azure.core.http.policy.HttpLoggingPolicy;
+import com.azure.core.http.policy.HttpPipelinePolicy;
+import com.azure.core.http.policy.HttpPolicyProviders;
+import com.azure.core.http.policy.RequestIdPolicy;
+import com.azure.core.http.policy.RetryOptions;
+import com.azure.core.http.policy.RetryPolicy;
+import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.util.ClientOptions;
+import com.azure.core.util.Configuration;
+import com.azure.core.util.CoreUtils;
+import com.azure.core.util.builder.ClientBuilderUtil;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.serializer.JacksonAdapter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/** A builder for creating a new instance of the CodeSigningClient type. */
+@ServiceClientBuilder(serviceClients = {CodeSigningClient.class, CodeSigningAsyncClient.class})
+public final class CodeSigningClientBuilder
+ implements HttpTrait,
+ ConfigurationTrait,
+ TokenCredentialTrait {
+ @Generated private static final String SDK_NAME = "name";
+
+ @Generated private static final String SDK_VERSION = "version";
+
+ @Generated private static final String[] DEFAULT_SCOPES = new String[] {"https://codesigning.azure.net/.default"};
+
+ @Generated
+ private static final Map PROPERTIES = CoreUtils.getProperties("azure-codesigning.properties");
+
+ @Generated private final List pipelinePolicies;
+
+ /** Create an instance of the CodeSigningClientBuilder. */
+ @Generated
+ public CodeSigningClientBuilder() {
+ this.pipelinePolicies = new ArrayList<>();
+ }
+
+ /*
+ * The HTTP pipeline to send requests through.
+ */
+ @Generated private HttpPipeline pipeline;
+
+ /** {@inheritDoc}. */
+ @Generated
+ @Override
+ public CodeSigningClientBuilder pipeline(HttpPipeline pipeline) {
+ if (this.pipeline != null && pipeline == null) {
+ LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured.");
+ }
+ this.pipeline = pipeline;
+ return this;
+ }
+
+ /*
+ * The HTTP client used to send the request.
+ */
+ @Generated private HttpClient httpClient;
+
+ /** {@inheritDoc}. */
+ @Generated
+ @Override
+ public CodeSigningClientBuilder httpClient(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ /*
+ * The logging configuration for HTTP requests and responses.
+ */
+ @Generated private HttpLogOptions httpLogOptions;
+
+ /** {@inheritDoc}. */
+ @Generated
+ @Override
+ public CodeSigningClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) {
+ this.httpLogOptions = httpLogOptions;
+ return this;
+ }
+
+ /*
+ * The client options such as application ID and custom headers to set on a request.
+ */
+ @Generated private ClientOptions clientOptions;
+
+ /** {@inheritDoc}. */
+ @Generated
+ @Override
+ public CodeSigningClientBuilder clientOptions(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ return this;
+ }
+
+ /*
+ * The retry options to configure retry policy for failed requests.
+ */
+ @Generated private RetryOptions retryOptions;
+
+ /** {@inheritDoc}. */
+ @Generated
+ @Override
+ public CodeSigningClientBuilder retryOptions(RetryOptions retryOptions) {
+ this.retryOptions = retryOptions;
+ return this;
+ }
+
+ /** {@inheritDoc}. */
+ @Generated
+ @Override
+ public CodeSigningClientBuilder addPolicy(HttpPipelinePolicy customPolicy) {
+ Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null.");
+ pipelinePolicies.add(customPolicy);
+ return this;
+ }
+
+ /*
+ * The configuration store that is used during construction of the service client.
+ */
+ @Generated private Configuration configuration;
+
+ /** {@inheritDoc}. */
+ @Generated
+ @Override
+ public CodeSigningClientBuilder configuration(Configuration configuration) {
+ this.configuration = configuration;
+ return this;
+ }
+
+ /*
+ * The TokenCredential used for authentication.
+ */
+ @Generated private TokenCredential tokenCredential;
+
+ /** {@inheritDoc}. */
+ @Generated
+ @Override
+ public CodeSigningClientBuilder credential(TokenCredential tokenCredential) {
+ this.tokenCredential = tokenCredential;
+ return this;
+ }
+
+ /*
+ * The Azure region wherein requests for signing will be sent.
+ */
+ @Generated private String region;
+
+ /**
+ * Sets The Azure region wherein requests for signing will be sent.
+ *
+ * @param region the region value.
+ * @return the CodeSigningClientBuilder.
+ */
+ @Generated
+ public CodeSigningClientBuilder region(String region) {
+ this.region = region;
+ return this;
+ }
+
+ /*
+ * Service version
+ */
+ @Generated private CodeSigningServiceVersion serviceVersion;
+
+ /**
+ * Sets Service version.
+ *
+ * @param serviceVersion the serviceVersion value.
+ * @return the CodeSigningClientBuilder.
+ */
+ @Generated
+ public CodeSigningClientBuilder serviceVersion(CodeSigningServiceVersion serviceVersion) {
+ this.serviceVersion = serviceVersion;
+ return this;
+ }
+
+ /*
+ * The retry policy that will attempt to retry failed requests, if applicable.
+ */
+ @Generated private RetryPolicy retryPolicy;
+
+ /**
+ * Sets The retry policy that will attempt to retry failed requests, if applicable.
+ *
+ * @param retryPolicy the retryPolicy value.
+ * @return the CodeSigningClientBuilder.
+ */
+ @Generated
+ public CodeSigningClientBuilder retryPolicy(RetryPolicy retryPolicy) {
+ this.retryPolicy = retryPolicy;
+ return this;
+ }
+
+ /**
+ * Builds an instance of CodeSigningClientImpl with the provided parameters.
+ *
+ * @return an instance of CodeSigningClientImpl.
+ */
+ @Generated
+ private CodeSigningClientImpl buildInnerClient() {
+ HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
+ CodeSigningServiceVersion localServiceVersion =
+ (serviceVersion != null) ? serviceVersion : CodeSigningServiceVersion.getLatest();
+ CodeSigningClientImpl client =
+ new CodeSigningClientImpl(
+ localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), region, localServiceVersion);
+ return client;
+ }
+
+ @Generated
+ private HttpPipeline createHttpPipeline() {
+ Configuration buildConfiguration =
+ (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
+ HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions;
+ ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions;
+ List policies = new ArrayList<>();
+ String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName");
+ String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion");
+ String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions);
+ policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));
+ policies.add(new RequestIdPolicy());
+ policies.add(new AddHeadersFromContextPolicy());
+ HttpHeaders headers = new HttpHeaders();
+ localClientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue()));
+ if (headers.getSize() > 0) {
+ policies.add(new AddHeadersPolicy(headers));
+ }
+ this.pipelinePolicies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
+ .forEach(p -> policies.add(p));
+ HttpPolicyProviders.addBeforeRetryPolicies(policies);
+ policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy()));
+ policies.add(new AddDatePolicy());
+ if (tokenCredential != null) {
+ policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES));
+ }
+ this.pipelinePolicies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
+ .forEach(p -> policies.add(p));
+ HttpPolicyProviders.addAfterRetryPolicies(policies);
+ policies.add(new HttpLoggingPolicy(httpLogOptions));
+ HttpPipeline httpPipeline =
+ new HttpPipelineBuilder()
+ .policies(policies.toArray(new HttpPipelinePolicy[0]))
+ .httpClient(httpClient)
+ .clientOptions(localClientOptions)
+ .build();
+ return httpPipeline;
+ }
+
+ /**
+ * Builds an instance of CodeSigningAsyncClient class.
+ *
+ * @return an instance of CodeSigningAsyncClient.
+ */
+ @Generated
+ public CodeSigningAsyncClient buildAsyncClient() {
+ return new CodeSigningAsyncClient(buildInnerClient());
+ }
+
+ /**
+ * Builds an instance of CodeSigningClient class.
+ *
+ * @return an instance of CodeSigningClient.
+ */
+ @Generated
+ public CodeSigningClient buildClient() {
+ return new CodeSigningClient(buildInnerClient());
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(CodeSigningClientBuilder.class);
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/CodeSigningServiceVersion.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/CodeSigningServiceVersion.java
new file mode 100644
index 000000000000..8ccab172de1f
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/CodeSigningServiceVersion.java
@@ -0,0 +1,34 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning;
+
+import com.azure.core.util.ServiceVersion;
+
+/** Service version of CodeSigningClient. */
+public enum CodeSigningServiceVersion implements ServiceVersion {
+ /** Enum value 2023-06-15-preview. */
+ V2023_06_15_PREVIEW("2023-06-15-preview");
+
+ private final String version;
+
+ CodeSigningServiceVersion(String version) {
+ this.version = version;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getVersion() {
+ return this.version;
+ }
+
+ /**
+ * Gets the latest service version supported by this client library.
+ *
+ * @return The latest {@link CodeSigningServiceVersion}.
+ */
+ public static CodeSigningServiceVersion getLatest() {
+ return V2023_06_15_PREVIEW;
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/implementation/CodeSigningClientImpl.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/implementation/CodeSigningClientImpl.java
new file mode 100644
index 000000000000..87ce4429ad52
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/implementation/CodeSigningClientImpl.java
@@ -0,0 +1,1115 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning.implementation;
+
+import com.azure.codesigning.CodeSigningServiceVersion;
+import com.azure.codesigning.models.CodeSignOperationStatus;
+import com.azure.core.annotation.BodyParam;
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.Post;
+import com.azure.core.annotation.QueryParam;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.exception.ClientAuthenticationException;
+import com.azure.core.exception.HttpResponseException;
+import com.azure.core.exception.ResourceModifiedException;
+import com.azure.core.exception.ResourceNotFoundException;
+import com.azure.core.experimental.models.PollResult;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.policy.RetryPolicy;
+import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.http.rest.PagedFlux;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.PagedResponse;
+import com.azure.core.http.rest.PagedResponseBase;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.core.util.polling.PollerFlux;
+import com.azure.core.util.polling.PollingStrategyOptions;
+import com.azure.core.util.polling.SyncPoller;
+import com.azure.core.util.serializer.JacksonAdapter;
+import com.azure.core.util.serializer.SerializerAdapter;
+import com.azure.core.util.serializer.TypeReference;
+import java.time.Duration;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import reactor.core.publisher.Mono;
+
+/** Initializes a new instance of the CodeSigningClient type. */
+public final class CodeSigningClientImpl {
+ /** The proxy service used to perform REST calls. */
+ private final CodeSigningClientService service;
+
+ /** The Azure region wherein requests for signing will be sent. */
+ private final String region;
+
+ /**
+ * Gets The Azure region wherein requests for signing will be sent.
+ *
+ * @return the region value.
+ */
+ public String getRegion() {
+ return this.region;
+ }
+
+ /** Service version. */
+ private final CodeSigningServiceVersion serviceVersion;
+
+ /**
+ * Gets Service version.
+ *
+ * @return the serviceVersion value.
+ */
+ public CodeSigningServiceVersion getServiceVersion() {
+ return this.serviceVersion;
+ }
+
+ /** The HTTP pipeline to send requests through. */
+ private final HttpPipeline httpPipeline;
+
+ /**
+ * Gets The HTTP pipeline to send requests through.
+ *
+ * @return the httpPipeline value.
+ */
+ public HttpPipeline getHttpPipeline() {
+ return this.httpPipeline;
+ }
+
+ /** The serializer to serialize an object into a string. */
+ private final SerializerAdapter serializerAdapter;
+
+ /**
+ * Gets The serializer to serialize an object into a string.
+ *
+ * @return the serializerAdapter value.
+ */
+ public SerializerAdapter getSerializerAdapter() {
+ return this.serializerAdapter;
+ }
+
+ /**
+ * Initializes an instance of CodeSigningClient client.
+ *
+ * @param region The Azure region wherein requests for signing will be sent.
+ * @param serviceVersion Service version.
+ */
+ public CodeSigningClientImpl(String region, CodeSigningServiceVersion serviceVersion) {
+ this(
+ new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(),
+ JacksonAdapter.createDefaultSerializerAdapter(),
+ region,
+ serviceVersion);
+ }
+
+ /**
+ * Initializes an instance of CodeSigningClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param region The Azure region wherein requests for signing will be sent.
+ * @param serviceVersion Service version.
+ */
+ public CodeSigningClientImpl(HttpPipeline httpPipeline, String region, CodeSigningServiceVersion serviceVersion) {
+ this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), region, serviceVersion);
+ }
+
+ /**
+ * Initializes an instance of CodeSigningClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param serializerAdapter The serializer to serialize an object into a string.
+ * @param region The Azure region wherein requests for signing will be sent.
+ * @param serviceVersion Service version.
+ */
+ public CodeSigningClientImpl(
+ HttpPipeline httpPipeline,
+ SerializerAdapter serializerAdapter,
+ String region,
+ CodeSigningServiceVersion serviceVersion) {
+ this.httpPipeline = httpPipeline;
+ this.serializerAdapter = serializerAdapter;
+ this.region = region;
+ this.serviceVersion = serviceVersion;
+ this.service = RestProxy.create(CodeSigningClientService.class, this.httpPipeline, this.getSerializerAdapter());
+ }
+
+ /**
+ * The interface defining all the services for CodeSigningClient to be used by the proxy service to perform REST
+ * calls.
+ */
+ @Host("https://{region}.codesigning.azure.net/")
+ @ServiceInterface(name = "CodeSigningClient")
+ public interface CodeSigningClientService {
+ @Get("/codesigningaccounts/{codeSigningAccountName}/certificateprofiles/{certificateProfileName}/sign/rootcert")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(
+ value = ClientAuthenticationException.class,
+ code = {401})
+ @UnexpectedResponseExceptionType(
+ value = ResourceNotFoundException.class,
+ code = {404})
+ @UnexpectedResponseExceptionType(
+ value = ResourceModifiedException.class,
+ code = {409})
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getSignRootCertificate(
+ @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion,
+ @PathParam("codeSigningAccountName") String codeSigningAccountName,
+ @PathParam("certificateProfileName") String certificateProfileName,
+ @HeaderParam("accept") String accept,
+ RequestOptions requestOptions,
+ Context context);
+
+ @Get("/codesigningaccounts/{codeSigningAccountName}/certificateprofiles/{certificateProfileName}/sign/rootcert")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(
+ value = ClientAuthenticationException.class,
+ code = {401})
+ @UnexpectedResponseExceptionType(
+ value = ResourceNotFoundException.class,
+ code = {404})
+ @UnexpectedResponseExceptionType(
+ value = ResourceModifiedException.class,
+ code = {409})
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getSignRootCertificateSync(
+ @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion,
+ @PathParam("codeSigningAccountName") String codeSigningAccountName,
+ @PathParam("certificateProfileName") String certificateProfileName,
+ @HeaderParam("accept") String accept,
+ RequestOptions requestOptions,
+ Context context);
+
+ @Get("/codesigningaccounts/{codeSigningAccountName}/certificateprofiles/{certificateProfileName}/sign/eku")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(
+ value = ClientAuthenticationException.class,
+ code = {401})
+ @UnexpectedResponseExceptionType(
+ value = ResourceNotFoundException.class,
+ code = {404})
+ @UnexpectedResponseExceptionType(
+ value = ResourceModifiedException.class,
+ code = {409})
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listSignEkus(
+ @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion,
+ @PathParam("codeSigningAccountName") String codeSigningAccountName,
+ @PathParam("certificateProfileName") String certificateProfileName,
+ @HeaderParam("accept") String accept,
+ RequestOptions requestOptions,
+ Context context);
+
+ @Get("/codesigningaccounts/{codeSigningAccountName}/certificateprofiles/{certificateProfileName}/sign/eku")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(
+ value = ClientAuthenticationException.class,
+ code = {401})
+ @UnexpectedResponseExceptionType(
+ value = ResourceNotFoundException.class,
+ code = {404})
+ @UnexpectedResponseExceptionType(
+ value = ResourceModifiedException.class,
+ code = {409})
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listSignEkusSync(
+ @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion,
+ @PathParam("codeSigningAccountName") String codeSigningAccountName,
+ @PathParam("certificateProfileName") String certificateProfileName,
+ @HeaderParam("accept") String accept,
+ RequestOptions requestOptions,
+ Context context);
+
+ @Post("/codesigningaccounts/{codeSigningAccountName}/certificateprofiles/{certificateProfileName}:sign")
+ @ExpectedResponses({202})
+ @UnexpectedResponseExceptionType(
+ value = ClientAuthenticationException.class,
+ code = {401})
+ @UnexpectedResponseExceptionType(
+ value = ResourceNotFoundException.class,
+ code = {404})
+ @UnexpectedResponseExceptionType(
+ value = ResourceModifiedException.class,
+ code = {409})
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> sign(
+ @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion,
+ @PathParam("codeSigningAccountName") String codeSigningAccountName,
+ @PathParam("certificateProfileName") String certificateProfileName,
+ @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions,
+ Context context);
+
+ @Post("/codesigningaccounts/{codeSigningAccountName}/certificateprofiles/{certificateProfileName}:sign")
+ @ExpectedResponses({202})
+ @UnexpectedResponseExceptionType(
+ value = ClientAuthenticationException.class,
+ code = {401})
+ @UnexpectedResponseExceptionType(
+ value = ResourceNotFoundException.class,
+ code = {404})
+ @UnexpectedResponseExceptionType(
+ value = ResourceModifiedException.class,
+ code = {409})
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response signSync(
+ @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion,
+ @PathParam("codeSigningAccountName") String codeSigningAccountName,
+ @PathParam("certificateProfileName") String certificateProfileName,
+ @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions,
+ Context context);
+
+ @Get("{nextLink}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(
+ value = ClientAuthenticationException.class,
+ code = {401})
+ @UnexpectedResponseExceptionType(
+ value = ResourceNotFoundException.class,
+ code = {404})
+ @UnexpectedResponseExceptionType(
+ value = ResourceModifiedException.class,
+ code = {409})
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listSignEkusNext(
+ @PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("region") String region,
+ @HeaderParam("accept") String accept,
+ RequestOptions requestOptions,
+ Context context);
+
+ @Get("{nextLink}")
+ @ExpectedResponses({200})
+ @UnexpectedResponseExceptionType(
+ value = ClientAuthenticationException.class,
+ code = {401})
+ @UnexpectedResponseExceptionType(
+ value = ResourceNotFoundException.class,
+ code = {404})
+ @UnexpectedResponseExceptionType(
+ value = ResourceModifiedException.class,
+ code = {409})
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listSignEkusNextSync(
+ @PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("region") String region,
+ @HeaderParam("accept") String accept,
+ RequestOptions requestOptions,
+ Context context);
+ }
+
+ /**
+ * Gets the codesigning root certificate on the certificate chain for that account and profile name.
+ *
+ * The root certificate is generated as part of the initial account creation and it is used to sign the bits for
+ * the profile provided.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * BinaryData
+ * }
+ *
+ * @param codeSigningAccountName CodeSigning account name.
+ * @param certificateProfileName Certificate profile name.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the response body along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getSignRootCertificateWithResponseAsync(
+ String codeSigningAccountName, String certificateProfileName, RequestOptions requestOptions) {
+ final String accept = "application/json, application/x-x509-ca-cert";
+ return FluxUtil.withContext(
+ context ->
+ service.getSignRootCertificate(
+ this.getRegion(),
+ this.getServiceVersion().getVersion(),
+ codeSigningAccountName,
+ certificateProfileName,
+ accept,
+ requestOptions,
+ context));
+ }
+
+ /**
+ * Gets the codesigning root certificate on the certificate chain for that account and profile name.
+ *
+ * The root certificate is generated as part of the initial account creation and it is used to sign the bits for
+ * the profile provided.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * BinaryData
+ * }
+ *
+ * @param codeSigningAccountName CodeSigning account name.
+ * @param certificateProfileName Certificate profile name.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the response body along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getSignRootCertificateWithResponse(
+ String codeSigningAccountName, String certificateProfileName, RequestOptions requestOptions) {
+ final String accept = "application/json, application/x-x509-ca-cert";
+ return service.getSignRootCertificateSync(
+ this.getRegion(),
+ this.getServiceVersion().getVersion(),
+ codeSigningAccountName,
+ certificateProfileName,
+ accept,
+ requestOptions,
+ Context.NONE);
+ }
+
+ /**
+ * Gets a list of extended key usage object identifiers that are allowed for this account and profile combination.
+ *
+ * The list of extended key usages are used to determine the purpose of the certificate usage as part of the
+ * codesigning operation.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * {
+ * ekus (Required): [
+ * String (Required)
+ * ]
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ExtendedKeyUsage items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSignEkusSinglePageAsync(
+ String codeSigningAccountName, String certificateProfileName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context ->
+ service.listSignEkus(
+ this.getRegion(),
+ this.getServiceVersion().getVersion(),
+ codeSigningAccountName,
+ certificateProfileName,
+ accept,
+ requestOptions,
+ context))
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ getValues(res.getValue(), "value"),
+ getNextLink(res.getValue(), "nextLink"),
+ null));
+ }
+
+ /**
+ * Gets a list of extended key usage object identifiers that are allowed for this account and profile combination.
+ *
+ * The list of extended key usages are used to determine the purpose of the certificate usage as part of the
+ * codesigning operation.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * {
+ * ekus (Required): [
+ * String (Required)
+ * ]
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ExtendedKeyUsage items as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listSignEkusAsync(
+ String codeSigningAccountName, String certificateProfileName, RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE);
+ return new PagedFlux<>(
+ () -> listSignEkusSinglePageAsync(codeSigningAccountName, certificateProfileName, requestOptions),
+ nextLink -> listSignEkusNextSinglePageAsync(nextLink, requestOptionsForNextPage));
+ }
+
+ /**
+ * Gets a list of extended key usage object identifiers that are allowed for this account and profile combination.
+ *
+ * The list of extended key usages are used to determine the purpose of the certificate usage as part of the
+ * codesigning operation.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * {
+ * ekus (Required): [
+ * String (Required)
+ * ]
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ExtendedKeyUsage items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listSignEkusSinglePage(
+ String codeSigningAccountName, String certificateProfileName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res =
+ service.listSignEkusSync(
+ this.getRegion(),
+ this.getServiceVersion().getVersion(),
+ codeSigningAccountName,
+ certificateProfileName,
+ accept,
+ requestOptions,
+ Context.NONE);
+ return new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ getValues(res.getValue(), "value"),
+ getNextLink(res.getValue(), "nextLink"),
+ null);
+ }
+
+ /**
+ * Gets a list of extended key usage object identifiers that are allowed for this account and profile combination.
+ *
+ * The list of extended key usages are used to determine the purpose of the certificate usage as part of the
+ * codesigning operation.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * {
+ * ekus (Required): [
+ * String (Required)
+ * ]
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ExtendedKeyUsage items as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listSignEkus(
+ String codeSigningAccountName, String certificateProfileName, RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE);
+ return new PagedIterable<>(
+ () -> listSignEkusSinglePage(codeSigningAccountName, certificateProfileName, requestOptions),
+ nextLink -> listSignEkusNextSinglePage(nextLink, requestOptionsForNextPage));
+ }
+
+ /**
+ * Submit a codesign operation.
+ *
+ * Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ *
Request Body Schema
+ *
+ *
{@code
+ * {
+ * signatureAlgorithm: String(RS256/RS384/RS512/PS256/PS384/PS512/ES256/ES384/ES512/ES256K) (Required)
+ * digest: byte[] (Required)
+ * fileHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * authenticodeHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * {
+ * id: String (Required)
+ * status: String (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param codeSigningSubmissionOptions The codesign request information to be signed by the service.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return status details for long running operations along with {@link Response} on successful completion of {@link
+ * Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> signWithResponseAsync(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context ->
+ service.sign(
+ this.getRegion(),
+ this.getServiceVersion().getVersion(),
+ codeSigningAccountName,
+ certificateProfileName,
+ accept,
+ codeSigningSubmissionOptions,
+ requestOptions,
+ context));
+ }
+
+ /**
+ * Submit a codesign operation.
+ *
+ * Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ *
Request Body Schema
+ *
+ *
{@code
+ * {
+ * signatureAlgorithm: String(RS256/RS384/RS512/PS256/PS384/PS512/ES256/ES384/ES512/ES256K) (Required)
+ * digest: byte[] (Required)
+ * fileHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * authenticodeHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * {
+ * id: String (Required)
+ * status: String (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param codeSigningSubmissionOptions The codesign request information to be signed by the service.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return status details for long running operations along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response signWithResponse(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.signSync(
+ this.getRegion(),
+ this.getServiceVersion().getVersion(),
+ codeSigningAccountName,
+ certificateProfileName,
+ accept,
+ codeSigningSubmissionOptions,
+ requestOptions,
+ Context.NONE);
+ }
+
+ /**
+ * Submit a codesign operation.
+ *
+ * Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ *
Request Body Schema
+ *
+ *
{@code
+ * {
+ * signatureAlgorithm: String(RS256/RS384/RS512/PS256/PS384/PS512/ES256/ES384/ES512/ES256K) (Required)
+ * digest: byte[] (Required)
+ * fileHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * authenticodeHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * {
+ * id: String (Required)
+ * status: String (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param codeSigningSubmissionOptions The codesign request information to be signed by the service.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link PollerFlux} for polling of status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginSignAsync(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions) {
+ return PollerFlux.create(
+ Duration.ofSeconds(1),
+ () ->
+ this.signWithResponseAsync(
+ codeSigningAccountName,
+ certificateProfileName,
+ codeSigningSubmissionOptions,
+ requestOptions),
+ new com.azure.core.experimental.util.polling.OperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.getHttpPipeline())
+ .setEndpoint(null)
+ .setContext(
+ requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)),
+ TypeReference.createInstance(BinaryData.class),
+ TypeReference.createInstance(BinaryData.class));
+ }
+
+ /**
+ * Submit a codesign operation.
+ *
+ * Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ *
Request Body Schema
+ *
+ *
{@code
+ * {
+ * signatureAlgorithm: String(RS256/RS384/RS512/PS256/PS384/PS512/ES256/ES384/ES512/ES256K) (Required)
+ * digest: byte[] (Required)
+ * fileHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * authenticodeHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * {
+ * id: String (Required)
+ * status: String (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param codeSigningSubmissionOptions The codesign request information to be signed by the service.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginSign(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions) {
+ return SyncPoller.createPoller(
+ Duration.ofSeconds(1),
+ () ->
+ this.signWithResponse(
+ codeSigningAccountName,
+ certificateProfileName,
+ codeSigningSubmissionOptions,
+ requestOptions),
+ new com.azure.core.experimental.util.polling.SyncOperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.getHttpPipeline())
+ .setEndpoint(null)
+ .setContext(
+ requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)),
+ TypeReference.createInstance(BinaryData.class),
+ TypeReference.createInstance(BinaryData.class));
+ }
+
+ /**
+ * Submit a codesign operation.
+ *
+ * Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ *
Request Body Schema
+ *
+ *
{@code
+ * {
+ * signatureAlgorithm: String(RS256/RS384/RS512/PS256/PS384/PS512/ES256/ES384/ES512/ES256K) (Required)
+ * digest: byte[] (Required)
+ * fileHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * authenticodeHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * {
+ * id: String (Required)
+ * status: String (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param codeSigningSubmissionOptions The codesign request information to be signed by the service.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link PollerFlux} for polling of status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginSignWithModelAsync(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions) {
+ return PollerFlux.create(
+ Duration.ofSeconds(1),
+ () ->
+ this.signWithResponseAsync(
+ codeSigningAccountName,
+ certificateProfileName,
+ codeSigningSubmissionOptions,
+ requestOptions),
+ new com.azure.core.experimental.util.polling.OperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.getHttpPipeline())
+ .setEndpoint(null)
+ .setContext(
+ requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)),
+ TypeReference.createInstance(PollResult.class),
+ TypeReference.createInstance(CodeSignOperationStatus.class));
+ }
+
+ /**
+ * Submit a codesign operation.
+ *
+ * Submit a codesign operation under the created codesign account and profile name provided.
+ *
+ *
Request Body Schema
+ *
+ *
{@code
+ * {
+ * signatureAlgorithm: String(RS256/RS384/RS512/PS256/PS384/PS512/ES256/ES384/ES512/ES256K) (Required)
+ * digest: byte[] (Required)
+ * fileHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * authenticodeHashList (Optional): [
+ * byte[] (Optional)
+ * ]
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * {
+ * id: String (Required)
+ * status: String (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * }
+ * }
+ *
+ * @param codeSigningAccountName Azure CodeSigning account name.
+ * @param certificateProfileName Azure Codesigning certificate profile name under a codesign account.
+ * @param codeSigningSubmissionOptions The codesign request information to be signed by the service.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginSignWithModel(
+ String codeSigningAccountName,
+ String certificateProfileName,
+ BinaryData codeSigningSubmissionOptions,
+ RequestOptions requestOptions) {
+ return SyncPoller.createPoller(
+ Duration.ofSeconds(1),
+ () ->
+ this.signWithResponse(
+ codeSigningAccountName,
+ certificateProfileName,
+ codeSigningSubmissionOptions,
+ requestOptions),
+ new com.azure.core.experimental.util.polling.SyncOperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.getHttpPipeline())
+ .setEndpoint(null)
+ .setContext(
+ requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)),
+ TypeReference.createInstance(PollResult.class),
+ TypeReference.createInstance(CodeSignOperationStatus.class));
+ }
+
+ /**
+ * Gets a list of extended key usage object identifiers that are allowed for this account and profile combination.
+ *
+ * Get the next page of items.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * {
+ * ekus (Required): [
+ * String (Required)
+ * ]
+ * }
+ * }
+ *
+ * @param nextLink The URL to get the next list of items
+ * The nextLink parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ExtendedKeyUsage items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSignEkusNextSinglePageAsync(
+ String nextLink, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context ->
+ service.listSignEkusNext(nextLink, this.getRegion(), accept, requestOptions, context))
+ .map(
+ res ->
+ new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ getValues(res.getValue(), "value"),
+ getNextLink(res.getValue(), "nextLink"),
+ null));
+ }
+
+ /**
+ * Gets a list of extended key usage object identifiers that are allowed for this account and profile combination.
+ *
+ * Get the next page of items.
+ *
+ *
Response Body Schema
+ *
+ *
{@code
+ * {
+ * ekus (Required): [
+ * String (Required)
+ * ]
+ * }
+ * }
+ *
+ * @param nextLink The URL to get the next list of items
+ * The nextLink parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ExtendedKeyUsage items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listSignEkusNextSinglePage(String nextLink, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res =
+ service.listSignEkusNextSync(nextLink, this.getRegion(), accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(
+ res.getRequest(),
+ res.getStatusCode(),
+ res.getHeaders(),
+ getValues(res.getValue(), "value"),
+ getNextLink(res.getValue(), "nextLink"),
+ null);
+ }
+
+ private List getValues(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ List> values = (List>) obj.get(path);
+ return values.stream().map(BinaryData::fromObject).collect(Collectors.toList());
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+
+ private String getNextLink(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ return (String) obj.get(path);
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/implementation/package-info.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/implementation/package-info.java
new file mode 100644
index 000000000000..d3af014ecba4
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/implementation/package-info.java
@@ -0,0 +1,9 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the implementations for CodeSigning. Azure CodeSigning is a service that provides managed code
+ * signing for all.
+ */
+package com.azure.codesigning.implementation;
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/CodeSignOperationStatus.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/CodeSignOperationStatus.java
new file mode 100644
index 000000000000..a91c34e103c3
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/CodeSignOperationStatus.java
@@ -0,0 +1,60 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning.models;
+
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.Immutable;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The codesign operation status response. */
+@Immutable
+public final class CodeSignOperationStatus {
+ /*
+ * Unique Id of the operation.
+ */
+ @Generated
+ @JsonProperty(value = "id")
+ private String id;
+
+ /*
+ * The result of the codesign operation including the signature and signing certificate.
+ */
+ @Generated
+ @JsonProperty(value = "signResult")
+ private CodeSignResult signResult;
+
+ /**
+ * Creates an instance of CodeSignOperationStatus class.
+ *
+ * @param id the id value to set.
+ */
+ @Generated
+ @JsonCreator
+ private CodeSignOperationStatus(@JsonProperty(value = "id") String id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the id property: Unique Id of the operation.
+ *
+ * @return the id value.
+ */
+ @Generated
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * Get the signResult property: The result of the codesign operation including the signature and signing
+ * certificate.
+ *
+ * @return the signResult value.
+ */
+ @Generated
+ public CodeSignResult getSignResult() {
+ return this.signResult;
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/CodeSignResult.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/CodeSignResult.java
new file mode 100644
index 000000000000..21da87ca7806
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/CodeSignResult.java
@@ -0,0 +1,79 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning.models;
+
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.Immutable;
+import com.azure.core.util.CoreUtils;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/** The sign status model. */
+@Immutable
+public final class CodeSignResult {
+ /*
+ * Response Id of the codesign operation.
+ */
+ @Generated
+ @JsonProperty(value = "operationId")
+ private String operationId;
+
+ /*
+ * Digital signature of the requested content digest.
+ */
+ @Generated
+ @JsonProperty(value = "signature")
+ private byte[] signature;
+
+ /*
+ * Signing certificate corresponding to the private key used to codesign the requested
+ * digest.
+ */
+ @Generated
+ @JsonProperty(value = "signingCertificate")
+ private byte[] signingCertificate;
+
+ /**
+ * Creates an instance of CodeSignResult class.
+ *
+ * @param operationId the operationId value to set.
+ */
+ @Generated
+ @JsonCreator
+ private CodeSignResult(@JsonProperty(value = "operationId") String operationId) {
+ this.operationId = operationId;
+ }
+
+ /**
+ * Get the operationId property: Response Id of the codesign operation.
+ *
+ * @return the operationId value.
+ */
+ @Generated
+ public String getOperationId() {
+ return this.operationId;
+ }
+
+ /**
+ * Get the signature property: Digital signature of the requested content digest.
+ *
+ * @return the signature value.
+ */
+ @Generated
+ public byte[] getSignature() {
+ return CoreUtils.clone(this.signature);
+ }
+
+ /**
+ * Get the signingCertificate property: Signing certificate corresponding to the private key used to codesign the
+ * requested digest.
+ *
+ * @return the signingCertificate value.
+ */
+ @Generated
+ public byte[] getSigningCertificate() {
+ return CoreUtils.clone(this.signingCertificate);
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/CodeSigningSubmissionOptions.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/CodeSigningSubmissionOptions.java
new file mode 100644
index 000000000000..06fa76cf323b
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/CodeSigningSubmissionOptions.java
@@ -0,0 +1,123 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.core.annotation.Generated;
+import com.azure.core.util.CoreUtils;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** The codesign request information to be signed by the service. */
+@Fluent
+public final class CodeSigningSubmissionOptions {
+ /*
+ * The supported signature algorithm identifiers.
+ */
+ @Generated
+ @JsonProperty(value = "signatureAlgorithm")
+ private SignatureAlgorithm signatureAlgorithm;
+
+ /*
+ * Content digest to codesign.
+ */
+ @Generated
+ @JsonProperty(value = "digest")
+ private byte[] digest;
+
+ /*
+ * List of full file digital signatures.
+ */
+ @Generated
+ @JsonProperty(value = "fileHashList")
+ private List fileHashList;
+
+ /*
+ * List of authenticode digital signatures.
+ */
+ @Generated
+ @JsonProperty(value = "authenticodeHashList")
+ private List authenticodeHashList;
+
+ /**
+ * Creates an instance of CodeSigningSubmissionOptions class.
+ *
+ * @param signatureAlgorithm the signatureAlgorithm value to set.
+ * @param digest the digest value to set.
+ */
+ @Generated
+ @JsonCreator
+ public CodeSigningSubmissionOptions(
+ @JsonProperty(value = "signatureAlgorithm") SignatureAlgorithm signatureAlgorithm,
+ @JsonProperty(value = "digest") byte[] digest) {
+ this.signatureAlgorithm = signatureAlgorithm;
+ this.digest = digest;
+ }
+
+ /**
+ * Get the signatureAlgorithm property: The supported signature algorithm identifiers.
+ *
+ * @return the signatureAlgorithm value.
+ */
+ @Generated
+ public SignatureAlgorithm getSignatureAlgorithm() {
+ return this.signatureAlgorithm;
+ }
+
+ /**
+ * Get the digest property: Content digest to codesign.
+ *
+ * @return the digest value.
+ */
+ @Generated
+ public byte[] getDigest() {
+ return CoreUtils.clone(this.digest);
+ }
+
+ /**
+ * Get the fileHashList property: List of full file digital signatures.
+ *
+ * @return the fileHashList value.
+ */
+ @Generated
+ public List getFileHashList() {
+ return this.fileHashList;
+ }
+
+ /**
+ * Set the fileHashList property: List of full file digital signatures.
+ *
+ * @param fileHashList the fileHashList value to set.
+ * @return the CodeSigningSubmissionOptions object itself.
+ */
+ @Generated
+ public CodeSigningSubmissionOptions setFileHashList(List fileHashList) {
+ this.fileHashList = fileHashList;
+ return this;
+ }
+
+ /**
+ * Get the authenticodeHashList property: List of authenticode digital signatures.
+ *
+ * @return the authenticodeHashList value.
+ */
+ @Generated
+ public List getAuthenticodeHashList() {
+ return this.authenticodeHashList;
+ }
+
+ /**
+ * Set the authenticodeHashList property: List of authenticode digital signatures.
+ *
+ * @param authenticodeHashList the authenticodeHashList value to set.
+ * @return the CodeSigningSubmissionOptions object itself.
+ */
+ @Generated
+ public CodeSigningSubmissionOptions setAuthenticodeHashList(List authenticodeHashList) {
+ this.authenticodeHashList = authenticodeHashList;
+ return this;
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/ExtendedKeyUsage.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/ExtendedKeyUsage.java
new file mode 100644
index 000000000000..c06688f99aec
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/ExtendedKeyUsage.java
@@ -0,0 +1,35 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning.models;
+
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.Immutable;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/** Extended key usage object identifier that are allowed. */
+@Immutable
+public final class ExtendedKeyUsage {
+ /*
+ * An element of ekus.
+ */
+ @Generated
+ @JsonProperty(value = "ekus", access = JsonProperty.Access.WRITE_ONLY)
+ private List ekus;
+
+ /** Creates an instance of ExtendedKeyUsage class. */
+ @Generated
+ private ExtendedKeyUsage() {}
+
+ /**
+ * Get the ekus property: An element of ekus.
+ *
+ * @return the ekus value.
+ */
+ @Generated
+ public List getEkus() {
+ return this.ekus;
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/SignatureAlgorithm.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/SignatureAlgorithm.java
new file mode 100644
index 000000000000..045f2f2b2698
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/SignatureAlgorithm.java
@@ -0,0 +1,74 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning.models;
+
+import com.azure.core.annotation.Generated;
+import com.azure.core.util.ExpandableStringEnum;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import java.util.Collection;
+
+/** Algorithms supported for signing. */
+public final class SignatureAlgorithm extends ExpandableStringEnum {
+ /** RSASSA-PKCS1-v1_5 using SHA-256 hash algorithm. */
+ @Generated public static final SignatureAlgorithm RS256 = fromString("RS256");
+
+ /** RSASSA-PKCS1-v1_5 using SHA-384 hash algorithm. */
+ @Generated public static final SignatureAlgorithm RS384 = fromString("RS384");
+
+ /** RSASSA-PKCS1-v1_5 using SHA-512 hash algorithm. */
+ @Generated public static final SignatureAlgorithm RS512 = fromString("RS512");
+
+ /** RSASSA-PSS using SHA-256 hash algorithm. */
+ @Generated public static final SignatureAlgorithm PS256 = fromString("PS256");
+
+ /** RSASSA-PSS using SHA-384 hash algorithm. */
+ @Generated public static final SignatureAlgorithm PS384 = fromString("PS384");
+
+ /** RSASSA-PSS using SHA-512 hash algorithm. */
+ @Generated public static final SignatureAlgorithm PS512 = fromString("PS512");
+
+ /** ECDSA using P-256 and SHA-256 hash algorithm. */
+ @Generated public static final SignatureAlgorithm ES256 = fromString("ES256");
+
+ /** ECDSA using P-384 and SHA-384 hash algorithm. */
+ @Generated public static final SignatureAlgorithm ES384 = fromString("ES384");
+
+ /** ECDSA using P-521 and SHA-512 hash algorithm. */
+ @Generated public static final SignatureAlgorithm ES512 = fromString("ES512");
+
+ /** ECDSA using secp256k1 and SHA-256 hash algorithm. */
+ @Generated public static final SignatureAlgorithm ES256K = fromString("ES256K");
+
+ /**
+ * Creates a new instance of SignatureAlgorithm value.
+ *
+ * @deprecated Use the {@link #fromString(String)} factory method.
+ */
+ @Generated
+ @Deprecated
+ public SignatureAlgorithm() {}
+
+ /**
+ * Creates or finds a SignatureAlgorithm from its string representation.
+ *
+ * @param name a name to look for.
+ * @return the corresponding SignatureAlgorithm.
+ */
+ @Generated
+ @JsonCreator
+ public static SignatureAlgorithm fromString(String name) {
+ return fromString(name, SignatureAlgorithm.class);
+ }
+
+ /**
+ * Gets known SignatureAlgorithm values.
+ *
+ * @return known SignatureAlgorithm values.
+ */
+ @Generated
+ public static Collection values() {
+ return values(SignatureAlgorithm.class);
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/package-info.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/package-info.java
new file mode 100644
index 000000000000..9ecfc4b34781
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/models/package-info.java
@@ -0,0 +1,9 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the data models for CodeSigning. Azure CodeSigning is a service that provides managed code signing
+ * for all.
+ */
+package com.azure.codesigning.models;
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/package-info.java b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/package-info.java
new file mode 100644
index 000000000000..752dfb3c6917
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/com/azure/codesigning/package-info.java
@@ -0,0 +1,9 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the classes for CodeSigning. Azure CodeSigning is a service that provides managed code signing for
+ * all.
+ */
+package com.azure.codesigning;
diff --git a/sdk/codesigning/azure-codesigning/src/main/java/module-info.java b/sdk/codesigning/azure-codesigning/src/main/java/module-info.java
new file mode 100644
index 000000000000..6a6c4347bbcb
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/java/module-info.java
@@ -0,0 +1,15 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+module com.azure.codesigning {
+ requires transitive com.azure.core;
+ requires transitive com.azure.core.experimental;
+
+ exports com.azure.codesigning;
+ exports com.azure.codesigning.models;
+
+ opens com.azure.codesigning.models to
+ com.azure.core,
+ com.fasterxml.jackson.databind;
+}
diff --git a/sdk/codesigning/azure-codesigning/src/main/resources/azure-codesigning.properties b/sdk/codesigning/azure-codesigning/src/main/resources/azure-codesigning.properties
new file mode 100644
index 000000000000..ca812989b4f2
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/main/resources/azure-codesigning.properties
@@ -0,0 +1,2 @@
+name=${project.artifactId}
+version=${project.version}
diff --git a/sdk/codesigning/azure-codesigning/src/samples/java/com/azure/codesigning/ReadmeSamples.java b/sdk/codesigning/azure-codesigning/src/samples/java/com/azure/codesigning/ReadmeSamples.java
new file mode 100644
index 000000000000..80f0a6a40ef2
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/samples/java/com/azure/codesigning/ReadmeSamples.java
@@ -0,0 +1,12 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning;
+
+public final class ReadmeSamples {
+ public void readmeSamples() {
+ // BEGIN: com.azure.codesigning.readme
+ // END: com.azure.codesigning.readme
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/src/test/java/com/azure/codesigning/generated/CodeSigningClientTestBase.java b/sdk/codesigning/azure-codesigning/src/test/java/com/azure/codesigning/generated/CodeSigningClientTestBase.java
new file mode 100644
index 000000000000..6f7f0aa9ed01
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/src/test/java/com/azure/codesigning/generated/CodeSigningClientTestBase.java
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.codesigning.generated;
+
+// The Java test files under 'generated' package are generated for your reference.
+// If you wish to modify these files, please copy them out of the 'generated' package, and modify there.
+// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test.
+
+import com.azure.codesigning.CodeSigningClient;
+import com.azure.codesigning.CodeSigningClientBuilder;
+import com.azure.core.credential.AccessToken;
+import com.azure.core.http.HttpClient;
+import com.azure.core.http.policy.HttpLogDetailLevel;
+import com.azure.core.http.policy.HttpLogOptions;
+import com.azure.core.test.TestMode;
+import com.azure.core.test.TestProxyTestBase;
+import com.azure.core.util.Configuration;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+import java.time.OffsetDateTime;
+import reactor.core.publisher.Mono;
+
+class CodeSigningClientTestBase extends TestProxyTestBase {
+ protected CodeSigningClient codeSigningClient;
+
+ @Override
+ protected void beforeTest() {
+ CodeSigningClientBuilder codeSigningClientbuilder =
+ new CodeSigningClientBuilder()
+ .region(Configuration.getGlobalConfiguration().get("REGION", "region"))
+ .httpClient(HttpClient.createDefault())
+ .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
+ if (getTestMode() == TestMode.PLAYBACK) {
+ codeSigningClientbuilder
+ .httpClient(interceptorManager.getPlaybackClient())
+ .credential(request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)));
+ } else if (getTestMode() == TestMode.RECORD) {
+ codeSigningClientbuilder
+ .addPolicy(interceptorManager.getRecordPolicy())
+ .credential(new DefaultAzureCredentialBuilder().build());
+ } else if (getTestMode() == TestMode.LIVE) {
+ codeSigningClientbuilder.credential(new DefaultAzureCredentialBuilder().build());
+ }
+ codeSigningClient = codeSigningClientbuilder.buildClient();
+ }
+}
diff --git a/sdk/codesigning/azure-codesigning/tsp-location.yaml b/sdk/codesigning/azure-codesigning/tsp-location.yaml
new file mode 100644
index 000000000000..3225466307b2
--- /dev/null
+++ b/sdk/codesigning/azure-codesigning/tsp-location.yaml
@@ -0,0 +1,5 @@
+additionalDirectories: []
+repo: Azure/azure-rest-api-specs
+commit: 80c5b33a4334eed1df2547e775e187b9e58d2a19
+directory: specification/codesigning/CodeSigning
+
diff --git a/sdk/codesigning/ci.yml b/sdk/codesigning/ci.yml
new file mode 100644
index 000000000000..ef84213ae740
--- /dev/null
+++ b/sdk/codesigning/ci.yml
@@ -0,0 +1,47 @@
+# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
+
+trigger:
+ branches:
+ include:
+ - main
+ - hotfix/*
+ - release/*
+ paths:
+ include:
+ - sdk/codesigning/ci.yml
+ - sdk/codesigning/azure-codesigning/
+ exclude:
+ - sdk/codesigning/pom.xml
+ - sdk/codesigning/azure-codesigning/pom.xml
+
+pr:
+ branches:
+ include:
+ - main
+ - feature/*
+ - hotfix/*
+ - release/*
+ paths:
+ include:
+ - sdk/codesigning/ci.yml
+ - sdk/codesigning/azure-codesigning/
+ exclude:
+ - sdk/codesigning/pom.xml
+ - sdk/codesigning/azure-codesigning/pom.xml
+
+parameters:
+ - name: release_azurecodesigning
+ displayName: azure-codesigning
+ type: boolean
+ default: true
+
+extends:
+ template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
+ parameters:
+ ServiceDirectory: codesigning
+ EnableBatchRelease: true
+ Artifacts:
+ - name: azure-codesigning
+ groupId: com.azure
+ safeName: azurecodesigning
+ releaseInBatch: ${{ parameters.release_azurecodesigning }}
diff --git a/sdk/codesigning/pom.xml b/sdk/codesigning/pom.xml
new file mode 100644
index 000000000000..72e70926fc05
--- /dev/null
+++ b/sdk/codesigning/pom.xml
@@ -0,0 +1,15 @@
+
+
+ 4.0.0
+ com.azure
+ azure-codesigning-service
+ pom
+ 1.0.0
+
+
+ azure-codesigning
+
+