diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt
index b04d701dd93c..841e61d8b3bd 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.22.0;5.23.0-
com.azure.spring:spring-cloud-azure-stream-binder-servicebus;5.22.0;5.23.0-beta.1
com.azure.spring:spring-cloud-azure-testcontainers;5.22.0;5.23.0-beta.1
com.azure:azure-spring-data-cosmos;5.22.0;5.23.0-beta.1
+com.azure:azure-contoso-widgetmanager;1.0.0-beta.1;1.0.0-beta.1
com.azure.resourcemanager:azure-resourcemanager;2.50.0;2.51.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-appplatform;2.50.0;2.51.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-appservice;2.50.0;2.51.0-beta.1
diff --git a/pom.xml b/pom.xml
index 59226c65adf6..d8b92ebe78dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,6 +56,7 @@
sdk/containerregistry
sdk/containerservicefleet
sdk/contentsafety
+ sdk/contosowidgetmanager
sdk/core
sdk/core-v2
sdk/cosmos
diff --git a/sdk/contosowidgetmanager/azure-contoso-widgetmanager/CHANGELOG.md b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/CHANGELOG.md
new file mode 100644
index 000000000000..9e6ba8507db7
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/CHANGELOG.md
@@ -0,0 +1,16 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+- Azure WidgetManager client library for Java. This package contains Microsoft Azure WidgetManager client library.
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
+### Features Added
+
+- Initial release for the azure-contoso-widgetmanager Java SDK.
diff --git a/sdk/contosowidgetmanager/azure-contoso-widgetmanager/README.md b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/README.md
new file mode 100644
index 000000000000..3cdbd1ce8230
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/README.md
@@ -0,0 +1,78 @@
+# Azure WidgetManager client library for Java
+
+Azure WidgetManager client library for Java.
+
+This package contains Microsoft Azure WidgetManager 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-contoso-widgetmanager;current})
+```xml
+
+ com.azure
+ azure-contoso-widgetmanager
+ 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.contoso.widgetmanager.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/contosowidgetmanager/azure-contoso-widgetmanager/assets.json b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/assets.json
new file mode 100644
index 000000000000..1212b5827a4c
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/assets.json
@@ -0,0 +1 @@
+{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/contosowidgetmanager/azure-contoso-widgetmanager","Tag":""}
\ No newline at end of file
diff --git a/sdk/contosowidgetmanager/azure-contoso-widgetmanager/pom.xml b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/pom.xml
new file mode 100644
index 000000000000..212bea32f734
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/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-contoso-widgetmanager
+ 1.0.0-beta.1
+ jar
+
+ Microsoft Azure SDK for WidgetManager
+ This package contains Microsoft Azure WidgetManager 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/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerAsyncClient.java b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerAsyncClient.java
new file mode 100644
index 000000000000..1ac78e7fda28
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerAsyncClient.java
@@ -0,0 +1,368 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.contoso.widgetmanager;
+
+import com.azure.contoso.widgetmanager.implementation.JsonMergePatchHelper;
+import com.azure.contoso.widgetmanager.implementation.WidgetsImpl;
+import com.azure.contoso.widgetmanager.models.ResourceOperationStatusWidgetSuiteWidgetSuiteError;
+import com.azure.contoso.widgetmanager.models.WidgetSuite;
+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 WidgetManagerClient type.
+ */
+@ServiceClient(builder = WidgetManagerClientBuilder.class, isAsync = true)
+public final class WidgetManagerAsyncClient {
+ @Generated
+ private final WidgetsImpl serviceClient;
+
+ /**
+ * Initializes an instance of WidgetManagerAsyncClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ WidgetManagerAsyncClient(WidgetsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Fetch a Widget by name.
+ *
Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param widgetName The widget name.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a widget along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getWidgetWithResponse(String widgetName, RequestOptions requestOptions) {
+ return this.serviceClient.getWidgetWithResponseAsync(widgetName, requestOptions);
+ }
+
+ /**
+ * Gets status of a Widget 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): {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ * }
+ *
+ *
+ * @param widgetName The widget name.
+ * @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 Widget operation along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getWidgetOperationStatusWithResponse(String widgetName, String operationId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getWidgetOperationStatusWithResponseAsync(widgetName, operationId, requestOptions);
+ }
+
+ /**
+ * Creates or updates a Widget asynchronously.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param widgetName The widget name.
+ * @param resource The resource instance.
+ * @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 a widget.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginCreateOrUpdateWidget(String widgetName, BinaryData resource,
+ RequestOptions requestOptions) {
+ return this.serviceClient.beginCreateOrUpdateWidgetAsync(widgetName, resource, requestOptions);
+ }
+
+ /**
+ * Delete a Widget 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)
+ * }
+ * }
+ * }
+ * }
+ *
+ *
+ * @param widgetName The widget name.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginDeleteWidget(String widgetName, RequestOptions requestOptions) {
+ return this.serviceClient.beginDeleteWidgetAsync(widgetName, requestOptions);
+ }
+
+ /**
+ * List Widget resources.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ *
+ *
+ * @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 WidgetSuite items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listWidgets(RequestOptions requestOptions) {
+ return this.serviceClient.listWidgetsAsync(requestOptions);
+ }
+
+ /**
+ * Fetch a Widget by name.
+ *
+ * @param widgetName The widget name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a widget on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getWidget(String widgetName) {
+ // Generated convenience method for getWidgetWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getWidgetWithResponse(widgetName, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(WidgetSuite.class));
+ }
+
+ /**
+ * Gets status of a Widget operation.
+ *
+ * @param widgetName The widget name.
+ * @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 Widget operation on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getWidgetOperationStatus(String widgetName,
+ String operationId) {
+ // Generated convenience method for getWidgetOperationStatusWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getWidgetOperationStatusWithResponse(widgetName, operationId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData
+ .toObject(ResourceOperationStatusWidgetSuiteWidgetSuiteError.class));
+ }
+
+ /**
+ * Creates or updates a Widget asynchronously.
+ *
+ * @param widgetName The widget name.
+ * @param resource The resource instance.
+ * @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 a widget.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginCreateOrUpdateWidget(String widgetName,
+ WidgetSuite resource) {
+ // Generated convenience method for beginCreateOrUpdateWidgetWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ JsonMergePatchHelper.getWidgetSuiteAccessor().prepareModelForJsonMergePatch(resource, true);
+ BinaryData resourceInBinaryData = BinaryData.fromObject(resource);
+ // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
+ resourceInBinaryData.getLength();
+ JsonMergePatchHelper.getWidgetSuiteAccessor().prepareModelForJsonMergePatch(resource, false);
+ return serviceClient.beginCreateOrUpdateWidgetWithModelAsync(widgetName, resourceInBinaryData, requestOptions);
+ }
+
+ /**
+ * Delete a Widget asynchronously.
+ *
+ * @param widgetName The widget name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginDeleteWidget(String widgetName) {
+ // Generated convenience method for beginDeleteWidgetWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginDeleteWidgetWithModelAsync(widgetName, requestOptions);
+ }
+
+ /**
+ * List Widget resources.
+ *
+ * @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 WidgetSuite items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listWidgets() {
+ // Generated convenience method for listWidgets
+ RequestOptions requestOptions = new RequestOptions();
+ PagedFlux pagedFluxResponse = listWidgets(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(WidgetSuite.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+}
diff --git a/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerClient.java b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerClient.java
new file mode 100644
index 000000000000..0b1352da3acd
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerClient.java
@@ -0,0 +1,349 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.contoso.widgetmanager;
+
+import com.azure.contoso.widgetmanager.implementation.JsonMergePatchHelper;
+import com.azure.contoso.widgetmanager.implementation.WidgetsImpl;
+import com.azure.contoso.widgetmanager.models.ResourceOperationStatusWidgetSuiteWidgetSuiteError;
+import com.azure.contoso.widgetmanager.models.WidgetSuite;
+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 WidgetManagerClient type.
+ */
+@ServiceClient(builder = WidgetManagerClientBuilder.class)
+public final class WidgetManagerClient {
+ @Generated
+ private final WidgetsImpl serviceClient;
+
+ /**
+ * Initializes an instance of WidgetManagerClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ WidgetManagerClient(WidgetsImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Fetch a Widget by name.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param widgetName The widget name.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return a widget along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWidgetWithResponse(String widgetName, RequestOptions requestOptions) {
+ return this.serviceClient.getWidgetWithResponse(widgetName, requestOptions);
+ }
+
+ /**
+ * Gets status of a Widget 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): {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ * }
+ *
+ *
+ * @param widgetName The widget name.
+ * @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 Widget operation along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWidgetOperationStatusWithResponse(String widgetName, String operationId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getWidgetOperationStatusWithResponse(widgetName, operationId, requestOptions);
+ }
+
+ /**
+ * Creates or updates a Widget asynchronously.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ *
+ *
+ * @param widgetName The widget name.
+ * @param resource The resource instance.
+ * @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 a widget.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginCreateOrUpdateWidget(String widgetName, BinaryData resource,
+ RequestOptions requestOptions) {
+ return this.serviceClient.beginCreateOrUpdateWidget(widgetName, resource, requestOptions);
+ }
+
+ /**
+ * Delete a Widget 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)
+ * }
+ * }
+ * }
+ * }
+ *
+ *
+ * @param widgetName The widget name.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginDeleteWidget(String widgetName, RequestOptions requestOptions) {
+ return this.serviceClient.beginDeleteWidget(widgetName, requestOptions);
+ }
+
+ /**
+ * List Widget resources.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * manufacturerId: String (Optional, Required on create)
+ * sharedModel (Optional): {
+ * tag: String (Optional, Required on create)
+ * createdAt: OffsetDateTime (Optional, Required on create)
+ * }
+ * }
+ * }
+ *
+ *
+ * @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 WidgetSuite items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listWidgets(RequestOptions requestOptions) {
+ return this.serviceClient.listWidgets(requestOptions);
+ }
+
+ /**
+ * Fetch a Widget by name.
+ *
+ * @param widgetName The widget name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a widget.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public WidgetSuite getWidget(String widgetName) {
+ // Generated convenience method for getWidgetWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getWidgetWithResponse(widgetName, requestOptions).getValue().toObject(WidgetSuite.class);
+ }
+
+ /**
+ * Gets status of a Widget operation.
+ *
+ * @param widgetName The widget name.
+ * @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 Widget operation.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ResourceOperationStatusWidgetSuiteWidgetSuiteError getWidgetOperationStatus(String widgetName,
+ String operationId) {
+ // Generated convenience method for getWidgetOperationStatusWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getWidgetOperationStatusWithResponse(widgetName, operationId, requestOptions).getValue()
+ .toObject(ResourceOperationStatusWidgetSuiteWidgetSuiteError.class);
+ }
+
+ /**
+ * Creates or updates a Widget asynchronously.
+ *
+ * @param widgetName The widget name.
+ * @param resource The resource instance.
+ * @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 a widget.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginCreateOrUpdateWidget(String widgetName,
+ WidgetSuite resource) {
+ // Generated convenience method for beginCreateOrUpdateWidgetWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ JsonMergePatchHelper.getWidgetSuiteAccessor().prepareModelForJsonMergePatch(resource, true);
+ BinaryData resourceInBinaryData = BinaryData.fromObject(resource);
+ // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
+ resourceInBinaryData.getLength();
+ JsonMergePatchHelper.getWidgetSuiteAccessor().prepareModelForJsonMergePatch(resource, false);
+ return serviceClient.beginCreateOrUpdateWidgetWithModel(widgetName, resourceInBinaryData, requestOptions);
+ }
+
+ /**
+ * Delete a Widget asynchronously.
+ *
+ * @param widgetName The widget name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginDeleteWidget(String widgetName) {
+ // Generated convenience method for beginDeleteWidgetWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginDeleteWidgetWithModel(widgetName, requestOptions);
+ }
+
+ /**
+ * List Widget resources.
+ *
+ * @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 WidgetSuite items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listWidgets() {
+ // Generated convenience method for listWidgets
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.listWidgets(requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(WidgetSuite.class));
+ }
+}
diff --git a/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerClientBuilder.java b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerClientBuilder.java
new file mode 100644
index 000000000000..5dd19e183a0a
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerClientBuilder.java
@@ -0,0 +1,334 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.contoso.widgetmanager;
+
+import com.azure.contoso.widgetmanager.implementation.WidgetManagerClientImpl;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ServiceClientBuilder;
+import com.azure.core.client.traits.ConfigurationTrait;
+import com.azure.core.client.traits.EndpointTrait;
+import com.azure.core.client.traits.HttpTrait;
+import com.azure.core.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 WidgetManagerClient type.
+ */
+@ServiceClientBuilder(serviceClients = { WidgetManagerClient.class, WidgetManagerAsyncClient.class })
+public final class WidgetManagerClientBuilder
+ implements HttpTrait, ConfigurationTrait,
+ TokenCredentialTrait, EndpointTrait {
+ @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://contoso.azure.com/.default" };
+
+ @Generated
+ private static final Map PROPERTIES
+ = CoreUtils.getProperties("azure-contoso-widgetmanager.properties");
+
+ @Generated
+ private final List pipelinePolicies;
+
+ /**
+ * Create an instance of the WidgetManagerClientBuilder.
+ */
+ @Generated
+ public WidgetManagerClientBuilder() {
+ this.pipelinePolicies = new ArrayList<>();
+ }
+
+ /*
+ * The HTTP pipeline to send requests through.
+ */
+ @Generated
+ private HttpPipeline pipeline;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public WidgetManagerClientBuilder 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 WidgetManagerClientBuilder httpClient(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ /*
+ * The logging configuration for HTTP requests and responses.
+ */
+ @Generated
+ private HttpLogOptions httpLogOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public WidgetManagerClientBuilder 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 WidgetManagerClientBuilder 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 WidgetManagerClientBuilder retryOptions(RetryOptions retryOptions) {
+ this.retryOptions = retryOptions;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public WidgetManagerClientBuilder 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 WidgetManagerClientBuilder configuration(Configuration configuration) {
+ this.configuration = configuration;
+ return this;
+ }
+
+ /*
+ * The TokenCredential used for authentication.
+ */
+ @Generated
+ private TokenCredential tokenCredential;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public WidgetManagerClientBuilder credential(TokenCredential tokenCredential) {
+ this.tokenCredential = tokenCredential;
+ return this;
+ }
+
+ /*
+ * The service endpoint
+ */
+ @Generated
+ private String endpoint;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public WidgetManagerClientBuilder endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ /*
+ * Service version
+ */
+ @Generated
+ private WidgetManagerServiceVersion serviceVersion;
+
+ /**
+ * Sets Service version.
+ *
+ * @param serviceVersion the serviceVersion value.
+ * @return the WidgetManagerClientBuilder.
+ */
+ @Generated
+ public WidgetManagerClientBuilder serviceVersion(WidgetManagerServiceVersion 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 WidgetManagerClientBuilder.
+ */
+ @Generated
+ public WidgetManagerClientBuilder retryPolicy(RetryPolicy retryPolicy) {
+ this.retryPolicy = retryPolicy;
+ return this;
+ }
+
+ /**
+ * Builds an instance of WidgetManagerClientImpl with the provided parameters.
+ *
+ * @return an instance of WidgetManagerClientImpl.
+ */
+ @Generated
+ private WidgetManagerClientImpl buildInnerClient() {
+ this.validateClient();
+ HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
+ WidgetManagerServiceVersion localServiceVersion
+ = (serviceVersion != null) ? serviceVersion : WidgetManagerServiceVersion.getLatest();
+ WidgetManagerClientImpl client = new WidgetManagerClientImpl(localPipeline,
+ JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion);
+ return client;
+ }
+
+ @Generated
+ private void validateClient() {
+ // This method is invoked from 'buildInnerClient'/'buildClient' method.
+ // Developer can customize this method, to validate that the necessary conditions are met for the new client.
+ Objects.requireNonNull(endpoint, "'endpoint' cannot be null.");
+ }
+
+ @Generated
+ private HttpPipeline createHttpPipeline() {
+ Configuration buildConfiguration
+ = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
+ HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions;
+ ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions;
+ List policies = new ArrayList<>();
+ String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName");
+ String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion");
+ String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions);
+ policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));
+ policies.add(new RequestIdPolicy());
+ policies.add(new AddHeadersFromContextPolicy());
+ HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions);
+ if (headers != null) {
+ policies.add(new AddHeadersPolicy(headers));
+ }
+ this.pipelinePolicies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
+ .forEach(p -> policies.add(p));
+ HttpPolicyProviders.addBeforeRetryPolicies(policies);
+ policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy()));
+ policies.add(new AddDatePolicy());
+ 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 WidgetManagerAsyncClient class.
+ *
+ * @return an instance of WidgetManagerAsyncClient.
+ */
+ @Generated
+ public WidgetManagerAsyncClient buildAsyncClient() {
+ return new WidgetManagerAsyncClient(buildInnerClient().getWidgets());
+ }
+
+ /**
+ * Builds an instance of WidgetManagerClient class.
+ *
+ * @return an instance of WidgetManagerClient.
+ */
+ @Generated
+ public WidgetManagerClient buildClient() {
+ return new WidgetManagerClient(buildInnerClient().getWidgets());
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(WidgetManagerClientBuilder.class);
+}
diff --git a/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerServiceVersion.java b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerServiceVersion.java
new file mode 100644
index 000000000000..64cde42aedc1
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/WidgetManagerServiceVersion.java
@@ -0,0 +1,45 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.contoso.widgetmanager;
+
+import com.azure.core.util.ServiceVersion;
+
+/**
+ * Service version of WidgetManagerClient.
+ */
+public enum WidgetManagerServiceVersion implements ServiceVersion {
+ /**
+ * Enum value 2022-11-01-preview.
+ */
+ V2022_11_01_PREVIEW("2022-11-01-preview"),
+
+ /**
+ * Enum value 2022-12-01.
+ */
+ V2022_12_01("2022-12-01");
+
+ private final String version;
+
+ WidgetManagerServiceVersion(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 WidgetManagerServiceVersion}.
+ */
+ public static WidgetManagerServiceVersion getLatest() {
+ return V2022_12_01;
+ }
+}
diff --git a/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/implementation/JsonMergePatchHelper.java b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/implementation/JsonMergePatchHelper.java
new file mode 100644
index 000000000000..5e98b27061b3
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/implementation/JsonMergePatchHelper.java
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.contoso.widgetmanager.implementation;
+
+import com.azure.contoso.widgetmanager.models.FakedSharedModel;
+import com.azure.contoso.widgetmanager.models.WidgetSuite;
+
+/**
+ * This is the Helper class to enable json merge patch serialization for a model.
+ */
+public class JsonMergePatchHelper {
+ private static WidgetSuiteAccessor widgetSuiteAccessor;
+
+ public interface WidgetSuiteAccessor {
+ WidgetSuite prepareModelForJsonMergePatch(WidgetSuite widgetSuite, boolean jsonMergePatchEnabled);
+
+ boolean isJsonMergePatch(WidgetSuite widgetSuite);
+ }
+
+ public static void setWidgetSuiteAccessor(WidgetSuiteAccessor accessor) {
+ widgetSuiteAccessor = accessor;
+ }
+
+ public static WidgetSuiteAccessor getWidgetSuiteAccessor() {
+ return widgetSuiteAccessor;
+ }
+
+ private static FakedSharedModelAccessor fakedSharedModelAccessor;
+
+ public interface FakedSharedModelAccessor {
+ FakedSharedModel prepareModelForJsonMergePatch(FakedSharedModel fakedSharedModel,
+ boolean jsonMergePatchEnabled);
+
+ boolean isJsonMergePatch(FakedSharedModel fakedSharedModel);
+ }
+
+ public static void setFakedSharedModelAccessor(FakedSharedModelAccessor accessor) {
+ fakedSharedModelAccessor = accessor;
+ }
+
+ public static FakedSharedModelAccessor getFakedSharedModelAccessor() {
+ return fakedSharedModelAccessor;
+ }
+}
diff --git a/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/implementation/OperationLocationPollingStrategy.java b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/implementation/OperationLocationPollingStrategy.java
new file mode 100644
index 000000000000..0ec54366b74d
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/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.contoso.widgetmanager.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/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/implementation/PollingUtils.java b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/implementation/PollingUtils.java
new file mode 100644
index 000000000000..ba4fd2f07a79
--- /dev/null
+++ b/sdk/contosowidgetmanager/azure-contoso-widgetmanager/src/main/java/com/azure/contoso/widgetmanager/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.contoso.widgetmanager.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