diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt
index a2277ce3b9ee..ecb70d198e27 100644
--- a/eng/versioning/version_client.txt
+++ b/eng/versioning/version_client.txt
@@ -256,6 +256,7 @@ com.azure.spring:spring-cloud-azure-stream-binder-servicebus-core;5.21.0;5.22.0-
com.azure.spring:spring-cloud-azure-stream-binder-servicebus;5.21.0;5.22.0-beta.1
com.azure.spring:spring-cloud-azure-testcontainers;5.21.0;5.22.0-beta.1
com.azure:azure-spring-data-cosmos;5.21.0;5.22.0-beta.1
+com.azure:azure-apicenter;1.0.0-beta.1;1.0.0-beta.1
com.azure.resourcemanager:azure-resourcemanager;2.49.0;2.50.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-appplatform;2.49.0;2.50.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-appservice;2.49.0;2.50.0-beta.1
diff --git a/sdk/apicenter/azure-apicenter/CHANGELOG.md b/sdk/apicenter/azure-apicenter/CHANGELOG.md
new file mode 100644
index 000000000000..2456158d259d
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/CHANGELOG.md
@@ -0,0 +1,16 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+- Azure DataApi client library for Java. This package contains Microsoft Azure DataApi client library.
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
+### Features Added
+
+- Initial release for the azure-apicenter Java SDK.
diff --git a/sdk/apicenter/azure-apicenter/README.md b/sdk/apicenter/azure-apicenter/README.md
new file mode 100644
index 000000000000..7bff495f4ca2
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/README.md
@@ -0,0 +1,78 @@
+# Azure DataApi client library for Java
+
+Azure DataApi client library for Java.
+
+This package contains Microsoft Azure DataApi 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-apicenter;current})
+```xml
+
+ com.azure
+ azure-apicenter
+ 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.apicenter.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
diff --git a/sdk/apicenter/azure-apicenter/assets.json b/sdk/apicenter/azure-apicenter/assets.json
new file mode 100644
index 000000000000..d5929d4b90ab
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/assets.json
@@ -0,0 +1 @@
+{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/apicenter/azure-apicenter","Tag":""}
\ No newline at end of file
diff --git a/sdk/apicenter/azure-apicenter/pom.xml b/sdk/apicenter/azure-apicenter/pom.xml
new file mode 100644
index 000000000000..f463990ed068
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/pom.xml
@@ -0,0 +1,71 @@
+
+
+ 4.0.0
+
+ com.azure
+ azure-client-sdk-parent
+ 1.7.0
+ ../../parents/azure-client-sdk-parent
+
+
+ com.azure
+ azure-apicenter
+ 1.0.0-beta.1
+ jar
+
+ Microsoft Azure SDK for DataApi
+ This package contains Microsoft Azure DataApi 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-core
+ 1.55.3
+
+
+ com.azure
+ azure-core-http-netty
+ 1.15.11
+
+
+ com.azure
+ azure-core-test
+ 1.27.0-beta.8
+ test
+
+
+ com.azure
+ azure-identity
+ 1.15.4
+ test
+
+
+
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDefinitionsAsyncClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDefinitionsAsyncClient.java
new file mode 100644
index 000000000000..afce90c8b794
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDefinitionsAsyncClient.java
@@ -0,0 +1,387 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.ApiDefinitionsImpl;
+import com.azure.apicenter.models.ApiDefinition;
+import com.azure.apicenter.models.ApiSpecExportResult;
+import com.azure.apicenter.models.ResourceOperationStatusApiSpecExportResultApiSpecExportResultError;
+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.core.util.polling.PollOperationDetails;
+import com.azure.core.util.polling.PollerFlux;
+import java.util.stream.Collectors;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the asynchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class, isAsync = true)
+public final class ApiDefinitionsAsyncClient {
+ @Generated
+ private final ApiDefinitionsImpl serviceClient;
+
+ /**
+ * Initializes an instance of ApiDefinitionsAsyncClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ApiDefinitionsAsyncClient(ApiDefinitionsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of API definitions.
+ *
Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDefinition items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDefinitions(String workspaceName, String apiName, String versionName,
+ RequestOptions requestOptions) {
+ return this.serviceClient.listDefinitionsAsync(workspaceName, apiName, versionName, requestOptions);
+ }
+
+ /**
+ * Get an API definition.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName Definition identifier.
+ * @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 an API definition along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getDefinitionWithResponse(String workspaceName, String apiName,
+ String versionName, String definitionName, RequestOptions requestOptions) {
+ return this.serviceClient.getDefinitionWithResponseAsync(workspaceName, apiName, versionName, definitionName,
+ requestOptions);
+ }
+
+ /**
+ * Gets status of a an API specification export operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param operationId The unique ID of the operation.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return status of a an API specification export operation along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getExportSpecificationOperationStatusWithResponse(String workspaceName,
+ String apiName, String versionName, String definitionName, String operationId, RequestOptions requestOptions) {
+ return this.serviceClient.getExportSpecificationOperationStatusWithResponseAsync(workspaceName, apiName,
+ versionName, definitionName, operationId, requestOptions);
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginExportSpecification(String workspaceName, String apiName,
+ String versionName, String definitionName, RequestOptions requestOptions) {
+ return this.serviceClient.beginExportSpecificationAsync(workspaceName, apiName, versionName, definitionName,
+ requestOptions);
+ }
+
+ /**
+ * List a collection of API definitions.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiDefinition items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDefinitions(String workspaceName, String apiName, String versionName,
+ Integer top, Integer skip) {
+ // Generated convenience method for listDefinitions
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ PagedFlux pagedFluxResponse = listDefinitions(workspaceName, apiName, versionName, 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(ApiDefinition.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * List a collection of API definitions.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiDefinition items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDefinitions(String workspaceName, String apiName, String versionName) {
+ // Generated convenience method for listDefinitions
+ RequestOptions requestOptions = new RequestOptions();
+ PagedFlux pagedFluxResponse = listDefinitions(workspaceName, apiName, versionName, 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(ApiDefinition.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * Get an API definition.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName Definition identifier.
+ * @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 an API definition on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getDefinition(String workspaceName, String apiName, String versionName,
+ String definitionName) {
+ // Generated convenience method for getDefinitionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getDefinitionWithResponse(workspaceName, apiName, versionName, definitionName, requestOptions)
+ .flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ApiDefinition.class));
+ }
+
+ /**
+ * Gets status of a an API specification export operation.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param operationId The unique ID of the operation.
+ * @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 status of a an API specification export operation on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono
+ getExportSpecificationOperationStatus(String workspaceName, String apiName, String versionName,
+ String definitionName, String operationId) {
+ // Generated convenience method for getExportSpecificationOperationStatusWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getExportSpecificationOperationStatusWithResponse(workspaceName, apiName, versionName, definitionName,
+ operationId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData
+ .toObject(ResourceOperationStatusApiSpecExportResultApiSpecExportResultError.class));
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginExportSpecification(String workspaceName,
+ String apiName, String versionName, String definitionName) {
+ // Generated convenience method for beginExportSpecificationWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginExportSpecificationWithModelAsync(workspaceName, apiName, versionName, definitionName,
+ requestOptions);
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDefinitionsClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDefinitionsClient.java
new file mode 100644
index 000000000000..d641ad5b0edf
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDefinitionsClient.java
@@ -0,0 +1,355 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.ApiDefinitionsImpl;
+import com.azure.apicenter.models.ApiDefinition;
+import com.azure.apicenter.models.ApiSpecExportResult;
+import com.azure.apicenter.models.ResourceOperationStatusApiSpecExportResultApiSpecExportResultError;
+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.core.util.polling.PollOperationDetails;
+import com.azure.core.util.polling.SyncPoller;
+
+/**
+ * Initializes a new instance of the synchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class)
+public final class ApiDefinitionsClient {
+ @Generated
+ private final ApiDefinitionsImpl serviceClient;
+
+ /**
+ * Initializes an instance of ApiDefinitionsClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ApiDefinitionsClient(ApiDefinitionsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of API definitions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDefinition items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDefinitions(String workspaceName, String apiName, String versionName,
+ RequestOptions requestOptions) {
+ return this.serviceClient.listDefinitions(workspaceName, apiName, versionName, requestOptions);
+ }
+
+ /**
+ * Get an API definition.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName Definition identifier.
+ * @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 an API definition along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getDefinitionWithResponse(String workspaceName, String apiName, String versionName,
+ String definitionName, RequestOptions requestOptions) {
+ return this.serviceClient.getDefinitionWithResponse(workspaceName, apiName, versionName, definitionName,
+ requestOptions);
+ }
+
+ /**
+ * Gets status of a an API specification export operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param operationId The unique ID of the operation.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return status of a an API specification export operation along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getExportSpecificationOperationStatusWithResponse(String workspaceName, String apiName,
+ String versionName, String definitionName, String operationId, RequestOptions requestOptions) {
+ return this.serviceClient.getExportSpecificationOperationStatusWithResponse(workspaceName, apiName, versionName,
+ definitionName, operationId, requestOptions);
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginExportSpecification(String workspaceName, String apiName,
+ String versionName, String definitionName, RequestOptions requestOptions) {
+ return this.serviceClient.beginExportSpecification(workspaceName, apiName, versionName, definitionName,
+ requestOptions);
+ }
+
+ /**
+ * List a collection of API definitions.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiDefinition items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDefinitions(String workspaceName, String apiName, String versionName,
+ Integer top, Integer skip) {
+ // Generated convenience method for listDefinitions
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ return serviceClient.listDefinitions(workspaceName, apiName, versionName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(ApiDefinition.class));
+ }
+
+ /**
+ * List a collection of API definitions.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiDefinition items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDefinitions(String workspaceName, String apiName, String versionName) {
+ // Generated convenience method for listDefinitions
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.listDefinitions(workspaceName, apiName, versionName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(ApiDefinition.class));
+ }
+
+ /**
+ * Get an API definition.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName Definition identifier.
+ * @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 an API definition.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ApiDefinition getDefinition(String workspaceName, String apiName, String versionName,
+ String definitionName) {
+ // Generated convenience method for getDefinitionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getDefinitionWithResponse(workspaceName, apiName, versionName, definitionName, requestOptions).getValue()
+ .toObject(ApiDefinition.class);
+ }
+
+ /**
+ * Gets status of a an API specification export operation.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param operationId The unique ID of the operation.
+ * @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 status of a an API specification export operation.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ResourceOperationStatusApiSpecExportResultApiSpecExportResultError getExportSpecificationOperationStatus(
+ String workspaceName, String apiName, String versionName, String definitionName, String operationId) {
+ // Generated convenience method for getExportSpecificationOperationStatusWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getExportSpecificationOperationStatusWithResponse(workspaceName, apiName, versionName, definitionName,
+ operationId, requestOptions).getValue()
+ .toObject(ResourceOperationStatusApiSpecExportResultApiSpecExportResultError.class);
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginExportSpecification(String workspaceName,
+ String apiName, String versionName, String definitionName) {
+ // Generated convenience method for beginExportSpecificationWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginExportSpecificationWithModel(workspaceName, apiName, versionName, definitionName,
+ requestOptions);
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDeploymentsAsyncClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDeploymentsAsyncClient.java
new file mode 100644
index 000000000000..bd3926437a2d
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDeploymentsAsyncClient.java
@@ -0,0 +1,231 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.ApiDeploymentsImpl;
+import com.azure.apicenter.models.ApiDeployment;
+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 java.util.stream.Collectors;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the asynchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class, isAsync = true)
+public final class ApiDeploymentsAsyncClient {
+ @Generated
+ private final ApiDeploymentsImpl serviceClient;
+
+ /**
+ * Initializes an instance of ApiDeploymentsAsyncClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ApiDeploymentsAsyncClient(ApiDeploymentsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of API deployments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDeployment items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDeployments(String workspaceName, String apiName, RequestOptions requestOptions) {
+ return this.serviceClient.listDeploymentsAsync(workspaceName, apiName, requestOptions);
+ }
+
+ /**
+ * Get an API deployment.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param deploymentName Deployment identifier.
+ * @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 an API deployment along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getDeploymentWithResponse(String workspaceName, String apiName,
+ String deploymentName, RequestOptions requestOptions) {
+ return this.serviceClient.getDeploymentWithResponseAsync(workspaceName, apiName, deploymentName,
+ requestOptions);
+ }
+
+ /**
+ * List a collection of API deployments.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiDeployment items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDeployments(String workspaceName, String apiName, Integer top, Integer skip) {
+ // Generated convenience method for listDeployments
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ PagedFlux pagedFluxResponse = listDeployments(workspaceName, apiName, 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(ApiDeployment.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * List a collection of API deployments.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiDeployment items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDeployments(String workspaceName, String apiName) {
+ // Generated convenience method for listDeployments
+ RequestOptions requestOptions = new RequestOptions();
+ PagedFlux pagedFluxResponse = listDeployments(workspaceName, apiName, 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(ApiDeployment.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * Get an API deployment.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param deploymentName Deployment identifier.
+ * @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 an API deployment on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getDeployment(String workspaceName, String apiName, String deploymentName) {
+ // Generated convenience method for getDeploymentWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getDeploymentWithResponse(workspaceName, apiName, deploymentName, requestOptions)
+ .flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ApiDeployment.class));
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDeploymentsClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDeploymentsClient.java
new file mode 100644
index 000000000000..e0f418a8497e
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiDeploymentsClient.java
@@ -0,0 +1,203 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.ApiDeploymentsImpl;
+import com.azure.apicenter.models.ApiDeployment;
+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;
+
+/**
+ * Initializes a new instance of the synchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class)
+public final class ApiDeploymentsClient {
+ @Generated
+ private final ApiDeploymentsImpl serviceClient;
+
+ /**
+ * Initializes an instance of ApiDeploymentsClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ApiDeploymentsClient(ApiDeploymentsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of API deployments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDeployment items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDeployments(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ return this.serviceClient.listDeployments(workspaceName, apiName, requestOptions);
+ }
+
+ /**
+ * Get an API deployment.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param deploymentName Deployment identifier.
+ * @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 an API deployment along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getDeploymentWithResponse(String workspaceName, String apiName, String deploymentName,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getDeploymentWithResponse(workspaceName, apiName, deploymentName, requestOptions);
+ }
+
+ /**
+ * List a collection of API deployments.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiDeployment items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDeployments(String workspaceName, String apiName, Integer top,
+ Integer skip) {
+ // Generated convenience method for listDeployments
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ return serviceClient.listDeployments(workspaceName, apiName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(ApiDeployment.class));
+ }
+
+ /**
+ * List a collection of API deployments.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiDeployment items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDeployments(String workspaceName, String apiName) {
+ // Generated convenience method for listDeployments
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.listDeployments(workspaceName, apiName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(ApiDeployment.class));
+ }
+
+ /**
+ * Get an API deployment.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param deploymentName Deployment identifier.
+ * @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 an API deployment.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ApiDeployment getDeployment(String workspaceName, String apiName, String deploymentName) {
+ // Generated convenience method for getDeploymentWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getDeploymentWithResponse(workspaceName, apiName, deploymentName, requestOptions).getValue()
+ .toObject(ApiDeployment.class);
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiVersionsAsyncClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiVersionsAsyncClient.java
new file mode 100644
index 000000000000..9a64678e4fc3
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiVersionsAsyncClient.java
@@ -0,0 +1,211 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.ApiVersionsImpl;
+import com.azure.apicenter.models.ApiVersion;
+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 java.util.stream.Collectors;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the asynchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class, isAsync = true)
+public final class ApiVersionsAsyncClient {
+ @Generated
+ private final ApiVersionsImpl serviceClient;
+
+ /**
+ * Initializes an instance of ApiVersionsAsyncClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ApiVersionsAsyncClient(ApiVersionsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of API versions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiVersion items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listVersions(String workspaceName, String apiName, RequestOptions requestOptions) {
+ return this.serviceClient.listVersionsAsync(workspaceName, apiName, requestOptions);
+ }
+
+ /**
+ * Get an API version.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @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 an API version along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getVersionWithResponse(String workspaceName, String apiName, String versionName,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getVersionWithResponseAsync(workspaceName, apiName, versionName, requestOptions);
+ }
+
+ /**
+ * List a collection of API versions.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiVersion items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listVersions(String workspaceName, String apiName, Integer top, Integer skip) {
+ // Generated convenience method for listVersions
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ PagedFlux pagedFluxResponse = listVersions(workspaceName, apiName, 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(ApiVersion.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * List a collection of API versions.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiVersion items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listVersions(String workspaceName, String apiName) {
+ // Generated convenience method for listVersions
+ RequestOptions requestOptions = new RequestOptions();
+ PagedFlux pagedFluxResponse = listVersions(workspaceName, apiName, 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(ApiVersion.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * Get an API version.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @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 an API version on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getVersion(String workspaceName, String apiName, String versionName) {
+ // Generated convenience method for getVersionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getVersionWithResponse(workspaceName, apiName, versionName, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ApiVersion.class));
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiVersionsClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiVersionsClient.java
new file mode 100644
index 000000000000..91c4c4405558
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApiVersionsClient.java
@@ -0,0 +1,183 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.ApiVersionsImpl;
+import com.azure.apicenter.models.ApiVersion;
+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;
+
+/**
+ * Initializes a new instance of the synchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class)
+public final class ApiVersionsClient {
+ @Generated
+ private final ApiVersionsImpl serviceClient;
+
+ /**
+ * Initializes an instance of ApiVersionsClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ApiVersionsClient(ApiVersionsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of API versions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiVersion items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listVersions(String workspaceName, String apiName, RequestOptions requestOptions) {
+ return this.serviceClient.listVersions(workspaceName, apiName, requestOptions);
+ }
+
+ /**
+ * Get an API version.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @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 an API version along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getVersionWithResponse(String workspaceName, String apiName, String versionName,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getVersionWithResponse(workspaceName, apiName, versionName, requestOptions);
+ }
+
+ /**
+ * List a collection of API versions.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiVersion items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listVersions(String workspaceName, String apiName, Integer top, Integer skip) {
+ // Generated convenience method for listVersions
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ return serviceClient.listVersions(workspaceName, apiName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(ApiVersion.class));
+ }
+
+ /**
+ * List a collection of API versions.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of ApiVersion items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listVersions(String workspaceName, String apiName) {
+ // Generated convenience method for listVersions
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.listVersions(workspaceName, apiName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(ApiVersion.class));
+ }
+
+ /**
+ * Get an API version.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @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 an API version.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ApiVersion getVersion(String workspaceName, String apiName, String versionName) {
+ // Generated convenience method for getVersionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getVersionWithResponse(workspaceName, apiName, versionName, requestOptions).getValue()
+ .toObject(ApiVersion.class);
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApisAsyncClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApisAsyncClient.java
new file mode 100644
index 000000000000..a0a390deeb81
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApisAsyncClient.java
@@ -0,0 +1,384 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.ApisImpl;
+import com.azure.apicenter.models.Api;
+import com.azure.apicenter.models.PagedApiAll;
+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 java.util.stream.Collectors;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the asynchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class, isAsync = true)
+public final class ApisAsyncClient {
+ @Generated
+ private final ApisImpl serviceClient;
+
+ /**
+ * Initializes an instance of ApisAsyncClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ApisAsyncClient(ApisImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of APIs.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Api items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux list(String workspaceName, RequestOptions requestOptions) {
+ return this.serviceClient.listAsync(workspaceName, requestOptions);
+ }
+
+ /**
+ * List a collection of APIs across workspaces.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * value (Required): [
+ * (Required){
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * ]
+ * nextLink: 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 paged collection of API items across workspaces along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listAllWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.listAllWithResponseAsync(requestOptions);
+ }
+
+ /**
+ * Get an API.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @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 an API along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getWithResponse(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getWithResponseAsync(workspaceName, apiName, requestOptions);
+ }
+
+ /**
+ * List a collection of APIs.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Api items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux list(String workspaceName, Integer top, Integer skip) {
+ // Generated convenience method for list
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ PagedFlux pagedFluxResponse = list(workspaceName, 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(Api.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * List a collection of APIs.
+ *
+ * @param workspaceName Workspace identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Api items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux list(String workspaceName) {
+ // Generated convenience method for list
+ RequestOptions requestOptions = new RequestOptions();
+ PagedFlux pagedFluxResponse = list(workspaceName, 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(Api.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * List a collection of APIs across workspaces.
+ *
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @param maxPageSize The maximum number of result items per page.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of API items across workspaces on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listAll(Integer top, Integer skip, Integer maxPageSize) {
+ // Generated convenience method for listAllWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ if (maxPageSize != null) {
+ requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false);
+ }
+ return listAllWithResponse(requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(PagedApiAll.class));
+ }
+
+ /**
+ * List a collection of APIs across workspaces.
+ *
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of API items across workspaces on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listAll() {
+ // Generated convenience method for listAllWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listAllWithResponse(requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(PagedApiAll.class));
+ }
+
+ /**
+ * Get an API.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @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 an API on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono get(String workspaceName, String apiName) {
+ // Generated convenience method for getWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getWithResponse(workspaceName, apiName, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(Api.class));
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApisClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApisClient.java
new file mode 100644
index 000000000000..5dfd0fa3fa0e
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/ApisClient.java
@@ -0,0 +1,351 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.ApisImpl;
+import com.azure.apicenter.models.Api;
+import com.azure.apicenter.models.PagedApiAll;
+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;
+
+/**
+ * Initializes a new instance of the synchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class)
+public final class ApisClient {
+ @Generated
+ private final ApisImpl serviceClient;
+
+ /**
+ * Initializes an instance of ApisClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ApisClient(ApisImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of APIs.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Api items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(String workspaceName, RequestOptions requestOptions) {
+ return this.serviceClient.list(workspaceName, requestOptions);
+ }
+
+ /**
+ * List a collection of APIs across workspaces.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * value (Required): [
+ * (Required){
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * ]
+ * nextLink: 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 paged collection of API items across workspaces along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listAllWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.listAllWithResponse(requestOptions);
+ }
+
+ /**
+ * Get an API.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @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 an API along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWithResponse(String workspaceName, String apiName, RequestOptions requestOptions) {
+ return this.serviceClient.getWithResponse(workspaceName, apiName, requestOptions);
+ }
+
+ /**
+ * List a collection of APIs.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Api items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(String workspaceName, Integer top, Integer skip) {
+ // Generated convenience method for list
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ return serviceClient.list(workspaceName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(Api.class));
+ }
+
+ /**
+ * List a collection of APIs.
+ *
+ * @param workspaceName Workspace identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Api items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(String workspaceName) {
+ // Generated convenience method for list
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.list(workspaceName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(Api.class));
+ }
+
+ /**
+ * List a collection of APIs across workspaces.
+ *
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @param maxPageSize The maximum number of result items per page.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of API items across workspaces.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public PagedApiAll listAll(Integer top, Integer skip, Integer maxPageSize) {
+ // Generated convenience method for listAllWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ if (maxPageSize != null) {
+ requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false);
+ }
+ return listAllWithResponse(requestOptions).getValue().toObject(PagedApiAll.class);
+ }
+
+ /**
+ * List a collection of APIs across workspaces.
+ *
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of API items across workspaces.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public PagedApiAll listAll() {
+ // Generated convenience method for listAllWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listAllWithResponse(requestOptions).getValue().toObject(PagedApiAll.class);
+ }
+
+ /**
+ * Get an API.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @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 an API.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Api get(String workspaceName, String apiName) {
+ // Generated convenience method for getWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getWithResponse(workspaceName, apiName, requestOptions).getValue().toObject(Api.class);
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/DataApiClientBuilder.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/DataApiClientBuilder.java
new file mode 100644
index 000000000000..42bbacd624b3
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/DataApiClientBuilder.java
@@ -0,0 +1,443 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.DataApiClientImpl;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ServiceClientBuilder;
+import com.azure.core.client.traits.ConfigurationTrait;
+import com.azure.core.client.traits.HttpTrait;
+import com.azure.core.client.traits.TokenCredentialTrait;
+import com.azure.core.credential.TokenCredential;
+import com.azure.core.http.HttpClient;
+import com.azure.core.http.HttpHeaders;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.HttpPipelinePosition;
+import com.azure.core.http.policy.AddDatePolicy;
+import com.azure.core.http.policy.AddHeadersFromContextPolicy;
+import com.azure.core.http.policy.AddHeadersPolicy;
+import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
+import com.azure.core.http.policy.HttpLogOptions;
+import com.azure.core.http.policy.HttpLoggingPolicy;
+import com.azure.core.http.policy.HttpPipelinePolicy;
+import com.azure.core.http.policy.HttpPolicyProviders;
+import com.azure.core.http.policy.RequestIdPolicy;
+import com.azure.core.http.policy.RetryOptions;
+import com.azure.core.http.policy.RetryPolicy;
+import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.util.ClientOptions;
+import com.azure.core.util.Configuration;
+import com.azure.core.util.CoreUtils;
+import com.azure.core.util.builder.ClientBuilderUtil;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.serializer.JacksonAdapter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * A builder for creating a new instance of the DataApiClient type.
+ */
+@ServiceClientBuilder(
+ serviceClients = {
+ ApisClient.class,
+ ApiDefinitionsClient.class,
+ ApiDeploymentsClient.class,
+ EnvironmentsClient.class,
+ ApiVersionsClient.class,
+ ApisAsyncClient.class,
+ ApiDefinitionsAsyncClient.class,
+ ApiDeploymentsAsyncClient.class,
+ EnvironmentsAsyncClient.class,
+ ApiVersionsAsyncClient.class })
+public final class DataApiClientBuilder implements HttpTrait,
+ ConfigurationTrait, TokenCredentialTrait {
+ @Generated
+ private static final String SDK_NAME = "name";
+
+ @Generated
+ private static final String SDK_VERSION = "version";
+
+ @Generated
+ private static final String[] DEFAULT_SCOPES = new String[] { "https://azure-apicenter.net/user_impersonation" };
+
+ @Generated
+ private static final Map PROPERTIES = CoreUtils.getProperties("azure-apicenter.properties");
+
+ @Generated
+ private final List pipelinePolicies;
+
+ /**
+ * Create an instance of the DataApiClientBuilder.
+ */
+ @Generated
+ public DataApiClientBuilder() {
+ this.pipelinePolicies = new ArrayList<>();
+ }
+
+ /*
+ * The HTTP pipeline to send requests through.
+ */
+ @Generated
+ private HttpPipeline pipeline;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public DataApiClientBuilder 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 DataApiClientBuilder httpClient(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ /*
+ * The logging configuration for HTTP requests and responses.
+ */
+ @Generated
+ private HttpLogOptions httpLogOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public DataApiClientBuilder 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 DataApiClientBuilder 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 DataApiClientBuilder retryOptions(RetryOptions retryOptions) {
+ this.retryOptions = retryOptions;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public DataApiClientBuilder 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 DataApiClientBuilder configuration(Configuration configuration) {
+ this.configuration = configuration;
+ return this;
+ }
+
+ /*
+ * The TokenCredential used for authentication.
+ */
+ @Generated
+ private TokenCredential tokenCredential;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public DataApiClientBuilder credential(TokenCredential tokenCredential) {
+ this.tokenCredential = tokenCredential;
+ return this;
+ }
+
+ /*
+ * Region-unique API Center service name
+ */
+ @Generated
+ private String serviceName;
+
+ /**
+ * Sets Region-unique API Center service name.
+ *
+ * @param serviceName the serviceName value.
+ * @return the DataApiClientBuilder.
+ */
+ @Generated
+ public DataApiClientBuilder serviceName(String serviceName) {
+ this.serviceName = serviceName;
+ return this;
+ }
+
+ /*
+ * Region name
+ */
+ @Generated
+ private String region;
+
+ /**
+ * Sets Region name.
+ *
+ * @param region the region value.
+ * @return the DataApiClientBuilder.
+ */
+ @Generated
+ public DataApiClientBuilder region(String region) {
+ this.region = region;
+ return this;
+ }
+
+ /*
+ * Service version
+ */
+ @Generated
+ private DataApiServiceVersion serviceVersion;
+
+ /**
+ * Sets Service version.
+ *
+ * @param serviceVersion the serviceVersion value.
+ * @return the DataApiClientBuilder.
+ */
+ @Generated
+ public DataApiClientBuilder serviceVersion(DataApiServiceVersion 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 DataApiClientBuilder.
+ */
+ @Generated
+ public DataApiClientBuilder retryPolicy(RetryPolicy retryPolicy) {
+ this.retryPolicy = retryPolicy;
+ return this;
+ }
+
+ /**
+ * Builds an instance of DataApiClientImpl with the provided parameters.
+ *
+ * @return an instance of DataApiClientImpl.
+ */
+ @Generated
+ private DataApiClientImpl buildInnerClient() {
+ this.validateClient();
+ HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
+ DataApiServiceVersion localServiceVersion
+ = (serviceVersion != null) ? serviceVersion : DataApiServiceVersion.getLatest();
+ DataApiClientImpl client = new DataApiClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(),
+ this.serviceName, this.region, 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(serviceName, "'serviceName' cannot be null.");
+ Objects.requireNonNull(region, "'region' 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());
+ if (tokenCredential != null) {
+ policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES));
+ }
+ this.pipelinePolicies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
+ .forEach(p -> policies.add(p));
+ HttpPolicyProviders.addAfterRetryPolicies(policies);
+ policies.add(new HttpLoggingPolicy(localHttpLogOptions));
+ HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0]))
+ .httpClient(httpClient)
+ .clientOptions(localClientOptions)
+ .build();
+ return httpPipeline;
+ }
+
+ /**
+ * Builds an instance of ApisAsyncClient class.
+ *
+ * @return an instance of ApisAsyncClient.
+ */
+ @Generated
+ public ApisAsyncClient buildApisAsyncClient() {
+ return new ApisAsyncClient(buildInnerClient().getApis());
+ }
+
+ /**
+ * Builds an instance of ApiDefinitionsAsyncClient class.
+ *
+ * @return an instance of ApiDefinitionsAsyncClient.
+ */
+ @Generated
+ public ApiDefinitionsAsyncClient buildApiDefinitionsAsyncClient() {
+ return new ApiDefinitionsAsyncClient(buildInnerClient().getApiDefinitions());
+ }
+
+ /**
+ * Builds an instance of ApiDeploymentsAsyncClient class.
+ *
+ * @return an instance of ApiDeploymentsAsyncClient.
+ */
+ @Generated
+ public ApiDeploymentsAsyncClient buildApiDeploymentsAsyncClient() {
+ return new ApiDeploymentsAsyncClient(buildInnerClient().getApiDeployments());
+ }
+
+ /**
+ * Builds an instance of EnvironmentsAsyncClient class.
+ *
+ * @return an instance of EnvironmentsAsyncClient.
+ */
+ @Generated
+ public EnvironmentsAsyncClient buildEnvironmentsAsyncClient() {
+ return new EnvironmentsAsyncClient(buildInnerClient().getEnvironments());
+ }
+
+ /**
+ * Builds an instance of ApiVersionsAsyncClient class.
+ *
+ * @return an instance of ApiVersionsAsyncClient.
+ */
+ @Generated
+ public ApiVersionsAsyncClient buildApiVersionsAsyncClient() {
+ return new ApiVersionsAsyncClient(buildInnerClient().getApiVersions());
+ }
+
+ /**
+ * Builds an instance of ApisClient class.
+ *
+ * @return an instance of ApisClient.
+ */
+ @Generated
+ public ApisClient buildApisClient() {
+ return new ApisClient(buildInnerClient().getApis());
+ }
+
+ /**
+ * Builds an instance of ApiDefinitionsClient class.
+ *
+ * @return an instance of ApiDefinitionsClient.
+ */
+ @Generated
+ public ApiDefinitionsClient buildApiDefinitionsClient() {
+ return new ApiDefinitionsClient(buildInnerClient().getApiDefinitions());
+ }
+
+ /**
+ * Builds an instance of ApiDeploymentsClient class.
+ *
+ * @return an instance of ApiDeploymentsClient.
+ */
+ @Generated
+ public ApiDeploymentsClient buildApiDeploymentsClient() {
+ return new ApiDeploymentsClient(buildInnerClient().getApiDeployments());
+ }
+
+ /**
+ * Builds an instance of EnvironmentsClient class.
+ *
+ * @return an instance of EnvironmentsClient.
+ */
+ @Generated
+ public EnvironmentsClient buildEnvironmentsClient() {
+ return new EnvironmentsClient(buildInnerClient().getEnvironments());
+ }
+
+ /**
+ * Builds an instance of ApiVersionsClient class.
+ *
+ * @return an instance of ApiVersionsClient.
+ */
+ @Generated
+ public ApiVersionsClient buildApiVersionsClient() {
+ return new ApiVersionsClient(buildInnerClient().getApiVersions());
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(DataApiClientBuilder.class);
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/DataApiServiceVersion.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/DataApiServiceVersion.java
new file mode 100644
index 000000000000..9adfc8c14b15
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/DataApiServiceVersion.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.apicenter;
+
+import com.azure.core.util.ServiceVersion;
+
+/**
+ * Service version of DataApiClient.
+ */
+public enum DataApiServiceVersion implements ServiceVersion {
+ /**
+ * Enum value 2024-02-01-preview.
+ */
+ V2024_02_01_PREVIEW("2024-02-01-preview");
+
+ private final String version;
+
+ DataApiServiceVersion(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 DataApiServiceVersion}.
+ */
+ public static DataApiServiceVersion getLatest() {
+ return V2024_02_01_PREVIEW;
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/EnvironmentsAsyncClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/EnvironmentsAsyncClient.java
new file mode 100644
index 000000000000..16f64bdbf628
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/EnvironmentsAsyncClient.java
@@ -0,0 +1,345 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.EnvironmentsImpl;
+import com.azure.apicenter.models.Environment;
+import com.azure.apicenter.models.PagedEnvironmentAll;
+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 java.util.stream.Collectors;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the asynchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class, isAsync = true)
+public final class EnvironmentsAsyncClient {
+ @Generated
+ private final EnvironmentsImpl serviceClient;
+
+ /**
+ * Initializes an instance of EnvironmentsAsyncClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ EnvironmentsAsyncClient(EnvironmentsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of environments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Environment items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux list(String workspaceName, RequestOptions requestOptions) {
+ return this.serviceClient.listAsync(workspaceName, requestOptions);
+ }
+
+ /**
+ * List a collection of environments across workspaces.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * value (Required): [
+ * (Required){
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * ]
+ * nextLink: 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 paged collection of Environment items across workspaces along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listAllWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.listAllWithResponseAsync(requestOptions);
+ }
+
+ /**
+ * Get an environment.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param environmentName Environment identifier.
+ * @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 an environment along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getWithResponse(String workspaceName, String environmentName,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getWithResponseAsync(workspaceName, environmentName, requestOptions);
+ }
+
+ /**
+ * List a collection of environments.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Environment items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux list(String workspaceName, Integer top, Integer skip) {
+ // Generated convenience method for list
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ PagedFlux pagedFluxResponse = list(workspaceName, 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(Environment.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * List a collection of environments.
+ *
+ * @param workspaceName Workspace identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Environment items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux list(String workspaceName) {
+ // Generated convenience method for list
+ RequestOptions requestOptions = new RequestOptions();
+ PagedFlux pagedFluxResponse = list(workspaceName, 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(Environment.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * List a collection of environments across workspaces.
+ *
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @param maxPageSize The maximum number of result items per page.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Environment items across workspaces on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listAll(Integer top, Integer skip, Integer maxPageSize) {
+ // Generated convenience method for listAllWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ if (maxPageSize != null) {
+ requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false);
+ }
+ return listAllWithResponse(requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(PagedEnvironmentAll.class));
+ }
+
+ /**
+ * List a collection of environments across workspaces.
+ *
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Environment items across workspaces on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono listAll() {
+ // Generated convenience method for listAllWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listAllWithResponse(requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(PagedEnvironmentAll.class));
+ }
+
+ /**
+ * Get an environment.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param environmentName Environment identifier.
+ * @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 an environment on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono get(String workspaceName, String environmentName) {
+ // Generated convenience method for getWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getWithResponse(workspaceName, environmentName, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(Environment.class));
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/EnvironmentsClient.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/EnvironmentsClient.java
new file mode 100644
index 000000000000..270ba848874e
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/EnvironmentsClient.java
@@ -0,0 +1,313 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter;
+
+import com.azure.apicenter.implementation.EnvironmentsImpl;
+import com.azure.apicenter.models.Environment;
+import com.azure.apicenter.models.PagedEnvironmentAll;
+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;
+
+/**
+ * Initializes a new instance of the synchronous DataApiClient type.
+ */
+@ServiceClient(builder = DataApiClientBuilder.class)
+public final class EnvironmentsClient {
+ @Generated
+ private final EnvironmentsImpl serviceClient;
+
+ /**
+ * Initializes an instance of EnvironmentsClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ EnvironmentsClient(EnvironmentsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * List a collection of environments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Environment items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(String workspaceName, RequestOptions requestOptions) {
+ return this.serviceClient.list(workspaceName, requestOptions);
+ }
+
+ /**
+ * List a collection of environments across workspaces.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * value (Required): [
+ * (Required){
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * ]
+ * nextLink: 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 paged collection of Environment items across workspaces along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listAllWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.listAllWithResponse(requestOptions);
+ }
+
+ /**
+ * Get an environment.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param environmentName Environment identifier.
+ * @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 an environment along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWithResponse(String workspaceName, String environmentName,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getWithResponse(workspaceName, environmentName, requestOptions);
+ }
+
+ /**
+ * List a collection of environments.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Environment items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(String workspaceName, Integer top, Integer skip) {
+ // Generated convenience method for list
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ return serviceClient.list(workspaceName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(Environment.class));
+ }
+
+ /**
+ * List a collection of environments.
+ *
+ * @param workspaceName Workspace identifier.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Environment items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(String workspaceName) {
+ // Generated convenience method for list
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.list(workspaceName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(Environment.class));
+ }
+
+ /**
+ * List a collection of environments across workspaces.
+ *
+ * @param top The number of result items to return.
+ * @param skip The number of result items to skip.
+ * @param maxPageSize The maximum number of result items per page.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Environment items across workspaces.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public PagedEnvironmentAll listAll(Integer top, Integer skip, Integer maxPageSize) {
+ // Generated convenience method for listAllWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (top != null) {
+ requestOptions.addQueryParam("top", String.valueOf(top), false);
+ }
+ if (skip != null) {
+ requestOptions.addQueryParam("skip", String.valueOf(skip), false);
+ }
+ if (maxPageSize != null) {
+ requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false);
+ }
+ return listAllWithResponse(requestOptions).getValue().toObject(PagedEnvironmentAll.class);
+ }
+
+ /**
+ * List a collection of environments across workspaces.
+ *
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return paged collection of Environment items across workspaces.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public PagedEnvironmentAll listAll() {
+ // Generated convenience method for listAllWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return listAllWithResponse(requestOptions).getValue().toObject(PagedEnvironmentAll.class);
+ }
+
+ /**
+ * Get an environment.
+ *
+ * @param workspaceName Workspace identifier.
+ * @param environmentName Environment identifier.
+ * @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 an environment.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Environment get(String workspaceName, String environmentName) {
+ // Generated convenience method for getWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getWithResponse(workspaceName, environmentName, requestOptions).getValue().toObject(Environment.class);
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApiDefinitionsImpl.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApiDefinitionsImpl.java
new file mode 100644
index 000000000000..fd956435c6fb
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApiDefinitionsImpl.java
@@ -0,0 +1,1046 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter.implementation;
+
+import com.azure.apicenter.DataApiServiceVersion;
+import com.azure.apicenter.models.ApiSpecExportResult;
+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.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.UrlBuilder;
+import com.azure.core.util.polling.PollOperationDetails;
+import com.azure.core.util.polling.PollerFlux;
+import com.azure.core.util.polling.PollingStrategyOptions;
+import com.azure.core.util.polling.SyncPoller;
+import com.azure.core.util.serializer.TypeReference;
+import java.time.Duration;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import reactor.core.publisher.Mono;
+
+/**
+ * An instance of this class provides access to all the operations defined in ApiDefinitions.
+ */
+public final class ApiDefinitionsImpl {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final ApiDefinitionsService service;
+
+ /**
+ * The service client containing this operation class.
+ */
+ private final DataApiClientImpl client;
+
+ /**
+ * Initializes an instance of ApiDefinitionsImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ ApiDefinitionsImpl(DataApiClientImpl client) {
+ this.service
+ = RestProxy.create(ApiDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * Gets Service version.
+ *
+ * @return the serviceVersion value.
+ */
+ public DataApiServiceVersion getServiceVersion() {
+ return client.getServiceVersion();
+ }
+
+ /**
+ * The interface defining all the services for DataApiClientApiDefinitions to be used by the proxy service to
+ * perform REST calls.
+ */
+ @Host("https://{serviceName}.data.{region}.azure-apicenter.ms")
+ @ServiceInterface(name = "DataApiClientApiDefi")
+ public interface ApiDefinitionsService {
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listDefinitions(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listDefinitionsSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getDefinition(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getDefinitionSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/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> getExportSpecificationOperationStatus(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName,
+ @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/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 getExportSpecificationOperationStatusSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName,
+ @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}:exportSpecification")
+ @ExpectedResponses({ 202 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> exportSpecification(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Post("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}:exportSpecification")
+ @ExpectedResponses({ 202 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response exportSpecificationSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName,
+ @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> listDefinitionsNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("{nextLink}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listDefinitionsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+ }
+
+ /**
+ * List a collection of API definitions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDefinition items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listDefinitionsSinglePageAsync(String workspaceName, String apiName,
+ String versionName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listDefinitions(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, versionName, accept,
+ requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * List a collection of API definitions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDefinition items as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDefinitionsAsync(String workspaceName, String apiName, String versionName,
+ RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedFlux<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listDefinitionsSinglePageAsync(workspaceName, apiName, versionName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listDefinitionsNextSinglePageAsync(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * List a collection of API definitions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDefinition items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listDefinitionsSinglePage(String workspaceName, String apiName,
+ String versionName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listDefinitionsSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, versionName, accept, requestOptions,
+ Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ /**
+ * List a collection of API definitions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDefinition items as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDefinitions(String workspaceName, String apiName, String versionName,
+ RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedIterable<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listDefinitionsSinglePage(workspaceName, apiName, versionName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listDefinitionsNextSinglePage(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * Get an API definition.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName Definition identifier.
+ * @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 an API definition along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getDefinitionWithResponseAsync(String workspaceName, String apiName,
+ String versionName, String definitionName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.getDefinition(this.client.getServiceName(),
+ this.client.getRegion(), this.client.getServiceVersion().getVersion(), workspaceName, apiName, versionName,
+ definitionName, accept, requestOptions, context));
+ }
+
+ /**
+ * Get an API definition.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName Definition identifier.
+ * @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 an API definition along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getDefinitionWithResponse(String workspaceName, String apiName, String versionName,
+ String definitionName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getDefinitionSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, versionName, definitionName, accept,
+ requestOptions, Context.NONE);
+ }
+
+ /**
+ * Gets status of a an API specification export operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param operationId The unique ID of the operation.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return status of a an API specification export operation along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getExportSpecificationOperationStatusWithResponseAsync(String workspaceName,
+ String apiName, String versionName, String definitionName, String operationId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.getExportSpecificationOperationStatus(this.client.getServiceName(),
+ this.client.getRegion(), this.client.getServiceVersion().getVersion(), workspaceName, apiName,
+ versionName, definitionName, operationId, accept, requestOptions, context));
+ }
+
+ /**
+ * Gets status of a an API specification export operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param operationId The unique ID of the operation.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return status of a an API specification export operation along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getExportSpecificationOperationStatusWithResponse(String workspaceName, String apiName,
+ String versionName, String definitionName, String operationId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getExportSpecificationOperationStatusSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, versionName, definitionName,
+ operationId, accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @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 provides status details for long running operations along with {@link Response} on successful completion
+ * of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> exportSpecificationWithResponseAsync(String workspaceName, String apiName,
+ String versionName, String definitionName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.exportSpecification(this.client.getServiceName(),
+ this.client.getRegion(), this.client.getServiceVersion().getVersion(), workspaceName, apiName, versionName,
+ definitionName, accept, requestOptions, context));
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @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 provides status details for long running operations along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response exportSpecificationWithResponse(String workspaceName, String apiName,
+ String versionName, String definitionName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.exportSpecificationSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, versionName, definitionName, accept,
+ requestOptions, Context.NONE);
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginExportSpecificationAsync(String workspaceName, String apiName,
+ String versionName, String definitionName, RequestOptions requestOptions) {
+ return PollerFlux.create(Duration.ofSeconds(1),
+ () -> this.exportSpecificationWithResponseAsync(workspaceName, apiName, versionName, definitionName,
+ requestOptions),
+ new com.azure.apicenter.implementation.OperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.client.getHttpPipeline())
+
+ .setContext(requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)
+ .setServiceVersion(this.client.getServiceVersion().getVersion()),
+ "result"),
+ TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class));
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginExportSpecification(String workspaceName, String apiName,
+ String versionName, String definitionName, RequestOptions requestOptions) {
+ return SyncPoller.createPoller(Duration.ofSeconds(1),
+ () -> this.exportSpecificationWithResponse(workspaceName, apiName, versionName, definitionName,
+ requestOptions),
+ new com.azure.apicenter.implementation.SyncOperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.client.getHttpPipeline())
+
+ .setContext(requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)
+ .setServiceVersion(this.client.getServiceVersion().getVersion()),
+ "result"),
+ TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class));
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginExportSpecificationWithModelAsync(
+ String workspaceName, String apiName, String versionName, String definitionName,
+ RequestOptions requestOptions) {
+ return PollerFlux.create(Duration.ofSeconds(1),
+ () -> this.exportSpecificationWithResponseAsync(workspaceName, apiName, versionName, definitionName,
+ requestOptions),
+ new com.azure.apicenter.implementation.OperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.client.getHttpPipeline())
+
+ .setContext(requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)
+ .setServiceVersion(this.client.getServiceVersion().getVersion()),
+ "result"),
+ TypeReference.createInstance(PollOperationDetails.class),
+ TypeReference.createInstance(ApiSpecExportResult.class));
+ }
+
+ /**
+ * Export an API specification asynchronously.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * result (Optional): {
+ * definitionName: String (Required)
+ * value: String (Required)
+ * format: String(link) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @param definitionName API definition identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginExportSpecificationWithModel(String workspaceName,
+ String apiName, String versionName, String definitionName, RequestOptions requestOptions) {
+ return SyncPoller.createPoller(Duration.ofSeconds(1),
+ () -> this.exportSpecificationWithResponse(workspaceName, apiName, versionName, definitionName,
+ requestOptions),
+ new com.azure.apicenter.implementation.SyncOperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.client.getHttpPipeline())
+
+ .setContext(requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)
+ .setServiceVersion(this.client.getServiceVersion().getVersion()),
+ "result"),
+ TypeReference.createInstance(PollOperationDetails.class),
+ TypeReference.createInstance(ApiSpecExportResult.class));
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of ApiDefinition items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listDefinitionsNextSinglePageAsync(String nextLink,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listDefinitionsNext(nextLink, this.client.getServiceName(),
+ this.client.getRegion(), accept, requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * specification (Optional): {
+ * name: String (Required)
+ * version: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of ApiDefinition items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listDefinitionsNextSinglePage(String nextLink, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listDefinitionsNextSync(nextLink, this.client.getServiceName(),
+ this.client.getRegion(), accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ private List getValues(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ List> values = (List>) obj.get(path);
+ return values.stream().map(BinaryData::fromObject).collect(Collectors.toList());
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+
+ private String getNextLink(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ return (String) obj.get(path);
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApiDeploymentsImpl.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApiDeploymentsImpl.java
new file mode 100644
index 000000000000..de86c2a9942b
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApiDeploymentsImpl.java
@@ -0,0 +1,578 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter.implementation;
+
+import com.azure.apicenter.DataApiServiceVersion;
+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.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.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.UrlBuilder;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import reactor.core.publisher.Mono;
+
+/**
+ * An instance of this class provides access to all the operations defined in ApiDeployments.
+ */
+public final class ApiDeploymentsImpl {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final ApiDeploymentsService service;
+
+ /**
+ * The service client containing this operation class.
+ */
+ private final DataApiClientImpl client;
+
+ /**
+ * Initializes an instance of ApiDeploymentsImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ ApiDeploymentsImpl(DataApiClientImpl client) {
+ this.service
+ = RestProxy.create(ApiDeploymentsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * Gets Service version.
+ *
+ * @return the serviceVersion value.
+ */
+ public DataApiServiceVersion getServiceVersion() {
+ return client.getServiceVersion();
+ }
+
+ /**
+ * The interface defining all the services for DataApiClientApiDeployments to be used by the proxy service to
+ * perform REST calls.
+ */
+ @Host("https://{serviceName}.data.{region}.azure-apicenter.ms")
+ @ServiceInterface(name = "DataApiClientApiDepl")
+ public interface ApiDeploymentsService {
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/deployments")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listDeployments(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/deployments")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listDeploymentsSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getDeployment(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("deploymentName") String deploymentName, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getDeploymentSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("deploymentName") String deploymentName, @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> listDeploymentsNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("{nextLink}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listDeploymentsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+ }
+
+ /**
+ * List a collection of API deployments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDeployment items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listDeploymentsSinglePageAsync(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listDeployments(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, accept, requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * List a collection of API deployments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDeployment items as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listDeploymentsAsync(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedFlux<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listDeploymentsSinglePageAsync(workspaceName, apiName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listDeploymentsNextSinglePageAsync(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * List a collection of API deployments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDeployment items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listDeploymentsSinglePage(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listDeploymentsSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ /**
+ * List a collection of API deployments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiDeployment items as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listDeployments(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedIterable<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listDeploymentsSinglePage(workspaceName, apiName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listDeploymentsNextSinglePage(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * Get an API deployment.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param deploymentName Deployment identifier.
+ * @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 an API deployment along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getDeploymentWithResponseAsync(String workspaceName, String apiName,
+ String deploymentName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.getDeployment(this.client.getServiceName(),
+ this.client.getRegion(), this.client.getServiceVersion().getVersion(), workspaceName, apiName,
+ deploymentName, accept, requestOptions, context));
+ }
+
+ /**
+ * Get an API deployment.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param deploymentName Deployment identifier.
+ * @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 an API deployment along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getDeploymentWithResponse(String workspaceName, String apiName, String deploymentName,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getDeploymentSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, deploymentName, accept,
+ requestOptions, Context.NONE);
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of ApiDeployment items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listDeploymentsNextSinglePageAsync(String nextLink,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listDeploymentsNext(nextLink, this.client.getServiceName(),
+ this.client.getRegion(), accept, requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * description: String (Optional)
+ * environment: String (Required)
+ * server (Required): {
+ * runtimeUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * recommended: Boolean (Optional)
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of ApiDeployment items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listDeploymentsNextSinglePage(String nextLink, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listDeploymentsNextSync(nextLink, this.client.getServiceName(),
+ this.client.getRegion(), accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ private List getValues(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ List> values = (List>) obj.get(path);
+ return values.stream().map(BinaryData::fromObject).collect(Collectors.toList());
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+
+ private String getNextLink(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ return (String) obj.get(path);
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApiVersionsImpl.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApiVersionsImpl.java
new file mode 100644
index 000000000000..4b561021cd4e
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApiVersionsImpl.java
@@ -0,0 +1,505 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter.implementation;
+
+import com.azure.apicenter.DataApiServiceVersion;
+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.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.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.UrlBuilder;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import reactor.core.publisher.Mono;
+
+/**
+ * An instance of this class provides access to all the operations defined in ApiVersions.
+ */
+public final class ApiVersionsImpl {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final ApiVersionsService service;
+
+ /**
+ * The service client containing this operation class.
+ */
+ private final DataApiClientImpl client;
+
+ /**
+ * Initializes an instance of ApiVersionsImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ ApiVersionsImpl(DataApiClientImpl client) {
+ this.service
+ = RestProxy.create(ApiVersionsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * Gets Service version.
+ *
+ * @return the serviceVersion value.
+ */
+ public DataApiServiceVersion getServiceVersion() {
+ return client.getServiceVersion();
+ }
+
+ /**
+ * The interface defining all the services for DataApiClientApiVersions to be used by the proxy service to perform
+ * REST calls.
+ */
+ @Host("https://{serviceName}.data.{region}.azure-apicenter.ms")
+ @ServiceInterface(name = "DataApiClientApiVers")
+ public interface ApiVersionsService {
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listVersions(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listVersionsSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getVersion(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getVersionSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName,
+ @PathParam("versionName") String versionName, @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> listVersionsNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("{nextLink}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listVersionsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+ }
+
+ /**
+ * List a collection of API versions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiVersion items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listVersionsSinglePageAsync(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listVersions(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, accept, requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * List a collection of API versions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiVersion items as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listVersionsAsync(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedFlux<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listVersionsSinglePageAsync(workspaceName, apiName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listVersionsNextSinglePageAsync(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * List a collection of API versions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiVersion items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listVersionsSinglePage(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listVersionsSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ /**
+ * List a collection of API versions.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of ApiVersion items as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listVersions(String workspaceName, String apiName, RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedIterable<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listVersionsSinglePage(workspaceName, apiName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listVersionsNextSinglePage(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * Get an API version.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @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 an API version along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getVersionWithResponseAsync(String workspaceName, String apiName,
+ String versionName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.getVersion(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, versionName, accept, requestOptions,
+ context));
+ }
+
+ /**
+ * Get an API version.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @param versionName Version identifier.
+ * @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 an API version along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getVersionWithResponse(String workspaceName, String apiName, String versionName,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getVersionSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, versionName, accept, requestOptions,
+ Context.NONE);
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of ApiVersion items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listVersionsNextSinglePageAsync(String nextLink,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listVersionsNext(nextLink, this.client.getServiceName(),
+ this.client.getRegion(), accept, requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Required)
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of ApiVersion items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listVersionsNextSinglePage(String nextLink, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listVersionsNextSync(nextLink, this.client.getServiceName(),
+ this.client.getRegion(), accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ private List getValues(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ List> values = (List>) obj.get(path);
+ return values.stream().map(BinaryData::fromObject).collect(Collectors.toList());
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+
+ private String getNextLink(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ return (String) obj.get(path);
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApisImpl.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApisImpl.java
new file mode 100644
index 000000000000..f20c3b06140a
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/ApisImpl.java
@@ -0,0 +1,871 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter.implementation;
+
+import com.azure.apicenter.DataApiServiceVersion;
+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.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.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.UrlBuilder;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import reactor.core.publisher.Mono;
+
+/**
+ * An instance of this class provides access to all the operations defined in Apis.
+ */
+public final class ApisImpl {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final ApisService service;
+
+ /**
+ * The service client containing this operation class.
+ */
+ private final DataApiClientImpl client;
+
+ /**
+ * Initializes an instance of ApisImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ ApisImpl(DataApiClientImpl client) {
+ this.service = RestProxy.create(ApisService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * Gets Service version.
+ *
+ * @return the serviceVersion value.
+ */
+ public DataApiServiceVersion getServiceVersion() {
+ return client.getServiceVersion();
+ }
+
+ /**
+ * The interface defining all the services for DataApiClientApis to be used by the proxy service to perform REST
+ * calls.
+ */
+ @Host("https://{serviceName}.data.{region}.azure-apicenter.ms")
+ @ServiceInterface(name = "DataApiClientApis")
+ public interface ApisService {
+ @Get("/workspaces/{workspaceName}/apis")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> list(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listSync(@HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion, @PathParam("workspaceName") String workspaceName,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/apis")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listAll(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/apis")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listAllSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> get(@HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion, @PathParam("workspaceName") String workspaceName,
+ @PathParam("apiName") String apiName, @HeaderParam("Accept") String accept, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/workspaces/{workspaceName}/apis/{apiName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getSync(@HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion, @PathParam("workspaceName") String workspaceName,
+ @PathParam("apiName") String apiName, @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> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("{nextLink}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+ }
+
+ /**
+ * List a collection of APIs.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Api items along with {@link PagedResponse} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync(String workspaceName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.list(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, accept, requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * List a collection of APIs.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Api items as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listAsync(String workspaceName, RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedFlux<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listSinglePageAsync(workspaceName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listNextSinglePageAsync(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * List a collection of APIs.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Api items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listSinglePage(String workspaceName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ /**
+ * List a collection of APIs.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Api items as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(String workspaceName, RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedIterable<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listSinglePage(workspaceName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listNextSinglePage(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * List a collection of APIs across workspaces.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * value (Required): [
+ * (Required){
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * ]
+ * nextLink: 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 paged collection of API items across workspaces along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listAllWithResponseAsync(RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.listAll(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), accept, requestOptions, context));
+ }
+
+ /**
+ * List a collection of APIs across workspaces.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * value (Required): [
+ * (Required){
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * ]
+ * nextLink: 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 paged collection of API items across workspaces along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listAllWithResponse(RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.listAllSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Get an API.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @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 an API along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getWithResponseAsync(String workspaceName, String apiName,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.get(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, accept, requestOptions, context));
+ }
+
+ /**
+ * Get an API.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param apiName Api identifier.
+ * @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 an API along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWithResponse(String workspaceName, String apiName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, apiName, accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of Api items along with {@link PagedResponse} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listNext(nextLink, this.client.getServiceName(), this.client.getRegion(),
+ accept, requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * summary: String (Optional)
+ * description: String (Optional)
+ * kind: String(rest/graphql/grpc/soap/webhook/websocket) (Required)
+ * lifecycleStage: String(design/development/testing/preview/production/deprecated/retired) (Optional)
+ * termsOfService (Optional): {
+ * url: String (Required)
+ * }
+ * license (Optional): {
+ * name: String (Required)
+ * url: String (Optional)
+ * identifier: String (Optional)
+ * }
+ * externalDocumentation (Optional): [
+ * (Optional){
+ * title: String (Required)
+ * description: String (Required)
+ * url: String (Required)
+ * }
+ * ]
+ * contacts (Optional): [
+ * (Optional){
+ * name: String (Required)
+ * url: String (Optional)
+ * email: String (Optional)
+ * }
+ * ]
+ * customProperties (Optional): {
+ * }
+ * lastUpdated: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of Api items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listNextSync(nextLink, this.client.getServiceName(), this.client.getRegion(),
+ accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ private List getValues(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ List> values = (List>) obj.get(path);
+ return values.stream().map(BinaryData::fromObject).collect(Collectors.toList());
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+
+ private String getNextLink(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ return (String) obj.get(path);
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/DataApiClientImpl.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/DataApiClientImpl.java
new file mode 100644
index 000000000000..6f63f6345939
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/DataApiClientImpl.java
@@ -0,0 +1,206 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter.implementation;
+
+import com.azure.apicenter.DataApiServiceVersion;
+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.util.serializer.JacksonAdapter;
+import com.azure.core.util.serializer.SerializerAdapter;
+
+/**
+ * Initializes a new instance of the DataApiClient type.
+ */
+public final class DataApiClientImpl {
+ /**
+ * Region-unique API Center service name.
+ */
+ private final String serviceName;
+
+ /**
+ * Gets Region-unique API Center service name.
+ *
+ * @return the serviceName value.
+ */
+ public String getServiceName() {
+ return this.serviceName;
+ }
+
+ /**
+ * Region name.
+ */
+ private final String region;
+
+ /**
+ * Gets Region name.
+ *
+ * @return the region value.
+ */
+ public String getRegion() {
+ return this.region;
+ }
+
+ /**
+ * Service version.
+ */
+ private final DataApiServiceVersion serviceVersion;
+
+ /**
+ * Gets Service version.
+ *
+ * @return the serviceVersion value.
+ */
+ public DataApiServiceVersion 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;
+ }
+
+ /**
+ * The ApisImpl object to access its operations.
+ */
+ private final ApisImpl apis;
+
+ /**
+ * Gets the ApisImpl object to access its operations.
+ *
+ * @return the ApisImpl object.
+ */
+ public ApisImpl getApis() {
+ return this.apis;
+ }
+
+ /**
+ * The ApiDefinitionsImpl object to access its operations.
+ */
+ private final ApiDefinitionsImpl apiDefinitions;
+
+ /**
+ * Gets the ApiDefinitionsImpl object to access its operations.
+ *
+ * @return the ApiDefinitionsImpl object.
+ */
+ public ApiDefinitionsImpl getApiDefinitions() {
+ return this.apiDefinitions;
+ }
+
+ /**
+ * The ApiDeploymentsImpl object to access its operations.
+ */
+ private final ApiDeploymentsImpl apiDeployments;
+
+ /**
+ * Gets the ApiDeploymentsImpl object to access its operations.
+ *
+ * @return the ApiDeploymentsImpl object.
+ */
+ public ApiDeploymentsImpl getApiDeployments() {
+ return this.apiDeployments;
+ }
+
+ /**
+ * The EnvironmentsImpl object to access its operations.
+ */
+ private final EnvironmentsImpl environments;
+
+ /**
+ * Gets the EnvironmentsImpl object to access its operations.
+ *
+ * @return the EnvironmentsImpl object.
+ */
+ public EnvironmentsImpl getEnvironments() {
+ return this.environments;
+ }
+
+ /**
+ * The ApiVersionsImpl object to access its operations.
+ */
+ private final ApiVersionsImpl apiVersions;
+
+ /**
+ * Gets the ApiVersionsImpl object to access its operations.
+ *
+ * @return the ApiVersionsImpl object.
+ */
+ public ApiVersionsImpl getApiVersions() {
+ return this.apiVersions;
+ }
+
+ /**
+ * Initializes an instance of DataApiClient client.
+ *
+ * @param serviceName Region-unique API Center service name.
+ * @param region Region name.
+ * @param serviceVersion Service version.
+ */
+ public DataApiClientImpl(String serviceName, String region, DataApiServiceVersion serviceVersion) {
+ this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(),
+ JacksonAdapter.createDefaultSerializerAdapter(), serviceName, region, serviceVersion);
+ }
+
+ /**
+ * Initializes an instance of DataApiClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param serviceName Region-unique API Center service name.
+ * @param region Region name.
+ * @param serviceVersion Service version.
+ */
+ public DataApiClientImpl(HttpPipeline httpPipeline, String serviceName, String region,
+ DataApiServiceVersion serviceVersion) {
+ this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), serviceName, region, serviceVersion);
+ }
+
+ /**
+ * Initializes an instance of DataApiClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param serializerAdapter The serializer to serialize an object into a string.
+ * @param serviceName Region-unique API Center service name.
+ * @param region Region name.
+ * @param serviceVersion Service version.
+ */
+ public DataApiClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String serviceName,
+ String region, DataApiServiceVersion serviceVersion) {
+ this.httpPipeline = httpPipeline;
+ this.serializerAdapter = serializerAdapter;
+ this.serviceName = serviceName;
+ this.region = region;
+ this.serviceVersion = serviceVersion;
+ this.apis = new ApisImpl(this);
+ this.apiDefinitions = new ApiDefinitionsImpl(this);
+ this.apiDeployments = new ApiDeploymentsImpl(this);
+ this.environments = new EnvironmentsImpl(this);
+ this.apiVersions = new ApiVersionsImpl(this);
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/EnvironmentsImpl.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/EnvironmentsImpl.java
new file mode 100644
index 000000000000..d499a54aad38
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/EnvironmentsImpl.java
@@ -0,0 +1,747 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter.implementation;
+
+import com.azure.apicenter.DataApiServiceVersion;
+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.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.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.UrlBuilder;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import reactor.core.publisher.Mono;
+
+/**
+ * An instance of this class provides access to all the operations defined in Environments.
+ */
+public final class EnvironmentsImpl {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final EnvironmentsService service;
+
+ /**
+ * The service client containing this operation class.
+ */
+ private final DataApiClientImpl client;
+
+ /**
+ * Initializes an instance of EnvironmentsImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ EnvironmentsImpl(DataApiClientImpl client) {
+ this.service
+ = RestProxy.create(EnvironmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * Gets Service version.
+ *
+ * @return the serviceVersion value.
+ */
+ public DataApiServiceVersion getServiceVersion() {
+ return client.getServiceVersion();
+ }
+
+ /**
+ * The interface defining all the services for DataApiClientEnvironments to be used by the proxy service to perform
+ * REST calls.
+ */
+ @Host("https://{serviceName}.data.{region}.azure-apicenter.ms")
+ @ServiceInterface(name = "DataApiClientEnviron")
+ public interface EnvironmentsService {
+ @Get("/workspaces/{workspaceName}/environments")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> list(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @PathParam("workspaceName") String workspaceName, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/environments")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listSync(@HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion, @PathParam("workspaceName") String workspaceName,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/environments")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listAll(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/environments")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listAllSync(@HostParam("serviceName") String serviceName,
+ @HostParam("region") String region, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/environments/{environmentName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> get(@HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion, @PathParam("workspaceName") String workspaceName,
+ @PathParam("environmentName") String environmentName, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/workspaces/{workspaceName}/environments/{environmentName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getSync(@HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @QueryParam("api-version") String apiVersion, @PathParam("workspaceName") String workspaceName,
+ @PathParam("environmentName") String environmentName, @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> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("{nextLink}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
+ @HostParam("serviceName") String serviceName, @HostParam("region") String region,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+ }
+
+ /**
+ * List a collection of environments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Environment items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listSinglePageAsync(String workspaceName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.list(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, accept, requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * List a collection of environments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Environment items as paginated response with {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listAsync(String workspaceName, RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedFlux<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listSinglePageAsync(workspaceName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listNextSinglePageAsync(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * List a collection of environments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Environment items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listSinglePage(String workspaceName, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ /**
+ * List a collection of environments.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return paged collection of Environment items as paginated response with {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable list(String workspaceName, RequestOptions requestOptions) {
+ RequestOptions requestOptionsForNextPage = new RequestOptions();
+ requestOptionsForNextPage.setContext(
+ requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
+ return new PagedIterable<>((pageSize) -> {
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listSinglePage(workspaceName, requestOptionsLocal);
+ }, (nextLink, pageSize) -> {
+ RequestOptions requestOptionsLocal = new RequestOptions();
+ requestOptionsLocal.setContext(requestOptionsForNextPage.getContext());
+ if (pageSize != null) {
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl());
+ urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize));
+ requestLocal.setUrl(urlBuilder.toString());
+ });
+ }
+ return listNextSinglePage(nextLink, requestOptionsLocal);
+ });
+ }
+
+ /**
+ * List a collection of environments across workspaces.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * value (Required): [
+ * (Required){
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * ]
+ * nextLink: 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 paged collection of Environment items across workspaces along with {@link Response} on successful
+ * completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> listAllWithResponseAsync(RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.listAll(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), accept, requestOptions, context));
+ }
+
+ /**
+ * List a collection of environments across workspaces.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | top | Integer | No | The number of result items to return. |
+ * | skip | Integer | No | The number of result items to skip. |
+ * | maxpagesize | Integer | No | The maximum number of result items per page. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * value (Required): [
+ * (Required){
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * ]
+ * nextLink: 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 paged collection of Environment items across workspaces along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listAllWithResponse(RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.listAllSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Get an environment.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param environmentName Environment identifier.
+ * @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 an environment along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getWithResponseAsync(String workspaceName, String environmentName,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.get(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, environmentName, accept, requestOptions,
+ context));
+ }
+
+ /**
+ * Get an environment.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @param workspaceName Workspace identifier.
+ * @param environmentName Environment identifier.
+ * @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 an environment along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWithResponse(String workspaceName, String environmentName,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getSync(this.client.getServiceName(), this.client.getRegion(),
+ this.client.getServiceVersion().getVersion(), workspaceName, environmentName, accept, requestOptions,
+ Context.NONE);
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of Environment items along with {@link PagedResponse} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listNext(nextLink, this.client.getServiceName(), this.client.getRegion(),
+ accept, requestOptions, context))
+ .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
+ }
+
+ /**
+ * Get the next page of items.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * title: String (Required)
+ * kind: String(development/testing/staging/production) (Required)
+ * description: String (Optional)
+ * server (Optional): {
+ * type: String (Required)
+ * managementPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * onboarding (Optional): {
+ * instructions: String (Required)
+ * developerPortalUris (Required): [
+ * String (Required)
+ * ]
+ * }
+ * customProperties (Optional): {
+ * }
+ * }
+ * }
+ *
+ *
+ * @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 paged collection of Environment items along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ Response res = service.listNextSync(nextLink, this.client.getServiceName(), this.client.getRegion(),
+ accept, requestOptions, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
+ getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
+ }
+
+ private List getValues(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ List> values = (List>) obj.get(path);
+ return values.stream().map(BinaryData::fromObject).collect(Collectors.toList());
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+
+ private String getNextLink(BinaryData binaryData, String path) {
+ try {
+ Map, ?> obj = binaryData.toObject(Map.class);
+ return (String) obj.get(path);
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/OperationLocationPollingStrategy.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/OperationLocationPollingStrategy.java
new file mode 100644
index 000000000000..a7c58c208eed
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/OperationLocationPollingStrategy.java
@@ -0,0 +1,140 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter.implementation;
+
+import com.azure.core.exception.AzureException;
+import com.azure.core.http.HttpHeader;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.polling.LongRunningOperationStatus;
+import com.azure.core.util.polling.OperationResourcePollingStrategy;
+import com.azure.core.util.polling.PollResponse;
+import com.azure.core.util.polling.PollingContext;
+import com.azure.core.util.polling.PollingStrategyOptions;
+import com.azure.core.util.serializer.JsonSerializerProviders;
+import com.azure.core.util.serializer.ObjectSerializer;
+import com.azure.core.util.serializer.TypeReference;
+import java.time.Duration;
+import java.time.OffsetDateTime;
+import reactor.core.publisher.Mono;
+
+// DO NOT modify this helper class
+
+/**
+ * Implements an operation location polling strategy, from Operation-Location.
+ *
+ * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept
+ * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be
+ * kept
+ */
+public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy {
+
+ private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class);
+
+ private final ObjectSerializer serializer;
+ private final String endpoint;
+ private final String propertyName;
+
+ /**
+ * Creates an instance of the operation resource polling strategy.
+ *
+ * @param pollingStrategyOptions options to configure this polling strategy.
+ * @throws NullPointerException if {@code pollingStrategyOptions} is null.
+ */
+ public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) {
+ this(pollingStrategyOptions, null);
+ }
+
+ /**
+ * Creates an instance of the operation resource polling strategy.
+ *
+ * @param pollingStrategyOptions options to configure this polling strategy.
+ * @param propertyName the name of the property to extract final result.
+ * @throws NullPointerException if {@code pollingStrategyOptions} is null.
+ */
+ public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) {
+ super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions);
+ this.propertyName = propertyName;
+ this.endpoint = pollingStrategyOptions.getEndpoint();
+ this.serializer = pollingStrategyOptions.getSerializer() != null
+ ? pollingStrategyOptions.getSerializer()
+ : JsonSerializerProviders.createInstance(true);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Mono> onInitialResponse(Response> response, PollingContext pollingContext,
+ TypeReference pollResponseType) {
+ // Response> is Response
+
+ HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER);
+ if (operationLocationHeader != null) {
+ pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(),
+ PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER));
+ }
+ final String httpMethod = response.getRequest().getHttpMethod().name();
+ pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod);
+ pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString());
+
+ if (response.getStatusCode() == 200
+ || response.getStatusCode() == 201
+ || response.getStatusCode() == 202
+ || response.getStatusCode() == 204) {
+ final Duration retryAfter
+ = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now);
+ final Mono> pollResponseMono
+ = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType)
+ .onErrorResume(exception -> {
+ LOGGER.info("Failed to parse initial response.");
+ return Mono.empty();
+ })
+ .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter));
+ return pollResponseMono.switchIfEmpty(
+ Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter)));
+ } else {
+ return Mono
+ .error(
+ new AzureException(String.format(
+ "Operation failed or cancelled with status code %d,"
+ + ", '%s' header: %s, and response body: %s",
+ response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader,
+ response.getValue())));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Mono getResult(PollingContext pollingContext, TypeReference resultType) {
+ if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) {
+ return Mono.error(new AzureException("Long running operation failed."));
+ } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) {
+ return Mono.error(new AzureException("Long running operation cancelled."));
+ }
+ if (propertyName != null) {
+ // take the last poll response body from PollingContext,
+ // and de-serialize the property as final result
+ BinaryData latestResponseBody
+ = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY));
+ return PollingUtils
+ .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE)
+ .flatMap(value -> {
+ if (value.get(propertyName) != null) {
+ return BinaryData.fromObjectAsync(value.get(propertyName))
+ .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType));
+ } else {
+ return Mono.error(new AzureException("Cannot get final result"));
+ }
+ })
+ .switchIfEmpty(Mono.error(new AzureException("Cannot get final result")));
+ } else {
+ return super.getResult(pollingContext, resultType);
+ }
+ }
+}
diff --git a/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/PollingUtils.java b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/PollingUtils.java
new file mode 100644
index 000000000000..514363a78afe
--- /dev/null
+++ b/sdk/apicenter/azure-apicenter/src/main/java/com/azure/apicenter/implementation/PollingUtils.java
@@ -0,0 +1,151 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.apicenter.implementation;
+
+import com.azure.core.http.HttpHeaderName;
+import com.azure.core.http.HttpHeaders;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.CoreUtils;
+import com.azure.core.util.DateTimeRfc1123;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.serializer.ObjectSerializer;
+import com.azure.core.util.serializer.TypeReference;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.time.DateTimeException;
+import java.time.Duration;
+import java.time.OffsetDateTime;
+import java.time.temporal.ChronoUnit;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import reactor.core.publisher.Mono;
+
+// DO NOT modify this helper class
+
+final class PollingUtils {
+
+ public static final TypeReference