diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index ae0662c99c76..cbad344a5d21 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -264,6 +264,7 @@ com.azure.spring:spring-cloud-azure-stream-binder-servicebus-core;5.16.0;5.17.0- com.azure.spring:spring-cloud-azure-stream-binder-servicebus;5.16.0;5.17.0-beta.1 com.azure.spring:spring-cloud-azure-testcontainers;5.16.0;5.17.0-beta.1 com.azure:azure-spring-data-cosmos;5.16.0;5.17.0-beta.1 +com.azure:azure-security-codetransparency;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager;2.42.0;2.43.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appplatform;2.42.0;2.43.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appservice;2.42.0;2.43.0-beta.1 diff --git a/sdk/confidentialledger/azure-security-codetransparency/CHANGELOG.md b/sdk/confidentialledger/azure-security-codetransparency/CHANGELOG.md new file mode 100644 index 000000000000..078c902c5359 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/CHANGELOG.md @@ -0,0 +1,16 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Azure CodeTransparency client library for Java. This package contains Microsoft Azure CodeTransparency client library. + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes +### Features Added + +- Initial release for the azure-security-codetransparency Java SDK. diff --git a/sdk/confidentialledger/azure-security-codetransparency/README.md b/sdk/confidentialledger/azure-security-codetransparency/README.md new file mode 100644 index 000000000000..040b8d889e13 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/README.md @@ -0,0 +1,80 @@ +# Azure CodeTransparency client library for Java + +Azure CodeTransparency client library for Java. + +This package contains Microsoft Azure CodeTransparency client library. + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] +- [Product documentation][product_documentation] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-security-codetransparency;current}) +```xml + + com.azure + azure-security-codetransparency + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Authentication + +[Azure Identity][azure_identity] package provides the default implementation for authenticating the client. + +## Key concepts + +## Examples + +```java com.azure.security.codetransparency.readme +``` + +### Service API versions + +The client library targets the latest service API version by default. +The service client builder accepts an optional service API version parameter to specify which API version to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when initializing a service client via the service client builder. +This ensures that the client can communicate with services using the specified API version. + +When selecting an API version, it is important to verify that there are no breaking changes compared to the latest API version. +If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[product_documentation]: https://azure.microsoft.com/services/ +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fconfidentialledger%2Fazure-security-codetransparency%2FREADME.png) diff --git a/sdk/confidentialledger/azure-security-codetransparency/assets.json b/sdk/confidentialledger/azure-security-codetransparency/assets.json new file mode 100644 index 000000000000..a424f02b1b89 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/assets.json @@ -0,0 +1 @@ +{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/confidentialledger/azure-security-codetransparency","Tag":""} \ No newline at end of file diff --git a/sdk/confidentialledger/azure-security-codetransparency/pom.xml b/sdk/confidentialledger/azure-security-codetransparency/pom.xml new file mode 100644 index 000000000000..480ff6cdf46a --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-security-codetransparency + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for CodeTransparency + This package contains Microsoft Azure CodeTransparency client library. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + com.azure + azure-json + 1.3.0 + + + com.azure + azure-xml + 1.1.0 + + + com.azure + azure-core + 1.51.0 + + + com.azure + azure-core-http-netty + 1.15.3 + + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + com.azure + azure-core-test + 1.26.2 + test + + + com.azure + azure-identity + 1.13.2 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + + + diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyAsyncClient.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyAsyncClient.java new file mode 100644 index 000000000000..c685bffffe6e --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyAsyncClient.java @@ -0,0 +1,635 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency; + +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.http.rest.PagedFlux; +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.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.security.codetransparency.implementation.CodeTransparencyClientImpl; +import com.azure.security.codetransparency.models.CodeTransparencyConfiguration; +import com.azure.security.codetransparency.models.CreateEntryResult; +import com.azure.security.codetransparency.models.DidDocument; +import com.azure.security.codetransparency.models.GetOperationResult; +import com.azure.security.codetransparency.models.ListOperationResult; +import com.azure.security.codetransparency.models.ParametersResult; +import com.azure.security.codetransparency.models.VersionResult; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous CodeTransparencyClient type. + */ +@ServiceClient(builder = CodeTransparencyClientBuilder.class, isAsync = true) +public final class CodeTransparencyAsyncClient { + @Generated + private final CodeTransparencyClientImpl serviceClient; + + /** + * Initializes an instance of CodeTransparencyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CodeTransparencyAsyncClient(CodeTransparencyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Post an entry to be registered on the CodeTransparency instance. + *

Request Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     operationId: String (Required)
+     * }
+     * }
+ * + * @param body A raw CoseSign1 signature. + * @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 response of entry submission containing the operationId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createEntryWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createEntryWithResponseAsync(body, requestOptions); + } + + /** + * Get the status the entry operation. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     entryId: String (Optional)
+     *     error: String (Optional)
+     *     operationId: String (Required)
+     *     status: String(running/failed/succeeded) (Required)
+     * }
+     * }
+ * + * @param operationId ID of the operation to retrieve. + * @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 status the entry operation along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getEntryStatusWithResponse(String operationId, RequestOptions requestOptions) { + return this.serviceClient.getEntryStatusWithResponseAsync(operationId, requestOptions); + } + + /** + * Get the status of all entries operations. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     operations (Required): [
+     *          (Required){
+     *             entryId: String (Optional)
+     *             error: String (Optional)
+     *             operationId: String (Required)
+     *             status: String(running/failed/succeeded) (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @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 status of all entries operations along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listEntryStatusesWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listEntryStatusesWithResponseAsync(requestOptions); + } + + /** + * Get Entry with or without receipt embedded in its unprotected header. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
embedReceiptBooleanNoEmbed a receipt as part of the response
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + * @param entryId ID of the entry to retrieve. + * @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 entry with or without receipt embedded in its unprotected header along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getEntryWithResponse(String entryId, RequestOptions requestOptions) { + return this.serviceClient.getEntryWithResponseAsync(entryId, requestOptions); + } + + /** + * Get the receipt of an entry given a specific entry id. + *

Response Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + * @param entryId ID of the entry to retrieve. + * @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 receipt of an entry given a specific entry id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getEntryReceiptWithResponse(String entryId, RequestOptions requestOptions) { + return this.serviceClient.getEntryReceiptWithResponseAsync(entryId, requestOptions); + } + + /** + * Historical query to get a list of entries of a given range. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fromLongNoStarting Transaction Id
toLongNoEnding Transaction Id
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * String
+     * }
+ * + * @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 a List of Entry IDs as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listEntryIds(RequestOptions requestOptions) { + return this.serviceClient.listEntryIdsAsync(requestOptions); + } + + /** + * Get service parameters. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     serviceCertificate: String (Required)
+     *     serviceId: String (Required)
+     *     signatureAlgorithm: String (Required)
+     *     treeAlgorithm: String (Required)
+     * }
+     * }
+ * + * @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 service parameters along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getParametersWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getParametersWithResponseAsync(requestOptions); + } + + /** + * Get the DID configuration file. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     id: String (Required)
+     *     assertionMethod (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             controller: String (Required)
+     *             type: String (Required)
+     *             publicKeyJwk (Required): {
+     *                 alg: String (Optional)
+     *                 crv: String (Optional)
+     *                 d: String (Optional)
+     *                 dp: String (Optional)
+     *                 dq: String (Optional)
+     *                 e: String (Optional)
+     *                 k: String (Optional)
+     *                 kid: String (Optional)
+     *                 kty: String (Required)
+     *                 n: String (Optional)
+     *                 p: String (Optional)
+     *                 q: String (Optional)
+     *                 qi: String (Optional)
+     *                 use: String (Optional)
+     *                 x: String (Optional)
+     *                 x5c (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 y: String (Optional)
+     *             }
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @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 DID configuration file along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDidConfigWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDidConfigWithResponseAsync(requestOptions); + } + + /** + * Get CodeTransparency configuration information. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     policy (Optional): {
+     *         accepted_algorithms (Optional): [
+     *             String (Optional)
+     *         ]
+     *         accepted_did_issuers (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     authentication (Optional): {
+     *         allow_unauthenticated: boolean (Required)
+     *         jwt (Optional): {
+     *             required_claims (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     service_identifier: String (Optional)
+     * }
+     * }
+ * + * @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 codeTransparency configuration information along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCodeTransparencyConfigWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getCodeTransparencyConfigWithResponseAsync(requestOptions); + } + + /** + * Get CodeTransparency version information. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     scitt_version: String (Required)
+     * }
+     * }
+ * + * @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 codeTransparency version information along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCodeTransparencyVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getCodeTransparencyVersionWithResponseAsync(requestOptions); + } + + /** + * Post an entry to be registered on the CodeTransparency instance. + * + * @param body A raw CoseSign1 signature. + * @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 response of entry submission containing the operationId on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createEntry(BinaryData body) { + // Generated convenience method for createEntryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createEntryWithResponse(body, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CreateEntryResult.class)); + } + + /** + * Get the status the entry operation. + * + * @param operationId ID of the operation to retrieve. + * @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 status the entry operation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getEntryStatus(String operationId) { + // Generated convenience method for getEntryStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getEntryStatusWithResponse(operationId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetOperationResult.class)); + } + + /** + * Get the status of all entries operations. + * + * @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 status of all entries operations on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listEntryStatuses() { + // Generated convenience method for listEntryStatusesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listEntryStatusesWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ListOperationResult.class)); + } + + /** + * Get Entry with or without receipt embedded in its unprotected header. + * + * @param entryId ID of the entry to retrieve. + * @param embedReceipt Embed a receipt as part of the response. + * @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 entry with or without receipt embedded in its unprotected header on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getEntry(String entryId, Boolean embedReceipt) { + // Generated convenience method for getEntryWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (embedReceipt != null) { + requestOptions.addQueryParam("embedReceipt", String.valueOf(embedReceipt), false); + } + return getEntryWithResponse(entryId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Get Entry with or without receipt embedded in its unprotected header. + * + * @param entryId ID of the entry to retrieve. + * @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 entry with or without receipt embedded in its unprotected header on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getEntry(String entryId) { + // Generated convenience method for getEntryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getEntryWithResponse(entryId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Get the receipt of an entry given a specific entry id. + * + * @param entryId ID of the entry to retrieve. + * @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 receipt of an entry given a specific entry id on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getEntryReceipt(String entryId) { + // Generated convenience method for getEntryReceiptWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getEntryReceiptWithResponse(entryId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Historical query to get a list of entries of a given range. + * + * @param from Starting Transaction Id. + * @param to Ending Transaction Id. + * @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 a List of Entry IDs as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listEntryIds(Long from, Long to) { + // Generated convenience method for listEntryIds + RequestOptions requestOptions = new RequestOptions(); + if (from != null) { + requestOptions.addQueryParam("from", String.valueOf(from), false); + } + if (to != null) { + requestOptions.addQueryParam("to", String.valueOf(to), false); + } + PagedFlux pagedFluxResponse = listEntryIds(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(String.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Historical query to get a list of entries of a given range. + * + * @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 a List of Entry IDs as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listEntryIds() { + // Generated convenience method for listEntryIds + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listEntryIds(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(String.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get service parameters. + * + * @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 service parameters on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getParameters() { + // Generated convenience method for getParametersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getParametersWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ParametersResult.class)); + } + + /** + * Get the DID configuration file. + * + * @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 DID configuration file on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDidConfig() { + // Generated convenience method for getDidConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDidConfigWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DidDocument.class)); + } + + /** + * Get CodeTransparency configuration information. + * + * @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 codeTransparency configuration information on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getCodeTransparencyConfig() { + // Generated convenience method for getCodeTransparencyConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getCodeTransparencyConfigWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CodeTransparencyConfiguration.class)); + } + + /** + * Get CodeTransparency version information. + * + * @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 codeTransparency version information on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getCodeTransparencyVersion() { + // Generated convenience method for getCodeTransparencyVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getCodeTransparencyVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VersionResult.class)); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyClient.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyClient.java new file mode 100644 index 000000000000..b1d2cf1076db --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyClient.java @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency; + +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.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.security.codetransparency.implementation.CodeTransparencyClientImpl; +import com.azure.security.codetransparency.models.CodeTransparencyConfiguration; +import com.azure.security.codetransparency.models.CreateEntryResult; +import com.azure.security.codetransparency.models.DidDocument; +import com.azure.security.codetransparency.models.GetOperationResult; +import com.azure.security.codetransparency.models.ListOperationResult; +import com.azure.security.codetransparency.models.ParametersResult; +import com.azure.security.codetransparency.models.VersionResult; + +/** + * Initializes a new instance of the synchronous CodeTransparencyClient type. + */ +@ServiceClient(builder = CodeTransparencyClientBuilder.class) +public final class CodeTransparencyClient { + @Generated + private final CodeTransparencyClientImpl serviceClient; + + /** + * Initializes an instance of CodeTransparencyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CodeTransparencyClient(CodeTransparencyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Post an entry to be registered on the CodeTransparency instance. + *

Request Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     operationId: String (Required)
+     * }
+     * }
+ * + * @param body A raw CoseSign1 signature. + * @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 response of entry submission containing the operationId along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createEntryWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createEntryWithResponse(body, requestOptions); + } + + /** + * Get the status the entry operation. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     entryId: String (Optional)
+     *     error: String (Optional)
+     *     operationId: String (Required)
+     *     status: String(running/failed/succeeded) (Required)
+     * }
+     * }
+ * + * @param operationId ID of the operation to retrieve. + * @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 status the entry operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEntryStatusWithResponse(String operationId, RequestOptions requestOptions) { + return this.serviceClient.getEntryStatusWithResponse(operationId, requestOptions); + } + + /** + * Get the status of all entries operations. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     operations (Required): [
+     *          (Required){
+     *             entryId: String (Optional)
+     *             error: String (Optional)
+     *             operationId: String (Required)
+     *             status: String(running/failed/succeeded) (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @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 status of all entries operations along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listEntryStatusesWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listEntryStatusesWithResponse(requestOptions); + } + + /** + * Get Entry with or without receipt embedded in its unprotected header. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
embedReceiptBooleanNoEmbed a receipt as part of the response
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + * @param entryId ID of the entry to retrieve. + * @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 entry with or without receipt embedded in its unprotected header along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEntryWithResponse(String entryId, RequestOptions requestOptions) { + return this.serviceClient.getEntryWithResponse(entryId, requestOptions); + } + + /** + * Get the receipt of an entry given a specific entry id. + *

Response Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + * @param entryId ID of the entry to retrieve. + * @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 receipt of an entry given a specific entry id along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEntryReceiptWithResponse(String entryId, RequestOptions requestOptions) { + return this.serviceClient.getEntryReceiptWithResponse(entryId, requestOptions); + } + + /** + * Historical query to get a list of entries of a given range. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fromLongNoStarting Transaction Id
toLongNoEnding Transaction Id
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * String
+     * }
+ * + * @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 a List of Entry IDs as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listEntryIds(RequestOptions requestOptions) { + return this.serviceClient.listEntryIds(requestOptions); + } + + /** + * Get service parameters. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     serviceCertificate: String (Required)
+     *     serviceId: String (Required)
+     *     signatureAlgorithm: String (Required)
+     *     treeAlgorithm: String (Required)
+     * }
+     * }
+ * + * @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 service parameters along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getParametersWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getParametersWithResponse(requestOptions); + } + + /** + * Get the DID configuration file. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     id: String (Required)
+     *     assertionMethod (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             controller: String (Required)
+     *             type: String (Required)
+     *             publicKeyJwk (Required): {
+     *                 alg: String (Optional)
+     *                 crv: String (Optional)
+     *                 d: String (Optional)
+     *                 dp: String (Optional)
+     *                 dq: String (Optional)
+     *                 e: String (Optional)
+     *                 k: String (Optional)
+     *                 kid: String (Optional)
+     *                 kty: String (Required)
+     *                 n: String (Optional)
+     *                 p: String (Optional)
+     *                 q: String (Optional)
+     *                 qi: String (Optional)
+     *                 use: String (Optional)
+     *                 x: String (Optional)
+     *                 x5c (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 y: String (Optional)
+     *             }
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @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 DID configuration file along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDidConfigWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDidConfigWithResponse(requestOptions); + } + + /** + * Get CodeTransparency configuration information. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     policy (Optional): {
+     *         accepted_algorithms (Optional): [
+     *             String (Optional)
+     *         ]
+     *         accepted_did_issuers (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     authentication (Optional): {
+     *         allow_unauthenticated: boolean (Required)
+     *         jwt (Optional): {
+     *             required_claims (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     service_identifier: String (Optional)
+     * }
+     * }
+ * + * @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 codeTransparency configuration information along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCodeTransparencyConfigWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getCodeTransparencyConfigWithResponse(requestOptions); + } + + /** + * Get CodeTransparency version information. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     scitt_version: String (Required)
+     * }
+     * }
+ * + * @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 codeTransparency version information along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCodeTransparencyVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getCodeTransparencyVersionWithResponse(requestOptions); + } + + /** + * Post an entry to be registered on the CodeTransparency instance. + * + * @param body A raw CoseSign1 signature. + * @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 response of entry submission containing the operationId. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CreateEntryResult createEntry(BinaryData body) { + // Generated convenience method for createEntryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createEntryWithResponse(body, requestOptions).getValue().toObject(CreateEntryResult.class); + } + + /** + * Get the status the entry operation. + * + * @param operationId ID of the operation to retrieve. + * @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 status the entry operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetOperationResult getEntryStatus(String operationId) { + // Generated convenience method for getEntryStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getEntryStatusWithResponse(operationId, requestOptions).getValue().toObject(GetOperationResult.class); + } + + /** + * Get the status of all entries operations. + * + * @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 status of all entries operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ListOperationResult listEntryStatuses() { + // Generated convenience method for listEntryStatusesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listEntryStatusesWithResponse(requestOptions).getValue().toObject(ListOperationResult.class); + } + + /** + * Get Entry with or without receipt embedded in its unprotected header. + * + * @param entryId ID of the entry to retrieve. + * @param embedReceipt Embed a receipt as part of the response. + * @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 entry with or without receipt embedded in its unprotected header. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getEntry(String entryId, Boolean embedReceipt) { + // Generated convenience method for getEntryWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (embedReceipt != null) { + requestOptions.addQueryParam("embedReceipt", String.valueOf(embedReceipt), false); + } + return getEntryWithResponse(entryId, requestOptions).getValue(); + } + + /** + * Get Entry with or without receipt embedded in its unprotected header. + * + * @param entryId ID of the entry to retrieve. + * @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 entry with or without receipt embedded in its unprotected header. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getEntry(String entryId) { + // Generated convenience method for getEntryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getEntryWithResponse(entryId, requestOptions).getValue(); + } + + /** + * Get the receipt of an entry given a specific entry id. + * + * @param entryId ID of the entry to retrieve. + * @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 receipt of an entry given a specific entry id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getEntryReceipt(String entryId) { + // Generated convenience method for getEntryReceiptWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getEntryReceiptWithResponse(entryId, requestOptions).getValue(); + } + + /** + * Historical query to get a list of entries of a given range. + * + * @param from Starting Transaction Id. + * @param to Ending Transaction Id. + * @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 a List of Entry IDs as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listEntryIds(Long from, Long to) { + // Generated convenience method for listEntryIds + RequestOptions requestOptions = new RequestOptions(); + if (from != null) { + requestOptions.addQueryParam("from", String.valueOf(from), false); + } + if (to != null) { + requestOptions.addQueryParam("to", String.valueOf(to), false); + } + return serviceClient.listEntryIds(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(String.class)); + } + + /** + * Historical query to get a list of entries of a given range. + * + * @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 a List of Entry IDs as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listEntryIds() { + // Generated convenience method for listEntryIds + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listEntryIds(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(String.class)); + } + + /** + * Get service parameters. + * + * @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 service parameters. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ParametersResult getParameters() { + // Generated convenience method for getParametersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getParametersWithResponse(requestOptions).getValue().toObject(ParametersResult.class); + } + + /** + * Get the DID configuration file. + * + * @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 DID configuration file. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DidDocument getDidConfig() { + // Generated convenience method for getDidConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDidConfigWithResponse(requestOptions).getValue().toObject(DidDocument.class); + } + + /** + * Get CodeTransparency configuration information. + * + * @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 codeTransparency configuration information. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeTransparencyConfiguration getCodeTransparencyConfig() { + // Generated convenience method for getCodeTransparencyConfigWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getCodeTransparencyConfigWithResponse(requestOptions).getValue() + .toObject(CodeTransparencyConfiguration.class); + } + + /** + * Get CodeTransparency version information. + * + * @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 codeTransparency version information. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VersionResult getCodeTransparencyVersion() { + // Generated convenience method for getCodeTransparencyVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getCodeTransparencyVersionWithResponse(requestOptions).getValue().toObject(VersionResult.class); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyClientBuilder.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyClientBuilder.java new file mode 100644 index 000000000000..72b3e42ac8bc --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency; + +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.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +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.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +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 com.azure.security.codetransparency.implementation.CodeTransparencyClientImpl; +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 CodeTransparencyClient type. + */ +@ServiceClientBuilder(serviceClients = { CodeTransparencyClient.class, CodeTransparencyAsyncClient.class }) +public final class CodeTransparencyClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-security-codetransparency.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the CodeTransparencyClientBuilder. + */ + @Generated + public CodeTransparencyClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CodeTransparencyClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("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 CodeTransparencyClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CodeTransparencyClientBuilder 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 CodeTransparencyClientBuilder 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 CodeTransparencyClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CodeTransparencyClientBuilder 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 CodeTransparencyClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CodeTransparencyClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private CodeTransparencyServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the CodeTransparencyClientBuilder. + */ + @Generated + public CodeTransparencyClientBuilder serviceVersion(CodeTransparencyServiceVersion 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 CodeTransparencyClientBuilder. + */ + @Generated + public CodeTransparencyClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of CodeTransparencyClientImpl with the provided parameters. + * + * @return an instance of CodeTransparencyClientImpl. + */ + @Generated + private CodeTransparencyClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + CodeTransparencyServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : CodeTransparencyServiceVersion.getLatest(); + CodeTransparencyClientImpl client = new CodeTransparencyClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @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 = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + 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()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of CodeTransparencyAsyncClient class. + * + * @return an instance of CodeTransparencyAsyncClient. + */ + @Generated + public CodeTransparencyAsyncClient buildAsyncClient() { + return new CodeTransparencyAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of CodeTransparencyClient class. + * + * @return an instance of CodeTransparencyClient. + */ + @Generated + public CodeTransparencyClient buildClient() { + return new CodeTransparencyClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(CodeTransparencyClientBuilder.class); +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyServiceVersion.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyServiceVersion.java new file mode 100644 index 000000000000..ea5f061de21d --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/CodeTransparencyServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of CodeTransparencyClient. + */ +public enum CodeTransparencyServiceVersion implements ServiceVersion { + /** + * Enum value 2024-01-11-preview. + */ + V2024_01_11_PREVIEW("2024-01-11-preview"); + + private final String version; + + CodeTransparencyServiceVersion(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 CodeTransparencyServiceVersion}. + */ + public static CodeTransparencyServiceVersion getLatest() { + return V2024_01_11_PREVIEW; + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/implementation/CodeTransparencyClientImpl.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/implementation/CodeTransparencyClientImpl.java new file mode 100644 index 000000000000..3463fd01f880 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/implementation/CodeTransparencyClientImpl.java @@ -0,0 +1,1165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.implementation; + +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.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.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.security.codetransparency.CodeTransparencyServiceVersion; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the CodeTransparencyClient type. + */ +public final class CodeTransparencyClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CodeTransparencyClientService service; + + /** + */ + private final String endpoint; + + /** + * Gets. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final CodeTransparencyServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public CodeTransparencyServiceVersion 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 CodeTransparencyClient client. + * + * @param endpoint + * @param serviceVersion Service version. + */ + public CodeTransparencyClientImpl(String endpoint, CodeTransparencyServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of CodeTransparencyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint + * @param serviceVersion Service version. + */ + public CodeTransparencyClientImpl(HttpPipeline httpPipeline, String endpoint, + CodeTransparencyServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of CodeTransparencyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint + * @param serviceVersion Service version. + */ + public CodeTransparencyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + CodeTransparencyServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service + = RestProxy.create(CodeTransparencyClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for CodeTransparencyClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CodeTransparencyClie") + public interface CodeTransparencyClientService { + @Post("/entries") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createEntry(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("content-type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/cose") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/entries") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createEntrySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("content-type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/cose") BinaryData body, + RequestOptions requestOptions, Context context); + + @Get("/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getEntryStatus(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getEntryStatusSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listEntryStatuses(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listEntryStatusesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/entries/{entryId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getEntry(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("entryId") String entryId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/entries/{entryId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getEntrySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("entryId") String entryId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/entries/{entryId}/receipt") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getEntryReceipt(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("entryId") String entryId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/entries/{entryId}/receipt") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getEntryReceiptSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("entryId") String entryId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/entries/txIds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listEntryIds(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/entries/txIds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listEntryIdsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/parameters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getParameters(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/parameters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getParametersSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/.well-known/did.json") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDidConfig(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/.well-known/did.json") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDidConfigSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/configuration") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCodeTransparencyConfig(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/configuration") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCodeTransparencyConfigSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCodeTransparencyVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCodeTransparencyVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @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) + Mono> listEntryIdsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @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 listEntryIdsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Post an entry to be registered on the CodeTransparency instance. + *

Request Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     operationId: String (Required)
+     * }
+     * }
+ * + * @param body A raw CoseSign1 signature. + * @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 response of entry submission containing the operationId along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createEntryWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/cose"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createEntry(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); + } + + /** + * Post an entry to be registered on the CodeTransparency instance. + *

Request Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     operationId: String (Required)
+     * }
+     * }
+ * + * @param body A raw CoseSign1 signature. + * @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 response of entry submission containing the operationId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createEntryWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/cose"; + final String accept = "application/json"; + return service.createEntrySync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, + body, requestOptions, Context.NONE); + } + + /** + * Get the status the entry operation. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     entryId: String (Optional)
+     *     error: String (Optional)
+     *     operationId: String (Required)
+     *     status: String(running/failed/succeeded) (Required)
+     * }
+     * }
+ * + * @param operationId ID of the operation to retrieve. + * @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 status the entry operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getEntryStatusWithResponseAsync(String operationId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getEntryStatus(this.getEndpoint(), + this.getServiceVersion().getVersion(), operationId, accept, requestOptions, context)); + } + + /** + * Get the status the entry operation. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     entryId: String (Optional)
+     *     error: String (Optional)
+     *     operationId: String (Required)
+     *     status: String(running/failed/succeeded) (Required)
+     * }
+     * }
+ * + * @param operationId ID of the operation to retrieve. + * @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 status the entry operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEntryStatusWithResponse(String operationId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getEntryStatusSync(this.getEndpoint(), this.getServiceVersion().getVersion(), operationId, + accept, requestOptions, Context.NONE); + } + + /** + * Get the status of all entries operations. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     operations (Required): [
+     *          (Required){
+     *             entryId: String (Optional)
+     *             error: String (Optional)
+     *             operationId: String (Required)
+     *             status: String(running/failed/succeeded) (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @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 status of all entries operations along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listEntryStatusesWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listEntryStatuses(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Get the status of all entries operations. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     operations (Required): [
+     *          (Required){
+     *             entryId: String (Optional)
+     *             error: String (Optional)
+     *             operationId: String (Required)
+     *             status: String(running/failed/succeeded) (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @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 status of all entries operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listEntryStatusesWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listEntryStatusesSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + } + + /** + * Get Entry with or without receipt embedded in its unprotected header. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
embedReceiptBooleanNoEmbed a receipt as part of the response
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + * @param entryId ID of the entry to retrieve. + * @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 entry with or without receipt embedded in its unprotected header along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getEntryWithResponseAsync(String entryId, RequestOptions requestOptions) { + final String accept = "application/cose"; + return FluxUtil.withContext(context -> service.getEntry(this.getEndpoint(), + this.getServiceVersion().getVersion(), entryId, accept, requestOptions, context)); + } + + /** + * Get Entry with or without receipt embedded in its unprotected header. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
embedReceiptBooleanNoEmbed a receipt as part of the response
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + * @param entryId ID of the entry to retrieve. + * @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 entry with or without receipt embedded in its unprotected header along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEntryWithResponse(String entryId, RequestOptions requestOptions) { + final String accept = "application/cose"; + return service.getEntrySync(this.getEndpoint(), this.getServiceVersion().getVersion(), entryId, accept, + requestOptions, Context.NONE); + } + + /** + * Get the receipt of an entry given a specific entry id. + *

Response Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + * @param entryId ID of the entry to retrieve. + * @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 receipt of an entry given a specific entry id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getEntryReceiptWithResponseAsync(String entryId, RequestOptions requestOptions) { + final String accept = "application/cbor"; + return FluxUtil.withContext(context -> service.getEntryReceipt(this.getEndpoint(), + this.getServiceVersion().getVersion(), entryId, accept, requestOptions, context)); + } + + /** + * Get the receipt of an entry given a specific entry id. + *

Response Body Schema

+ * + *
{@code
+     * BinaryData
+     * }
+ * + * @param entryId ID of the entry to retrieve. + * @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 receipt of an entry given a specific entry id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEntryReceiptWithResponse(String entryId, RequestOptions requestOptions) { + final String accept = "application/cbor"; + return service.getEntryReceiptSync(this.getEndpoint(), this.getServiceVersion().getVersion(), entryId, accept, + requestOptions, Context.NONE); + } + + /** + * Historical query to get a list of entries of a given range. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fromLongNoStarting Transaction Id
toLongNoEnding Transaction Id
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * String
+     * }
+ * + * @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 a List of Entry IDs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEntryIdsSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listEntryIds(this.getEndpoint(), this.getServiceVersion().getVersion(), + accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "transactionIds"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Historical query to get a list of entries of a given range. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fromLongNoStarting Transaction Id
toLongNoEnding Transaction Id
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * String
+     * }
+ * + * @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 a List of Entry IDs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listEntryIdsAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listEntryIdsSinglePageAsync(requestOptions), + nextLink -> listEntryIdsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Historical query to get a list of entries of a given range. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fromLongNoStarting Transaction Id
toLongNoEnding Transaction Id
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * String
+     * }
+ * + * @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 a List of Entry IDs along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listEntryIdsSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listEntryIdsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), + accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "transactionIds"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Historical query to get a list of entries of a given range. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fromLongNoStarting Transaction Id
toLongNoEnding Transaction Id
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
{@code
+     * String
+     * }
+ * + * @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 a List of Entry IDs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listEntryIds(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listEntryIdsSinglePage(requestOptions), + nextLink -> listEntryIdsNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get service parameters. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     serviceCertificate: String (Required)
+     *     serviceId: String (Required)
+     *     signatureAlgorithm: String (Required)
+     *     treeAlgorithm: String (Required)
+     * }
+     * }
+ * + * @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 service parameters along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getParametersWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getParameters(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Get service parameters. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     serviceCertificate: String (Required)
+     *     serviceId: String (Required)
+     *     signatureAlgorithm: String (Required)
+     *     treeAlgorithm: String (Required)
+     * }
+     * }
+ * + * @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 service parameters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getParametersWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getParametersSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + } + + /** + * Get the DID configuration file. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     id: String (Required)
+     *     assertionMethod (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             controller: String (Required)
+     *             type: String (Required)
+     *             publicKeyJwk (Required): {
+     *                 alg: String (Optional)
+     *                 crv: String (Optional)
+     *                 d: String (Optional)
+     *                 dp: String (Optional)
+     *                 dq: String (Optional)
+     *                 e: String (Optional)
+     *                 k: String (Optional)
+     *                 kid: String (Optional)
+     *                 kty: String (Required)
+     *                 n: String (Optional)
+     *                 p: String (Optional)
+     *                 q: String (Optional)
+     *                 qi: String (Optional)
+     *                 use: String (Optional)
+     *                 x: String (Optional)
+     *                 x5c (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 y: String (Optional)
+     *             }
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @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 DID configuration file along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDidConfigWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getDidConfig(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Get the DID configuration file. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     id: String (Required)
+     *     assertionMethod (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             controller: String (Required)
+     *             type: String (Required)
+     *             publicKeyJwk (Required): {
+     *                 alg: String (Optional)
+     *                 crv: String (Optional)
+     *                 d: String (Optional)
+     *                 dp: String (Optional)
+     *                 dq: String (Optional)
+     *                 e: String (Optional)
+     *                 k: String (Optional)
+     *                 kid: String (Optional)
+     *                 kty: String (Required)
+     *                 n: String (Optional)
+     *                 p: String (Optional)
+     *                 q: String (Optional)
+     *                 qi: String (Optional)
+     *                 use: String (Optional)
+     *                 x: String (Optional)
+     *                 x5c (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 y: String (Optional)
+     *             }
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @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 DID configuration file along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDidConfigWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDidConfigSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + } + + /** + * Get CodeTransparency configuration information. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     policy (Optional): {
+     *         accepted_algorithms (Optional): [
+     *             String (Optional)
+     *         ]
+     *         accepted_did_issuers (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     authentication (Optional): {
+     *         allow_unauthenticated: boolean (Required)
+     *         jwt (Optional): {
+     *             required_claims (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     service_identifier: String (Optional)
+     * }
+     * }
+ * + * @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 codeTransparency configuration information along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCodeTransparencyConfigWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getCodeTransparencyConfig(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Get CodeTransparency configuration information. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     policy (Optional): {
+     *         accepted_algorithms (Optional): [
+     *             String (Optional)
+     *         ]
+     *         accepted_did_issuers (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     authentication (Optional): {
+     *         allow_unauthenticated: boolean (Required)
+     *         jwt (Optional): {
+     *             required_claims (Required): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     }
+     *     service_identifier: String (Optional)
+     * }
+     * }
+ * + * @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 codeTransparency configuration information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCodeTransparencyConfigWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getCodeTransparencyConfigSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + } + + /** + * Get CodeTransparency version information. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     scitt_version: String (Required)
+     * }
+     * }
+ * + * @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 codeTransparency version information along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCodeTransparencyVersionWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getCodeTransparencyVersion(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Get CodeTransparency version information. + *

Response Body Schema

+ * + *
{@code
+     * {
+     *     scitt_version: String (Required)
+     * }
+     * }
+ * + * @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 codeTransparency version information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCodeTransparencyVersionWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getCodeTransparencyVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + } + + /** + * Historical query to get a list of entries of a given range + * + * Get the next page of items. + *

Response Body Schema

+ * + *
{@code
+     * String
+     * }
+ * + * @param nextLink The URL to get the next list of items. + * @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 a List of Entry IDs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listEntryIdsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listEntryIdsNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "transactionIds"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Historical query to get a list of entries of a given range + * + * Get the next page of items. + *

Response Body Schema

+ * + *
{@code
+     * String
+     * }
+ * + * @param nextLink The URL to get the next list of items. + * @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 a List of Entry IDs along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listEntryIdsNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listEntryIdsNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "transactionIds"), 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/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/implementation/package-info.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/implementation/package-info.java new file mode 100644 index 000000000000..c6f8bb4a93c4 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/implementation/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for CodeTransparency. + */ +package com.azure.security.codetransparency.implementation; diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfiguration.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfiguration.java new file mode 100644 index 000000000000..faa8d3d9050a --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfiguration.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Response body of the Configuration API. + */ +@Immutable +public final class CodeTransparencyConfiguration implements JsonSerializable { + /* + * The policy property. + */ + @Generated + private CodeTransparencyConfigurationPolicy policy; + + /* + * The authentication property. + */ + @Generated + private CodeTransparencyConfigurationAuthentication authentication; + + /* + * did:web identifier + */ + @Generated + private String serviceIdentifier; + + /** + * Creates an instance of CodeTransparencyConfiguration class. + */ + @Generated + private CodeTransparencyConfiguration() { + } + + /** + * Get the policy property: The policy property. + * + * @return the policy value. + */ + @Generated + public CodeTransparencyConfigurationPolicy getPolicy() { + return this.policy; + } + + /** + * Get the authentication property: The authentication property. + * + * @return the authentication value. + */ + @Generated + public CodeTransparencyConfigurationAuthentication getAuthentication() { + return this.authentication; + } + + /** + * Get the serviceIdentifier property: did:web identifier. + * + * @return the serviceIdentifier value. + */ + @Generated + public String getServiceIdentifier() { + return this.serviceIdentifier; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("policy", this.policy); + jsonWriter.writeJsonField("authentication", this.authentication); + jsonWriter.writeStringField("service_identifier", this.serviceIdentifier); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeTransparencyConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeTransparencyConfiguration 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 CodeTransparencyConfiguration. + */ + @Generated + public static CodeTransparencyConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodeTransparencyConfiguration deserializedCodeTransparencyConfiguration + = new CodeTransparencyConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("policy".equals(fieldName)) { + deserializedCodeTransparencyConfiguration.policy + = CodeTransparencyConfigurationPolicy.fromJson(reader); + } else if ("authentication".equals(fieldName)) { + deserializedCodeTransparencyConfiguration.authentication + = CodeTransparencyConfigurationAuthentication.fromJson(reader); + } else if ("service_identifier".equals(fieldName)) { + deserializedCodeTransparencyConfiguration.serviceIdentifier = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCodeTransparencyConfiguration; + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfigurationAuthentication.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfigurationAuthentication.java new file mode 100644 index 000000000000..d733726436f3 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfigurationAuthentication.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration of CCF authentication. + */ +@Immutable +public final class CodeTransparencyConfigurationAuthentication + implements JsonSerializable { + /* + * The allow_unauthenticated property. + */ + @Generated + private final boolean allowUnauthenticated; + + /* + * The jwt property. + */ + @Generated + private CodeTransparencyConfigurationAuthenticationJwt jwt; + + /** + * Creates an instance of CodeTransparencyConfigurationAuthentication class. + * + * @param allowUnauthenticated the allowUnauthenticated value to set. + */ + @Generated + private CodeTransparencyConfigurationAuthentication(boolean allowUnauthenticated) { + this.allowUnauthenticated = allowUnauthenticated; + } + + /** + * Get the allowUnauthenticated property: The allow_unauthenticated property. + * + * @return the allowUnauthenticated value. + */ + @Generated + public boolean isAllowUnauthenticated() { + return this.allowUnauthenticated; + } + + /** + * Get the jwt property: The jwt property. + * + * @return the jwt value. + */ + @Generated + public CodeTransparencyConfigurationAuthenticationJwt getJwt() { + return this.jwt; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("allow_unauthenticated", this.allowUnauthenticated); + jsonWriter.writeJsonField("jwt", this.jwt); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeTransparencyConfigurationAuthentication from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeTransparencyConfigurationAuthentication if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodeTransparencyConfigurationAuthentication. + */ + @Generated + public static CodeTransparencyConfigurationAuthentication fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean allowUnauthenticated = false; + CodeTransparencyConfigurationAuthenticationJwt jwt = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("allow_unauthenticated".equals(fieldName)) { + allowUnauthenticated = reader.getBoolean(); + } else if ("jwt".equals(fieldName)) { + jwt = CodeTransparencyConfigurationAuthenticationJwt.fromJson(reader); + } else { + reader.skipChildren(); + } + } + CodeTransparencyConfigurationAuthentication deserializedCodeTransparencyConfigurationAuthentication + = new CodeTransparencyConfigurationAuthentication(allowUnauthenticated); + deserializedCodeTransparencyConfigurationAuthentication.jwt = jwt; + + return deserializedCodeTransparencyConfigurationAuthentication; + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfigurationAuthenticationJwt.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfigurationAuthenticationJwt.java new file mode 100644 index 000000000000..e555ab393377 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfigurationAuthenticationJwt.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Configuration of JWT claims. + */ +@Immutable +public final class CodeTransparencyConfigurationAuthenticationJwt + implements JsonSerializable { + /* + * The required_claims property. + */ + @Generated + private final Map requiredClaims; + + /** + * Creates an instance of CodeTransparencyConfigurationAuthenticationJwt class. + * + * @param requiredClaims the requiredClaims value to set. + */ + @Generated + private CodeTransparencyConfigurationAuthenticationJwt(Map requiredClaims) { + this.requiredClaims = requiredClaims; + } + + /** + * Get the requiredClaims property: The required_claims property. + * + * @return the requiredClaims value. + */ + @Generated + public Map getRequiredClaims() { + return this.requiredClaims; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("required_claims", this.requiredClaims, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeTransparencyConfigurationAuthenticationJwt from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeTransparencyConfigurationAuthenticationJwt if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodeTransparencyConfigurationAuthenticationJwt. + */ + @Generated + public static CodeTransparencyConfigurationAuthenticationJwt fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Map requiredClaims = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("required_claims".equals(fieldName)) { + requiredClaims = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + return new CodeTransparencyConfigurationAuthenticationJwt(requiredClaims); + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfigurationPolicy.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfigurationPolicy.java new file mode 100644 index 000000000000..4d5d8b0b33be --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CodeTransparencyConfigurationPolicy.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Configuration of CCF Authentication policies. + */ +@Immutable +public final class CodeTransparencyConfigurationPolicy + implements JsonSerializable { + /* + * The accepted_algorithms property. + */ + @Generated + private List acceptedAlgorithms; + + /* + * The accepted_did_issuers property. + */ + @Generated + private List acceptedDidIssuers; + + /** + * Creates an instance of CodeTransparencyConfigurationPolicy class. + */ + @Generated + private CodeTransparencyConfigurationPolicy() { + } + + /** + * Get the acceptedAlgorithms property: The accepted_algorithms property. + * + * @return the acceptedAlgorithms value. + */ + @Generated + public List getAcceptedAlgorithms() { + return this.acceptedAlgorithms; + } + + /** + * Get the acceptedDidIssuers property: The accepted_did_issuers property. + * + * @return the acceptedDidIssuers value. + */ + @Generated + public List getAcceptedDidIssuers() { + return this.acceptedDidIssuers; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("accepted_algorithms", this.acceptedAlgorithms, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("accepted_did_issuers", this.acceptedDidIssuers, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeTransparencyConfigurationPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeTransparencyConfigurationPolicy 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 CodeTransparencyConfigurationPolicy. + */ + @Generated + public static CodeTransparencyConfigurationPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodeTransparencyConfigurationPolicy deserializedCodeTransparencyConfigurationPolicy + = new CodeTransparencyConfigurationPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("accepted_algorithms".equals(fieldName)) { + List acceptedAlgorithms = reader.readArray(reader1 -> reader1.getString()); + deserializedCodeTransparencyConfigurationPolicy.acceptedAlgorithms = acceptedAlgorithms; + } else if ("accepted_did_issuers".equals(fieldName)) { + List acceptedDidIssuers = reader.readArray(reader1 -> reader1.getString()); + deserializedCodeTransparencyConfigurationPolicy.acceptedDidIssuers = acceptedDidIssuers; + } else { + reader.skipChildren(); + } + } + + return deserializedCodeTransparencyConfigurationPolicy; + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CreateEntryResult.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CreateEntryResult.java new file mode 100644 index 000000000000..5625cac7e0d8 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/CreateEntryResult.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response of entry submission containing the operationId. + */ +@Immutable +public final class CreateEntryResult implements JsonSerializable { + /* + * String representing the operation id submitted + */ + @Generated + private final String operationId; + + /** + * Creates an instance of CreateEntryResult class. + * + * @param operationId the operationId value to set. + */ + @Generated + private CreateEntryResult(String operationId) { + this.operationId = operationId; + } + + /** + * Get the operationId property: String representing the operation id submitted. + * + * @return the operationId value. + */ + @Generated + public String getOperationId() { + return this.operationId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operationId", this.operationId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateEntryResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateEntryResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CreateEntryResult. + */ + @Generated + public static CreateEntryResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String operationId = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + operationId = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new CreateEntryResult(operationId); + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/DidDocument.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/DidDocument.java new file mode 100644 index 000000000000..c1c5b7b0b1dd --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/DidDocument.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A DID document. + */ +@Immutable +public final class DidDocument implements JsonSerializable { + /* + * String representing a DID issuer. + */ + @Generated + private final String id; + + /* + * List of public keys used for receipt endorsement verification. + */ + @Generated + private final List assertionMethod; + + /** + * Creates an instance of DidDocument class. + * + * @param id the id value to set. + * @param assertionMethod the assertionMethod value to set. + */ + @Generated + private DidDocument(String id, List assertionMethod) { + this.id = id; + this.assertionMethod = assertionMethod; + } + + /** + * Get the id property: String representing a DID issuer. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the assertionMethod property: List of public keys used for receipt endorsement verification. + * + * @return the assertionMethod value. + */ + @Generated + public List getAssertionMethod() { + return this.assertionMethod; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeArrayField("assertionMethod", this.assertionMethod, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DidDocument from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DidDocument if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DidDocument. + */ + @Generated + public static DidDocument fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + List assertionMethod = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("assertionMethod".equals(fieldName)) { + assertionMethod = reader.readArray(reader1 -> DidDocumentKey.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new DidDocument(id, assertionMethod); + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/DidDocumentKey.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/DidDocumentKey.java new file mode 100644 index 000000000000..7bdd19de3a25 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/DidDocumentKey.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A DID document key. + */ +@Immutable +public final class DidDocumentKey implements JsonSerializable { + /* + * Key identifier. + */ + @Generated + private final String id; + + /* + * Key controller - similar to DID issuer. + */ + @Generated + private final String controller; + + /* + * Key type. + */ + @Generated + private final String type = "JsonWebKey2020"; + + /* + * Serialized public key in JWK format. + */ + @Generated + private final JsonWebKey publicKeyJwk; + + /** + * Creates an instance of DidDocumentKey class. + * + * @param id the id value to set. + * @param controller the controller value to set. + * @param publicKeyJwk the publicKeyJwk value to set. + */ + @Generated + private DidDocumentKey(String id, String controller, JsonWebKey publicKeyJwk) { + this.id = id; + this.controller = controller; + this.publicKeyJwk = publicKeyJwk; + } + + /** + * Get the id property: Key identifier. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the controller property: Key controller - similar to DID issuer. + * + * @return the controller value. + */ + @Generated + public String getController() { + return this.controller; + } + + /** + * Get the type property: Key type. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Get the publicKeyJwk property: Serialized public key in JWK format. + * + * @return the publicKeyJwk value. + */ + @Generated + public JsonWebKey getPublicKeyJwk() { + return this.publicKeyJwk; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("controller", this.controller); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("publicKeyJwk", this.publicKeyJwk); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DidDocumentKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DidDocumentKey if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DidDocumentKey. + */ + @Generated + public static DidDocumentKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String controller = null; + JsonWebKey publicKeyJwk = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("controller".equals(fieldName)) { + controller = reader.getString(); + } else if ("publicKeyJwk".equals(fieldName)) { + publicKeyJwk = JsonWebKey.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new DidDocumentKey(id, controller, publicKeyJwk); + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/GetOperationResult.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/GetOperationResult.java new file mode 100644 index 000000000000..d1a9a17e6f7d --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/GetOperationResult.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Response body of the GetOperationId API. + */ +@Immutable +public final class GetOperationResult implements JsonSerializable { + /* + * ID of the transaction. Only if status is Succeeded. + */ + @Generated + private String entryId; + + /* + * Error in json format. Only if Status is Failed. + */ + @Generated + private String error; + + /* + * OperationId + */ + @Generated + private final String operationId; + + /* + * Status of the operation. + */ + @Generated + private final OperationStatus status; + + /** + * Creates an instance of GetOperationResult class. + * + * @param operationId the operationId value to set. + * @param status the status value to set. + */ + @Generated + private GetOperationResult(String operationId, OperationStatus status) { + this.operationId = operationId; + this.status = status; + } + + /** + * Get the entryId property: ID of the transaction. Only if status is Succeeded. + * + * @return the entryId value. + */ + @Generated + public String getEntryId() { + return this.entryId; + } + + /** + * Get the error property: Error in json format. Only if Status is Failed. + * + * @return the error value. + */ + @Generated + public String getError() { + return this.error; + } + + /** + * Get the operationId property: OperationId. + * + * @return the operationId value. + */ + @Generated + public String getOperationId() { + return this.operationId; + } + + /** + * Get the status property: Status of the operation. + * + * @return the status value. + */ + @Generated + public OperationStatus getStatus() { + return this.status; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("entryId", this.entryId); + jsonWriter.writeStringField("error", this.error); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetOperationResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetOperationResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetOperationResult. + */ + @Generated + public static GetOperationResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String operationId = null; + OperationStatus status = null; + String entryId = null; + String error = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationStatus.fromString(reader.getString()); + } else if ("entryId".equals(fieldName)) { + entryId = reader.getString(); + } else if ("error".equals(fieldName)) { + error = reader.getString(); + } else { + reader.skipChildren(); + } + } + GetOperationResult deserializedGetOperationResult = new GetOperationResult(operationId, status); + deserializedGetOperationResult.entryId = entryId; + deserializedGetOperationResult.error = error; + + return deserializedGetOperationResult; + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/JsonWebKey.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/JsonWebKey.java new file mode 100644 index 000000000000..b36f7fc6647e --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/JsonWebKey.java @@ -0,0 +1,472 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * rfc7517 JSON Web Key representation adapted from a shared swagger definition in the common types. + */ +@Immutable +public final class JsonWebKey implements JsonSerializable { + /* + * The "alg" (algorithm) parameter identifies the algorithm intended for + * use with the key. The values used should either be registered in the + * IANA "JSON Web Signature and Encryption Algorithms" registry + * established by [JWA] or be a value that contains a Collision- + * Resistant Name. + */ + @Generated + private String alg; + + /* + * The "crv" (curve) parameter identifies the curve type + */ + @Generated + private String crv; + + /* + * RSA private exponent or ECC private key + */ + @Generated + private String d; + + /* + * RSA Private Key Parameter + */ + @Generated + private String dp; + + /* + * RSA Private Key Parameter + */ + @Generated + private String dq; + + /* + * RSA public exponent, in Base64 + */ + @Generated + private String e; + + /* + * Symmetric key + */ + @Generated + private String k; + + /* + * The "kid" (key ID) parameter is used to match a specific key. This + * is used, for instance, to choose among a set of keys within a JWK Set + * during key rollover. The structure of the "kid" value is + * unspecified. When "kid" values are used within a JWK Set, different + * keys within the JWK Set SHOULD use distinct "kid" values. (One + * example in which different keys might use the same "kid" value is if + * they have different "kty" (key type) values but are considered to be + * equivalent alternatives by the application using them.) The "kid" + * value is a case-sensitive string. + */ + @Generated + private String kid; + + /* + * The "kty" (key type) parameter identifies the cryptographic algorithm + * family used with the key, such as "RSA" or "EC". "kty" values should + * either be registered in the IANA "JSON Web Key Types" registry + * established by [JWA] or be a value that contains a Collision- + * Resistant Name. The "kty" value is a case-sensitive string. + */ + @Generated + private final String kty; + + /* + * RSA modulus, in Base64 + */ + @Generated + private String n; + + /* + * RSA secret prime + */ + @Generated + private String p; + + /* + * RSA secret prime, with p < q + */ + @Generated + private String q; + + /* + * RSA Private Key Parameter + */ + @Generated + private String qi; + + /* + * Use ("public key use") identifies the intended use of + * the public key. The "use" parameter is employed to indicate whether + * a public key is used for encrypting data or verifying the signature + * on data. Values are commonly "sig" (signature) or "enc" (encryption). + */ + @Generated + private String use; + + /* + * X coordinate for the Elliptic Curve point + */ + @Generated + private String x; + + /* + * The "x5c" (X.509 certificate chain) parameter contains a chain of one + * or more PKIX certificates [RFC5280]. The certificate chain is + * represented as a JSON array of certificate value strings. Each + * string in the array is a base64-encoded (Section 4 of [RFC4648] -- + * not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. + * The PKIX certificate containing the key value MUST be the first + * certificate. + */ + @Generated + private List x5c; + + /* + * Y coordinate for the Elliptic Curve point + */ + @Generated + private String y; + + /** + * Creates an instance of JsonWebKey class. + * + * @param kty the kty value to set. + */ + @Generated + private JsonWebKey(String kty) { + this.kty = kty; + } + + /** + * Get the alg property: The "alg" (algorithm) parameter identifies the algorithm intended for + * use with the key. The values used should either be registered in the + * IANA "JSON Web Signature and Encryption Algorithms" registry + * established by [JWA] or be a value that contains a Collision- + * Resistant Name. + * + * @return the alg value. + */ + @Generated + public String getAlg() { + return this.alg; + } + + /** + * Get the crv property: The "crv" (curve) parameter identifies the curve type. + * + * @return the crv value. + */ + @Generated + public String getCrv() { + return this.crv; + } + + /** + * Get the d property: RSA private exponent or ECC private key. + * + * @return the d value. + */ + @Generated + public String getD() { + return this.d; + } + + /** + * Get the dp property: RSA Private Key Parameter. + * + * @return the dp value. + */ + @Generated + public String getDp() { + return this.dp; + } + + /** + * Get the dq property: RSA Private Key Parameter. + * + * @return the dq value. + */ + @Generated + public String getDq() { + return this.dq; + } + + /** + * Get the e property: RSA public exponent, in Base64. + * + * @return the e value. + */ + @Generated + public String getE() { + return this.e; + } + + /** + * Get the k property: Symmetric key. + * + * @return the k value. + */ + @Generated + public String getK() { + return this.k; + } + + /** + * Get the kid property: The "kid" (key ID) parameter is used to match a specific key. This + * is used, for instance, to choose among a set of keys within a JWK Set + * during key rollover. The structure of the "kid" value is + * unspecified. When "kid" values are used within a JWK Set, different + * keys within the JWK Set SHOULD use distinct "kid" values. (One + * example in which different keys might use the same "kid" value is if + * they have different "kty" (key type) values but are considered to be + * equivalent alternatives by the application using them.) The "kid" + * value is a case-sensitive string. + * + * @return the kid value. + */ + @Generated + public String getKid() { + return this.kid; + } + + /** + * Get the kty property: The "kty" (key type) parameter identifies the cryptographic algorithm + * family used with the key, such as "RSA" or "EC". "kty" values should + * either be registered in the IANA "JSON Web Key Types" registry + * established by [JWA] or be a value that contains a Collision- + * Resistant Name. The "kty" value is a case-sensitive string. + * + * @return the kty value. + */ + @Generated + public String getKty() { + return this.kty; + } + + /** + * Get the n property: RSA modulus, in Base64. + * + * @return the n value. + */ + @Generated + public String getN() { + return this.n; + } + + /** + * Get the p property: RSA secret prime. + * + * @return the p value. + */ + @Generated + public String getP() { + return this.p; + } + + /** + * Get the q property: RSA secret prime, with p < q. + * + * @return the q value. + */ + @Generated + public String getQ() { + return this.q; + } + + /** + * Get the qi property: RSA Private Key Parameter. + * + * @return the qi value. + */ + @Generated + public String getQi() { + return this.qi; + } + + /** + * Get the use property: Use ("public key use") identifies the intended use of + * the public key. The "use" parameter is employed to indicate whether + * a public key is used for encrypting data or verifying the signature + * on data. Values are commonly "sig" (signature) or "enc" (encryption). + * + * @return the use value. + */ + @Generated + public String getUse() { + return this.use; + } + + /** + * Get the x property: X coordinate for the Elliptic Curve point. + * + * @return the x value. + */ + @Generated + public String getX() { + return this.x; + } + + /** + * Get the x5c property: The "x5c" (X.509 certificate chain) parameter contains a chain of one + * or more PKIX certificates [RFC5280]. The certificate chain is + * represented as a JSON array of certificate value strings. Each + * string in the array is a base64-encoded (Section 4 of [RFC4648] -- + * not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. + * The PKIX certificate containing the key value MUST be the first + * certificate. + * + * @return the x5c value. + */ + @Generated + public List getX5c() { + return this.x5c; + } + + /** + * Get the y property: Y coordinate for the Elliptic Curve point. + * + * @return the y value. + */ + @Generated + public String getY() { + return this.y; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kty", this.kty); + jsonWriter.writeStringField("alg", this.alg); + jsonWriter.writeStringField("crv", this.crv); + jsonWriter.writeStringField("d", this.d); + jsonWriter.writeStringField("dp", this.dp); + jsonWriter.writeStringField("dq", this.dq); + jsonWriter.writeStringField("e", this.e); + jsonWriter.writeStringField("k", this.k); + jsonWriter.writeStringField("kid", this.kid); + jsonWriter.writeStringField("n", this.n); + jsonWriter.writeStringField("p", this.p); + jsonWriter.writeStringField("q", this.q); + jsonWriter.writeStringField("qi", this.qi); + jsonWriter.writeStringField("use", this.use); + jsonWriter.writeStringField("x", this.x); + jsonWriter.writeArrayField("x5c", this.x5c, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("y", this.y); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JsonWebKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JsonWebKey if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JsonWebKey. + */ + @Generated + public static JsonWebKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String kty = null; + String alg = null; + String crv = null; + String d = null; + String dp = null; + String dq = null; + String e = null; + String k = null; + String kid = null; + String n = null; + String p = null; + String q = null; + String qi = null; + String use = null; + String x = null; + List x5c = null; + String y = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kty".equals(fieldName)) { + kty = reader.getString(); + } else if ("alg".equals(fieldName)) { + alg = reader.getString(); + } else if ("crv".equals(fieldName)) { + crv = reader.getString(); + } else if ("d".equals(fieldName)) { + d = reader.getString(); + } else if ("dp".equals(fieldName)) { + dp = reader.getString(); + } else if ("dq".equals(fieldName)) { + dq = reader.getString(); + } else if ("e".equals(fieldName)) { + e = reader.getString(); + } else if ("k".equals(fieldName)) { + k = reader.getString(); + } else if ("kid".equals(fieldName)) { + kid = reader.getString(); + } else if ("n".equals(fieldName)) { + n = reader.getString(); + } else if ("p".equals(fieldName)) { + p = reader.getString(); + } else if ("q".equals(fieldName)) { + q = reader.getString(); + } else if ("qi".equals(fieldName)) { + qi = reader.getString(); + } else if ("use".equals(fieldName)) { + use = reader.getString(); + } else if ("x".equals(fieldName)) { + x = reader.getString(); + } else if ("x5c".equals(fieldName)) { + x5c = reader.readArray(reader1 -> reader1.getString()); + } else if ("y".equals(fieldName)) { + y = reader.getString(); + } else { + reader.skipChildren(); + } + } + JsonWebKey deserializedJsonWebKey = new JsonWebKey(kty); + deserializedJsonWebKey.alg = alg; + deserializedJsonWebKey.crv = crv; + deserializedJsonWebKey.d = d; + deserializedJsonWebKey.dp = dp; + deserializedJsonWebKey.dq = dq; + deserializedJsonWebKey.e = e; + deserializedJsonWebKey.k = k; + deserializedJsonWebKey.kid = kid; + deserializedJsonWebKey.n = n; + deserializedJsonWebKey.p = p; + deserializedJsonWebKey.q = q; + deserializedJsonWebKey.qi = qi; + deserializedJsonWebKey.use = use; + deserializedJsonWebKey.x = x; + deserializedJsonWebKey.x5c = x5c; + deserializedJsonWebKey.y = y; + + return deserializedJsonWebKey; + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/ListOperationResult.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/ListOperationResult.java new file mode 100644 index 000000000000..1d79b2abc226 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/ListOperationResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The Response body of the ListOperations API. + */ +@Immutable +public final class ListOperationResult implements JsonSerializable { + /* + * List of operations + */ + @Generated + private final List operations; + + /** + * Creates an instance of ListOperationResult class. + * + * @param operations the operations value to set. + */ + @Generated + private ListOperationResult(List operations) { + this.operations = operations; + } + + /** + * Get the operations property: List of operations. + * + * @return the operations value. + */ + @Generated + public List getOperations() { + return this.operations; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("operations", this.operations, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListOperationResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListOperationResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ListOperationResult. + */ + @Generated + public static ListOperationResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List operations = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operations".equals(fieldName)) { + operations = reader.readArray(reader1 -> GetOperationResult.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new ListOperationResult(operations); + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/OperationStatus.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/OperationStatus.java new file mode 100644 index 000000000000..f94f0300be24 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/OperationStatus.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Possible statuses of the operation. + */ +public final class OperationStatus extends ExpandableStringEnum { + /** + * Operation is still running. + */ + @Generated + public static final OperationStatus RUNNING = fromString("running"); + + /** + * Operation failed. + */ + @Generated + public static final OperationStatus FAILED = fromString("failed"); + + /** + * Operation succeeded. + */ + @Generated + public static final OperationStatus SUCCEEDED = fromString("succeeded"); + + /** + * Creates a new instance of OperationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public OperationStatus() { + } + + /** + * Creates or finds a OperationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationStatus. + */ + @Generated + public static OperationStatus fromString(String name) { + return fromString(name, OperationStatus.class); + } + + /** + * Gets known OperationStatus values. + * + * @return known OperationStatus values. + */ + @Generated + public static Collection values() { + return values(OperationStatus.class); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/ParametersResult.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/ParametersResult.java new file mode 100644 index 000000000000..976cc5617686 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/ParametersResult.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Response body of the service parameters. + */ +@Immutable +public final class ParametersResult implements JsonSerializable { + /* + * The serviceCertificate property. + */ + @Generated + private final String serviceCertificate; + + /* + * The serviceId property. + */ + @Generated + private final String serviceId; + + /* + * The signatureAlgorithm property. + */ + @Generated + private final String signatureAlgorithm; + + /* + * The treeAlgorithm property. + */ + @Generated + private final String treeAlgorithm; + + /** + * Creates an instance of ParametersResult class. + * + * @param serviceCertificate the serviceCertificate value to set. + * @param serviceId the serviceId value to set. + * @param signatureAlgorithm the signatureAlgorithm value to set. + * @param treeAlgorithm the treeAlgorithm value to set. + */ + @Generated + private ParametersResult(String serviceCertificate, String serviceId, String signatureAlgorithm, + String treeAlgorithm) { + this.serviceCertificate = serviceCertificate; + this.serviceId = serviceId; + this.signatureAlgorithm = signatureAlgorithm; + this.treeAlgorithm = treeAlgorithm; + } + + /** + * Get the serviceCertificate property: The serviceCertificate property. + * + * @return the serviceCertificate value. + */ + @Generated + public String getServiceCertificate() { + return this.serviceCertificate; + } + + /** + * Get the serviceId property: The serviceId property. + * + * @return the serviceId value. + */ + @Generated + public String getServiceId() { + return this.serviceId; + } + + /** + * Get the signatureAlgorithm property: The signatureAlgorithm property. + * + * @return the signatureAlgorithm value. + */ + @Generated + public String getSignatureAlgorithm() { + return this.signatureAlgorithm; + } + + /** + * Get the treeAlgorithm property: The treeAlgorithm property. + * + * @return the treeAlgorithm value. + */ + @Generated + public String getTreeAlgorithm() { + return this.treeAlgorithm; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serviceCertificate", this.serviceCertificate); + jsonWriter.writeStringField("serviceId", this.serviceId); + jsonWriter.writeStringField("signatureAlgorithm", this.signatureAlgorithm); + jsonWriter.writeStringField("treeAlgorithm", this.treeAlgorithm); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ParametersResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ParametersResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ParametersResult. + */ + @Generated + public static ParametersResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String serviceCertificate = null; + String serviceId = null; + String signatureAlgorithm = null; + String treeAlgorithm = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceCertificate".equals(fieldName)) { + serviceCertificate = reader.getString(); + } else if ("serviceId".equals(fieldName)) { + serviceId = reader.getString(); + } else if ("signatureAlgorithm".equals(fieldName)) { + signatureAlgorithm = reader.getString(); + } else if ("treeAlgorithm".equals(fieldName)) { + treeAlgorithm = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ParametersResult(serviceCertificate, serviceId, signatureAlgorithm, treeAlgorithm); + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/VersionResult.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/VersionResult.java new file mode 100644 index 000000000000..2cc16ea14571 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/VersionResult.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Response body of the Version API. + */ +@Immutable +public final class VersionResult implements JsonSerializable { + /* + * Version of the CodeTransparency service + */ + @Generated + private final String scittVersion; + + /** + * Creates an instance of VersionResult class. + * + * @param scittVersion the scittVersion value to set. + */ + @Generated + private VersionResult(String scittVersion) { + this.scittVersion = scittVersion; + } + + /** + * Get the scittVersion property: Version of the CodeTransparency service. + * + * @return the scittVersion value. + */ + @Generated + public String getScittVersion() { + return this.scittVersion; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("scitt_version", this.scittVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VersionResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VersionResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VersionResult. + */ + @Generated + public static VersionResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String scittVersion = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("scitt_version".equals(fieldName)) { + scittVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new VersionResult(scittVersion); + }); + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/package-info.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/package-info.java new file mode 100644 index 000000000000..7f905b6534c9 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for CodeTransparency. + */ +package com.azure.security.codetransparency.models; diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/package-info.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/package-info.java new file mode 100644 index 000000000000..7b7bfd248220 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/com/azure/security/codetransparency/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for CodeTransparency. + */ +package com.azure.security.codetransparency; diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/java/module-info.java b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/module-info.java new file mode 100644 index 000000000000..f5829e864093 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/java/module-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.security.codetransparency { + requires transitive com.azure.core; + exports com.azure.security.codetransparency; + exports com.azure.security.codetransparency.models; + opens com.azure.security.codetransparency.models to com.azure.core; +} \ No newline at end of file diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/resources/META-INF/azure-security-codetransparency_apiview_properties.json b/sdk/confidentialledger/azure-security-codetransparency/src/main/resources/META-INF/azure-security-codetransparency_apiview_properties.json new file mode 100644 index 000000000000..5fc83a123453 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/resources/META-INF/azure-security-codetransparency_apiview_properties.json @@ -0,0 +1,59 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.security.codetransparency.CodeTransparencyAsyncClient": "Microsoft.CodeTransparency", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.createEntry": "Microsoft.CodeTransparency.createEntry", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.createEntryWithResponse": "Microsoft.CodeTransparency.createEntry", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getCodeTransparencyConfig": "Microsoft.CodeTransparency.getCodeTransparencyConfig", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getCodeTransparencyConfigWithResponse": "Microsoft.CodeTransparency.getCodeTransparencyConfig", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getCodeTransparencyVersion": "Microsoft.CodeTransparency.getCodeTransparencyVersion", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getCodeTransparencyVersionWithResponse": "Microsoft.CodeTransparency.getCodeTransparencyVersion", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getDidConfig": "Microsoft.CodeTransparency.getDidConfig", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getDidConfigWithResponse": "Microsoft.CodeTransparency.getDidConfig", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getEntry": "Microsoft.CodeTransparency.getEntry", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getEntryReceipt": "Microsoft.CodeTransparency.getEntryReceipt", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getEntryReceiptWithResponse": "Microsoft.CodeTransparency.getEntryReceipt", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getEntryStatus": "Microsoft.CodeTransparency.getEntryStatus", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getEntryStatusWithResponse": "Microsoft.CodeTransparency.getEntryStatus", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getEntryWithResponse": "Microsoft.CodeTransparency.getEntry", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getParameters": "Microsoft.CodeTransparency.getParameters", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.getParametersWithResponse": "Microsoft.CodeTransparency.getParameters", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.listEntryIds": "Microsoft.CodeTransparency.listEntryIds", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.listEntryStatuses": "Microsoft.CodeTransparency.listEntryStatuses", + "com.azure.security.codetransparency.CodeTransparencyAsyncClient.listEntryStatusesWithResponse": "Microsoft.CodeTransparency.listEntryStatuses", + "com.azure.security.codetransparency.CodeTransparencyClient": "Microsoft.CodeTransparency", + "com.azure.security.codetransparency.CodeTransparencyClient.createEntry": "Microsoft.CodeTransparency.createEntry", + "com.azure.security.codetransparency.CodeTransparencyClient.createEntryWithResponse": "Microsoft.CodeTransparency.createEntry", + "com.azure.security.codetransparency.CodeTransparencyClient.getCodeTransparencyConfig": "Microsoft.CodeTransparency.getCodeTransparencyConfig", + "com.azure.security.codetransparency.CodeTransparencyClient.getCodeTransparencyConfigWithResponse": "Microsoft.CodeTransparency.getCodeTransparencyConfig", + "com.azure.security.codetransparency.CodeTransparencyClient.getCodeTransparencyVersion": "Microsoft.CodeTransparency.getCodeTransparencyVersion", + "com.azure.security.codetransparency.CodeTransparencyClient.getCodeTransparencyVersionWithResponse": "Microsoft.CodeTransparency.getCodeTransparencyVersion", + "com.azure.security.codetransparency.CodeTransparencyClient.getDidConfig": "Microsoft.CodeTransparency.getDidConfig", + "com.azure.security.codetransparency.CodeTransparencyClient.getDidConfigWithResponse": "Microsoft.CodeTransparency.getDidConfig", + "com.azure.security.codetransparency.CodeTransparencyClient.getEntry": "Microsoft.CodeTransparency.getEntry", + "com.azure.security.codetransparency.CodeTransparencyClient.getEntryReceipt": "Microsoft.CodeTransparency.getEntryReceipt", + "com.azure.security.codetransparency.CodeTransparencyClient.getEntryReceiptWithResponse": "Microsoft.CodeTransparency.getEntryReceipt", + "com.azure.security.codetransparency.CodeTransparencyClient.getEntryStatus": "Microsoft.CodeTransparency.getEntryStatus", + "com.azure.security.codetransparency.CodeTransparencyClient.getEntryStatusWithResponse": "Microsoft.CodeTransparency.getEntryStatus", + "com.azure.security.codetransparency.CodeTransparencyClient.getEntryWithResponse": "Microsoft.CodeTransparency.getEntry", + "com.azure.security.codetransparency.CodeTransparencyClient.getParameters": "Microsoft.CodeTransparency.getParameters", + "com.azure.security.codetransparency.CodeTransparencyClient.getParametersWithResponse": "Microsoft.CodeTransparency.getParameters", + "com.azure.security.codetransparency.CodeTransparencyClient.listEntryIds": "Microsoft.CodeTransparency.listEntryIds", + "com.azure.security.codetransparency.CodeTransparencyClient.listEntryStatuses": "Microsoft.CodeTransparency.listEntryStatuses", + "com.azure.security.codetransparency.CodeTransparencyClient.listEntryStatusesWithResponse": "Microsoft.CodeTransparency.listEntryStatuses", + "com.azure.security.codetransparency.CodeTransparencyClientBuilder": "Microsoft.CodeTransparency", + "com.azure.security.codetransparency.models.CodeTransparencyConfiguration": "Microsoft.CodeTransparency.CodeTransparencyConfiguration", + "com.azure.security.codetransparency.models.CodeTransparencyConfigurationAuthentication": "Microsoft.CodeTransparency.CodeTransparencyConfigurationAuthentication", + "com.azure.security.codetransparency.models.CodeTransparencyConfigurationAuthenticationJwt": "Microsoft.CodeTransparency.CodeTransparencyConfigurationAuthenticationJwt", + "com.azure.security.codetransparency.models.CodeTransparencyConfigurationPolicy": "Microsoft.CodeTransparency.CodeTransparencyConfigurationPolicy", + "com.azure.security.codetransparency.models.CreateEntryResult": "Microsoft.CodeTransparency.CreateEntryResult", + "com.azure.security.codetransparency.models.DidDocument": "Microsoft.CodeTransparency.DidDocument", + "com.azure.security.codetransparency.models.DidDocumentKey": "Microsoft.CodeTransparency.DidDocumentKey", + "com.azure.security.codetransparency.models.GetOperationResult": "Microsoft.CodeTransparency.GetOperationResult", + "com.azure.security.codetransparency.models.JsonWebKey": "Microsoft.CodeTransparency.JsonWebKey", + "com.azure.security.codetransparency.models.ListOperationResult": "Microsoft.CodeTransparency.ListOperationResult", + "com.azure.security.codetransparency.models.OperationStatus": "Microsoft.CodeTransparency.OperationStatus", + "com.azure.security.codetransparency.models.ParametersResult": "Microsoft.CodeTransparency.ParametersResult", + "com.azure.security.codetransparency.models.VersionResult": "Microsoft.CodeTransparency.VersionResult" + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/main/resources/azure-security-codetransparency.properties b/sdk/confidentialledger/azure-security-codetransparency/src/main/resources/azure-security-codetransparency.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/main/resources/azure-security-codetransparency.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/samples/java/com/azure/security/codetransparency/ReadmeSamples.java b/sdk/confidentialledger/azure-security-codetransparency/src/samples/java/com/azure/security/codetransparency/ReadmeSamples.java new file mode 100644 index 000000000000..ab339d1eaff9 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/samples/java/com/azure/security/codetransparency/ReadmeSamples.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.security.codetransparency.readme + // END: com.azure.security.codetransparency.readme + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/src/test/java/com/azure/security/codetransparency/generated/CodeTransparencyClientTestBase.java b/sdk/confidentialledger/azure-security-codetransparency/src/test/java/com/azure/security/codetransparency/generated/CodeTransparencyClientTestBase.java new file mode 100644 index 000000000000..f578b2823df2 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/src/test/java/com/azure/security/codetransparency/generated/CodeTransparencyClientTestBase.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.security.codetransparency.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.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.security.codetransparency.CodeTransparencyClient; +import com.azure.security.codetransparency.CodeTransparencyClientBuilder; + +class CodeTransparencyClientTestBase extends TestProxyTestBase { + protected CodeTransparencyClient codeTransparencyClient; + + @Override + protected void beforeTest() { + CodeTransparencyClientBuilder codeTransparencyClientbuilder = new CodeTransparencyClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + codeTransparencyClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + codeTransparencyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + codeTransparencyClient = codeTransparencyClientbuilder.buildClient(); + + } +} diff --git a/sdk/confidentialledger/azure-security-codetransparency/tsp-location.yaml b/sdk/confidentialledger/azure-security-codetransparency/tsp-location.yaml new file mode 100644 index 000000000000..2c9f74553665 --- /dev/null +++ b/sdk/confidentialledger/azure-security-codetransparency/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/confidentialledger/Microsoft.CodeTransparency +commit: 6b7e75e5013dee466ea24f7e705dee427db26f84 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/confidentialledger/ci.yml b/sdk/confidentialledger/ci.yml index c1b564d31137..c406ef983056 100644 --- a/sdk/confidentialledger/ci.yml +++ b/sdk/confidentialledger/ci.yml @@ -30,14 +30,18 @@ pr: - sdk/confidentialledger/azure-resourcemanager-confidentialledger/pom.xml parameters: -- name: release_azuresecurityconfidentialledger - displayName: 'azure-security-confidentialledger' - type: boolean - default: true -- name: release_azureresourcemanagerconfidentialledger - displayName: 'azure-resourcemanager-confidentialledger' - type: boolean - default: false + - name: release_azuresecurityconfidentialledger + displayName: azure-security-confidentialledger + type: boolean + default: true + - name: release_azureresourcemanagerconfidentialledger + displayName: azure-resourcemanager-confidentialledger + type: boolean + default: false + - name: release_azuresecuritycodetransparency + displayName: azure-security-codetransparency + type: boolean + default: true extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -52,3 +56,7 @@ extends: groupId: com.azure.resourcemanager safeName: azureresourcemanagerconfidentialledger releaseInBatch: ${{ parameters.release_azureresourcemanagerconfidentialledger }} + - name: azure-security-codetransparency + groupId: com.azure + safeName: azuresecuritycodetransparency + releaseInBatch: ${{ parameters.release_azuresecuritycodetransparency }} diff --git a/sdk/confidentialledger/pom.xml b/sdk/confidentialledger/pom.xml index 02aadd3e1659..65905ef55a7d 100644 --- a/sdk/confidentialledger/pom.xml +++ b/sdk/confidentialledger/pom.xml @@ -9,7 +9,8 @@ pom 1.0.0 - azure-resourcemanager-confidentialledger - azure-security-confidentialledger + azure-resourcemanager-confidentialledger + azure-security-codetransparency + azure-security-confidentialledger \ No newline at end of file