scopes = new ArrayList<>();
+ private RetryPolicy retryPolicy;
+ private RetryOptions retryOptions;
+ private Duration defaultPollInterval;
+
+ private Configurable() {
+ }
+
+ /**
+ * Sets the http client.
+ *
+ * @param httpClient the HTTP client.
+ * @return the configurable object itself.
+ */
+ public Configurable withHttpClient(HttpClient httpClient) {
+ this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null.");
+ return this;
+ }
+
+ /**
+ * Sets the logging options to the HTTP pipeline.
+ *
+ * @param httpLogOptions the HTTP log options.
+ * @return the configurable object itself.
+ */
+ public Configurable withLogOptions(HttpLogOptions httpLogOptions) {
+ this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null.");
+ return this;
+ }
+
+ /**
+ * Adds the pipeline policy to the HTTP pipeline.
+ *
+ * @param policy the HTTP pipeline policy.
+ * @return the configurable object itself.
+ */
+ public Configurable withPolicy(HttpPipelinePolicy policy) {
+ this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null."));
+ return this;
+ }
+
+ /**
+ * Adds the scope to permission sets.
+ *
+ * @param scope the scope.
+ * @return the configurable object itself.
+ */
+ public Configurable withScope(String scope) {
+ this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
+ return this;
+ }
+
+ /**
+ * Sets the retry policy to the HTTP pipeline.
+ *
+ * @param retryPolicy the HTTP pipeline retry policy.
+ * @return the configurable object itself.
+ */
+ public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
+ this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null.");
+ return this;
+ }
+
+ /**
+ * Sets the retry options for the HTTP pipeline retry policy.
+ *
+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
+ *
+ * @param retryOptions the retry options for the HTTP pipeline retry policy.
+ * @return the configurable object itself.
+ */
+ public Configurable withRetryOptions(RetryOptions retryOptions) {
+ this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null.");
+ return this;
+ }
+
+ /**
+ * Sets the default poll interval, used when service does not provide "Retry-After" header.
+ *
+ * @param defaultPollInterval the default poll interval.
+ * @return the configurable object itself.
+ */
+ public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
+ this.defaultPollInterval
+ = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null.");
+ if (this.defaultPollInterval.isNegative()) {
+ throw LOGGER
+ .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative"));
+ }
+ return this;
+ }
+
+ /**
+ * Creates an instance of ManagementGroup service API entry point.
+ *
+ * @param credential the credential to use.
+ * @param profile the Azure profile for client.
+ * @return the ManagementGroup service API instance.
+ */
+ public ManagementGroupManager authenticate(TokenCredential credential, AzureProfile profile) {
+ Objects.requireNonNull(credential, "'credential' cannot be null.");
+ Objects.requireNonNull(profile, "'profile' cannot be null.");
+
+ String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion");
+
+ StringBuilder userAgentBuilder = new StringBuilder();
+ userAgentBuilder.append("azsdk-java")
+ .append("-")
+ .append("azure.resourcemanager.managementgroup")
+ .append("/")
+ .append(clientVersion);
+ if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
+ userAgentBuilder.append(" (")
+ .append(Configuration.getGlobalConfiguration().get("java.version"))
+ .append("; ")
+ .append(Configuration.getGlobalConfiguration().get("os.name"))
+ .append("; ")
+ .append(Configuration.getGlobalConfiguration().get("os.version"))
+ .append("; auto-generated)");
+ } else {
+ userAgentBuilder.append(" (auto-generated)");
+ }
+
+ if (scopes.isEmpty()) {
+ scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
+ }
+ if (retryPolicy == null) {
+ if (retryOptions != null) {
+ retryPolicy = new RetryPolicy(retryOptions);
+ } else {
+ retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
+ }
+ }
+ List policies = new ArrayList<>();
+ policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
+ policies.add(new AddHeadersFromContextPolicy());
+ policies.add(new RequestIdPolicy());
+ policies.addAll(this.policies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
+ .collect(Collectors.toList()));
+ HttpPolicyProviders.addBeforeRetryPolicies(policies);
+ policies.add(retryPolicy);
+ policies.add(new AddDatePolicy());
+ policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0])));
+ policies.addAll(this.policies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
+ .collect(Collectors.toList()));
+ HttpPolicyProviders.addAfterRetryPolicies(policies);
+ policies.add(new HttpLoggingPolicy(httpLogOptions));
+ HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient)
+ .policies(policies.toArray(new HttpPipelinePolicy[0]))
+ .build();
+ return new ManagementGroupManager(httpPipeline, profile, defaultPollInterval);
+ }
+ }
+
+ /**
+ * Gets the resource collection API of ManagementGroupChildResources.
+ *
+ * @return Resource collection API of ManagementGroupChildResources.
+ */
+ public ManagementGroupChildResources managementGroupChildResources() {
+ if (this.managementGroupChildResources == null) {
+ this.managementGroupChildResources
+ = new ManagementGroupChildResourcesImpl(clientObject.getManagementGroupChildResources(), this);
+ }
+ return managementGroupChildResources;
+ }
+
+ /**
+ * Gets wrapped service client ManagementGroupClient providing direct access to the underlying auto-generated API
+ * implementation, based on Azure REST API.
+ *
+ * @return Wrapped service client ManagementGroupClient.
+ */
+ public ManagementGroupClient serviceClient() {
+ return this.clientObject;
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/ManagementGroupChildResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/ManagementGroupChildResourcesClient.java
new file mode 100644
index 00000000000..ac559a3162c
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/ManagementGroupChildResourcesClient.java
@@ -0,0 +1,198 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.fluent;
+
+import azure.resourcemanager.managementgroup.fluent.models.ManagementGroupChildResourceInner;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.Response;
+import com.azure.core.management.polling.PollResult;
+import com.azure.core.util.Context;
+import com.azure.core.util.polling.SyncPoller;
+
+/**
+ * An instance of this class provides access to all the operations defined in ManagementGroupChildResourcesClient.
+ */
+public interface ManagementGroupChildResourcesClient {
+ /**
+ * Get a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a ManagementGroupChildResource along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response getWithResponse(String managementGroupId,
+ String managementGroupChildResourceName, Context context);
+
+ /**
+ * Get a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a ManagementGroupChildResource.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ManagementGroupChildResourceInner get(String managementGroupId, String managementGroupChildResourceName);
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this
+ * type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, ManagementGroupChildResourceInner> beginCreateOrUpdate(
+ String managementGroupId, String managementGroupChildResourceName, ManagementGroupChildResourceInner resource);
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this
+ * type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, ManagementGroupChildResourceInner> beginCreateOrUpdate(
+ String managementGroupId, String managementGroupChildResourceName, ManagementGroupChildResourceInner resource,
+ Context context);
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ManagementGroupChildResourceInner createOrUpdate(String managementGroupId, String managementGroupChildResourceName,
+ ManagementGroupChildResourceInner resource);
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ManagementGroupChildResourceInner createOrUpdate(String managementGroupId, String managementGroupChildResourceName,
+ ManagementGroupChildResourceInner resource, Context context);
+
+ /**
+ * Update a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param properties The resource properties to be updated.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type
+ * along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response updateWithResponse(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner properties, Context context);
+
+ /**
+ * Update a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param properties The resource properties to be updated.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ManagementGroupChildResourceInner update(String managementGroupId, String managementGroupChildResourceName,
+ ManagementGroupChildResourceInner properties);
+
+ /**
+ * Delete a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response deleteWithResponse(String managementGroupId, String managementGroupChildResourceName,
+ Context context);
+
+ /**
+ * Delete a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ void delete(String managementGroupId, String managementGroupChildResourceName);
+
+ /**
+ * List ManagementGroupChildResource resources by scope.
+ *
+ * @param managementGroupId The management group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation as paginated response with
+ * {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable listByManagementGroup(String managementGroupId);
+
+ /**
+ * List ManagementGroupChildResource resources by scope.
+ *
+ * @param managementGroupId The management group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation as paginated response with
+ * {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ PagedIterable listByManagementGroup(String managementGroupId, Context context);
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/ManagementGroupClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/ManagementGroupClient.java
new file mode 100644
index 00000000000..e60ba06577a
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/ManagementGroupClient.java
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.fluent;
+
+import com.azure.core.http.HttpPipeline;
+import java.time.Duration;
+
+/**
+ * The interface for ManagementGroupClient class.
+ */
+public interface ManagementGroupClient {
+ /**
+ * Gets Service host.
+ *
+ * @return the endpoint value.
+ */
+ String getEndpoint();
+
+ /**
+ * Gets Version parameter.
+ *
+ * @return the apiVersion value.
+ */
+ String getApiVersion();
+
+ /**
+ * Gets The HTTP pipeline to send requests through.
+ *
+ * @return the httpPipeline value.
+ */
+ HttpPipeline getHttpPipeline();
+
+ /**
+ * Gets The default poll interval for long-running operation.
+ *
+ * @return the defaultPollInterval value.
+ */
+ Duration getDefaultPollInterval();
+
+ /**
+ * Gets the ManagementGroupChildResourcesClient object to access its operations.
+ *
+ * @return the ManagementGroupChildResourcesClient object.
+ */
+ ManagementGroupChildResourcesClient getManagementGroupChildResources();
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/models/ManagementGroupChildResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/models/ManagementGroupChildResourceInner.java
new file mode 100644
index 00000000000..b87789de563
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/models/ManagementGroupChildResourceInner.java
@@ -0,0 +1,157 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.fluent.models;
+
+import azure.resourcemanager.managementgroup.models.ManagementGroupChildResourceProperties;
+import com.azure.core.annotation.Fluent;
+import com.azure.core.management.ProxyResource;
+import com.azure.core.management.SystemData;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
+
+/**
+ * Concrete extension resource types can be created by aliasing this type using a specific property type.
+ */
+@Fluent
+public final class ManagementGroupChildResourceInner extends ProxyResource {
+ /*
+ * The resource-specific properties for this resource.
+ */
+ private ManagementGroupChildResourceProperties properties;
+
+ /*
+ * Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ */
+ private SystemData systemData;
+
+ /*
+ * The type of the resource.
+ */
+ private String type;
+
+ /*
+ * The name of the resource.
+ */
+ private String name;
+
+ /*
+ * Fully qualified resource Id for the resource.
+ */
+ private String id;
+
+ /**
+ * Creates an instance of ManagementGroupChildResourceInner class.
+ */
+ public ManagementGroupChildResourceInner() {
+ }
+
+ /**
+ * Get the properties property: The resource-specific properties for this resource.
+ *
+ * @return the properties value.
+ */
+ public ManagementGroupChildResourceProperties properties() {
+ return this.properties;
+ }
+
+ /**
+ * Set the properties property: The resource-specific properties for this resource.
+ *
+ * @param properties the properties value to set.
+ * @return the ManagementGroupChildResourceInner object itself.
+ */
+ public ManagementGroupChildResourceInner withProperties(ManagementGroupChildResourceProperties properties) {
+ this.properties = properties;
+ return this;
+ }
+
+ /**
+ * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ *
+ * @return the systemData value.
+ */
+ public SystemData systemData() {
+ return this.systemData;
+ }
+
+ /**
+ * Get the type property: The type of the resource.
+ *
+ * @return the type value.
+ */
+ @Override
+ public String type() {
+ return this.type;
+ }
+
+ /**
+ * Get the name property: The name of the resource.
+ *
+ * @return the name value.
+ */
+ @Override
+ public String name() {
+ return this.name;
+ }
+
+ /**
+ * Get the id property: Fully qualified resource Id for the resource.
+ *
+ * @return the id value.
+ */
+ @Override
+ public String id() {
+ return this.id;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeJsonField("properties", this.properties);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ManagementGroupChildResourceInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ManagementGroupChildResourceInner if the JsonReader was pointing to an instance of it, or
+ * null if it was pointing to JSON null.
+ * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
+ * @throws IOException If an error occurs while reading the ManagementGroupChildResourceInner.
+ */
+ public static ManagementGroupChildResourceInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ManagementGroupChildResourceInner deserializedManagementGroupChildResourceInner
+ = new ManagementGroupChildResourceInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedManagementGroupChildResourceInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedManagementGroupChildResourceInner.name = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedManagementGroupChildResourceInner.type = reader.getString();
+ } else if ("properties".equals(fieldName)) {
+ deserializedManagementGroupChildResourceInner.properties
+ = ManagementGroupChildResourceProperties.fromJson(reader);
+ } else if ("systemData".equals(fieldName)) {
+ deserializedManagementGroupChildResourceInner.systemData = SystemData.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedManagementGroupChildResourceInner;
+ });
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/models/package-info.java
new file mode 100644
index 00000000000..7bc5661857f
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/models/package-info.java
@@ -0,0 +1,9 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+/**
+ * Package containing the inner data models for ManagementGroup.
+ * Arm Resource Provider management API.
+ */
+package azure.resourcemanager.managementgroup.fluent.models;
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/package-info.java
new file mode 100644
index 00000000000..47cc28858f0
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/fluent/package-info.java
@@ -0,0 +1,9 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+/**
+ * Package containing the service clients for ManagementGroup.
+ * Arm Resource Provider management API.
+ */
+package azure.resourcemanager.managementgroup.fluent;
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupChildResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupChildResourceImpl.java
new file mode 100644
index 00000000000..8bcda8f0e70
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupChildResourceImpl.java
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.implementation;
+
+import azure.resourcemanager.managementgroup.fluent.models.ManagementGroupChildResourceInner;
+import azure.resourcemanager.managementgroup.models.ManagementGroupChildResource;
+import azure.resourcemanager.managementgroup.models.ManagementGroupChildResourceProperties;
+import com.azure.core.management.SystemData;
+
+public final class ManagementGroupChildResourceImpl implements ManagementGroupChildResource {
+ private ManagementGroupChildResourceInner innerObject;
+
+ private final azure.resourcemanager.managementgroup.ManagementGroupManager serviceManager;
+
+ ManagementGroupChildResourceImpl(ManagementGroupChildResourceInner innerObject,
+ azure.resourcemanager.managementgroup.ManagementGroupManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public String id() {
+ return this.innerModel().id();
+ }
+
+ public String name() {
+ return this.innerModel().name();
+ }
+
+ public String type() {
+ return this.innerModel().type();
+ }
+
+ public ManagementGroupChildResourceProperties properties() {
+ return this.innerModel().properties();
+ }
+
+ public SystemData systemData() {
+ return this.innerModel().systemData();
+ }
+
+ public ManagementGroupChildResourceInner innerModel() {
+ return this.innerObject;
+ }
+
+ private azure.resourcemanager.managementgroup.ManagementGroupManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupChildResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupChildResourcesClientImpl.java
new file mode 100644
index 00000000000..4dc96f94473
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupChildResourcesClientImpl.java
@@ -0,0 +1,758 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.implementation;
+
+import azure.resourcemanager.managementgroup.fluent.ManagementGroupChildResourcesClient;
+import azure.resourcemanager.managementgroup.fluent.models.ManagementGroupChildResourceInner;
+import azure.resourcemanager.managementgroup.implementation.models.ManagementGroupChildResourceListResult;
+import com.azure.core.annotation.BodyParam;
+import com.azure.core.annotation.Delete;
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Headers;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.Patch;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.Put;
+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.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.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.management.polling.PollResult;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.core.util.polling.PollerFlux;
+import com.azure.core.util.polling.SyncPoller;
+import java.nio.ByteBuffer;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/**
+ * An instance of this class provides access to all the operations defined in ManagementGroupChildResourcesClient.
+ */
+public final class ManagementGroupChildResourcesClientImpl implements ManagementGroupChildResourcesClient {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final ManagementGroupChildResourcesService service;
+
+ /**
+ * The service client containing this operation class.
+ */
+ private final ManagementGroupClientImpl client;
+
+ /**
+ * Initializes an instance of ManagementGroupChildResourcesClientImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ ManagementGroupChildResourcesClientImpl(ManagementGroupClientImpl client) {
+ this.service = RestProxy.create(ManagementGroupChildResourcesService.class, client.getHttpPipeline(),
+ client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for ManagementGroupClientManagementGroupChildResources to be used by the
+ * proxy service to perform REST calls.
+ */
+ @Host("{endpoint}")
+ @ServiceInterface(name = "ManagementGroupClientManagementGroupChildResources")
+ public interface ManagementGroupChildResourcesService {
+ @Headers({ "Content-Type: application/json" })
+ @Get("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources/{managementGroupChildResourceName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> get(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("managementGroupId") String managementGroupId,
+ @PathParam("managementGroupChildResourceName") String managementGroupChildResourceName,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Get("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources/{managementGroupChildResourceName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response getSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("managementGroupId") String managementGroupId,
+ @PathParam("managementGroupChildResourceName") String managementGroupChildResourceName,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Put("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources/{managementGroupChildResourceName}")
+ @ExpectedResponses({ 200, 201 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono>> createOrUpdate(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("managementGroupId") String managementGroupId,
+ @PathParam("managementGroupChildResourceName") String managementGroupChildResourceName,
+ @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
+ @BodyParam("application/json") ManagementGroupChildResourceInner resource, Context context);
+
+ @Put("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources/{managementGroupChildResourceName}")
+ @ExpectedResponses({ 200, 201 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response createOrUpdateSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("managementGroupId") String managementGroupId,
+ @PathParam("managementGroupChildResourceName") String managementGroupChildResourceName,
+ @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
+ @BodyParam("application/json") ManagementGroupChildResourceInner resource, Context context);
+
+ @Patch("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources/{managementGroupChildResourceName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> update(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("managementGroupId") String managementGroupId,
+ @PathParam("managementGroupChildResourceName") String managementGroupChildResourceName,
+ @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
+ @BodyParam("application/json") ManagementGroupChildResourceInner properties, Context context);
+
+ @Patch("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources/{managementGroupChildResourceName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response updateSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("managementGroupId") String managementGroupId,
+ @PathParam("managementGroupChildResourceName") String managementGroupChildResourceName,
+ @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
+ @BodyParam("application/json") ManagementGroupChildResourceInner properties, Context context);
+
+ @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
+ @Delete("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources/{managementGroupChildResourceName}")
+ @ExpectedResponses({ 200, 204 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> delete(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("managementGroupId") String managementGroupId,
+ @PathParam("managementGroupChildResourceName") String managementGroupChildResourceName, Context context);
+
+ @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
+ @Delete("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources/{managementGroupChildResourceName}")
+ @ExpectedResponses({ 200, 204 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion,
+ @PathParam("managementGroupId") String managementGroupId,
+ @PathParam("managementGroupChildResourceName") String managementGroupChildResourceName, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Get("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> listByManagementGroup(
+ @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion,
+ @PathParam("managementGroupId") String managementGroupId, @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Get("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.ManagementGroupChild/managementGroupChildResources")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response listByManagementGroupSync(
+ @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion,
+ @PathParam("managementGroupId") String managementGroupId, @HeaderParam("Accept") String accept,
+ Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Get("{nextLink}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> listByManagementGroupNext(
+ @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Get("{nextLink}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response listByManagementGroupNextSync(
+ @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint,
+ @HeaderParam("Accept") String accept, Context context);
+ }
+
+ /**
+ * Get a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a ManagementGroupChildResource along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getWithResponseAsync(String managementGroupId,
+ String managementGroupChildResourceName) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(),
+ managementGroupId, managementGroupChildResourceName, accept, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a ManagementGroupChildResource on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getAsync(String managementGroupId,
+ String managementGroupChildResourceName) {
+ return getWithResponseAsync(managementGroupId, managementGroupChildResourceName)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Get a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a ManagementGroupChildResource along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWithResponse(String managementGroupId,
+ String managementGroupChildResourceName, Context context) {
+ final String accept = "application/json";
+ return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), managementGroupId,
+ managementGroupChildResourceName, accept, context);
+ }
+
+ /**
+ * Get a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a ManagementGroupChildResource.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ManagementGroupChildResourceInner get(String managementGroupId, String managementGroupChildResourceName) {
+ return getWithResponse(managementGroupId, managementGroupChildResourceName, Context.NONE).getValue();
+ }
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type
+ * along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>> createOrUpdateWithResponseAsync(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner resource) {
+ final String contentType = "application/json";
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(),
+ managementGroupId, managementGroupChildResourceName, contentType, accept, resource, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type
+ * along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response createOrUpdateWithResponse(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner resource) {
+ final String contentType = "application/json";
+ final String accept = "application/json";
+ return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), managementGroupId,
+ managementGroupChildResourceName, contentType, accept, resource, Context.NONE);
+ }
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type
+ * along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response createOrUpdateWithResponse(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner resource, Context context) {
+ final String contentType = "application/json";
+ final String accept = "application/json";
+ return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), managementGroupId,
+ managementGroupChildResourceName, contentType, accept, resource, context);
+ }
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of concrete extension resource types can be created by aliasing this
+ * type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, ManagementGroupChildResourceInner>
+ beginCreateOrUpdateAsync(String managementGroupId, String managementGroupChildResourceName,
+ ManagementGroupChildResourceInner resource) {
+ Mono>> mono
+ = createOrUpdateWithResponseAsync(managementGroupId, managementGroupChildResourceName, resource);
+ return this.client.getLroResult(mono,
+ this.client.getHttpPipeline(), ManagementGroupChildResourceInner.class,
+ ManagementGroupChildResourceInner.class, this.client.getContext());
+ }
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this
+ * type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ManagementGroupChildResourceInner>
+ beginCreateOrUpdate(String managementGroupId, String managementGroupChildResourceName,
+ ManagementGroupChildResourceInner resource) {
+ Response response
+ = createOrUpdateWithResponse(managementGroupId, managementGroupChildResourceName, resource);
+ return this.client.getLroResult(response,
+ ManagementGroupChildResourceInner.class, ManagementGroupChildResourceInner.class, Context.NONE);
+ }
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this
+ * type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ManagementGroupChildResourceInner>
+ beginCreateOrUpdate(String managementGroupId, String managementGroupChildResourceName,
+ ManagementGroupChildResourceInner resource, Context context) {
+ Response response
+ = createOrUpdateWithResponse(managementGroupId, managementGroupChildResourceName, resource, context);
+ return this.client.getLroResult(response,
+ ManagementGroupChildResourceInner.class, ManagementGroupChildResourceInner.class, context);
+ }
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createOrUpdateAsync(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner resource) {
+ return beginCreateOrUpdateAsync(managementGroupId, managementGroupChildResourceName, resource).last()
+ .flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ManagementGroupChildResourceInner createOrUpdate(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner resource) {
+ return beginCreateOrUpdate(managementGroupId, managementGroupChildResourceName, resource).getFinalResult();
+ }
+
+ /**
+ * Create a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param resource Resource create parameters.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ManagementGroupChildResourceInner createOrUpdate(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner resource, Context context) {
+ return beginCreateOrUpdate(managementGroupId, managementGroupChildResourceName, resource, context)
+ .getFinalResult();
+ }
+
+ /**
+ * Update a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param properties The resource properties to be updated.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type
+ * along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> updateWithResponseAsync(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner properties) {
+ final String contentType = "application/json";
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(),
+ managementGroupId, managementGroupChildResourceName, contentType, accept, properties, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Update a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param properties The resource properties to be updated.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono updateAsync(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner properties) {
+ return updateWithResponseAsync(managementGroupId, managementGroupChildResourceName, properties)
+ .flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Update a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param properties The resource properties to be updated.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type
+ * along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateWithResponse(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner properties, Context context) {
+ final String contentType = "application/json";
+ final String accept = "application/json";
+ return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), managementGroupId,
+ managementGroupChildResourceName, contentType, accept, properties, context);
+ }
+
+ /**
+ * Update a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param properties The resource properties to be updated.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return concrete extension resource types can be created by aliasing this type using a specific property type.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ManagementGroupChildResourceInner update(String managementGroupId, String managementGroupChildResourceName,
+ ManagementGroupChildResourceInner properties) {
+ return updateWithResponse(managementGroupId, managementGroupChildResourceName, properties, Context.NONE)
+ .getValue();
+ }
+
+ /**
+ * Delete a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> deleteWithResponseAsync(String managementGroupId,
+ String managementGroupChildResourceName) {
+ return FluxUtil
+ .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(),
+ managementGroupId, managementGroupChildResourceName, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Delete a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return A {@link Mono} that completes when a successful response is received.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono deleteAsync(String managementGroupId, String managementGroupChildResourceName) {
+ return deleteWithResponseAsync(managementGroupId, managementGroupChildResourceName)
+ .flatMap(ignored -> Mono.empty());
+ }
+
+ /**
+ * Delete a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteWithResponse(String managementGroupId, String managementGroupChildResourceName,
+ Context context) {
+ return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), managementGroupId,
+ managementGroupChildResourceName, context);
+ }
+
+ /**
+ * Delete a ManagementGroupChildResource.
+ *
+ * @param managementGroupId The management group ID.
+ * @param managementGroupChildResourceName The name of the ManagementGroupChildResource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void delete(String managementGroupId, String managementGroupChildResourceName) {
+ deleteWithResponse(managementGroupId, managementGroupChildResourceName, Context.NONE);
+ }
+
+ /**
+ * List ManagementGroupChildResource resources by scope.
+ *
+ * @param managementGroupId The management group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation along with {@link PagedResponse} on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>
+ listByManagementGroupSinglePageAsync(String managementGroupId) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listByManagementGroup(this.client.getEndpoint(),
+ this.client.getApiVersion(), managementGroupId, accept, context))
+ .>map(res -> new PagedResponseBase<>(res.getRequest(),
+ res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * List ManagementGroupChildResource resources by scope.
+ *
+ * @param managementGroupId The management group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation as paginated response with
+ * {@link PagedFlux}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ private PagedFlux listByManagementGroupAsync(String managementGroupId) {
+ return new PagedFlux<>(() -> listByManagementGroupSinglePageAsync(managementGroupId),
+ nextLink -> listByManagementGroupNextSinglePageAsync(nextLink));
+ }
+
+ /**
+ * List ManagementGroupChildResource resources by scope.
+ *
+ * @param managementGroupId The management group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listByManagementGroupSinglePage(String managementGroupId) {
+ final String accept = "application/json";
+ Response res = service.listByManagementGroupSync(
+ this.client.getEndpoint(), this.client.getApiVersion(), managementGroupId, accept, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(),
+ res.getValue().nextLink(), null);
+ }
+
+ /**
+ * List ManagementGroupChildResource resources by scope.
+ *
+ * @param managementGroupId The management group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listByManagementGroupSinglePage(String managementGroupId,
+ Context context) {
+ final String accept = "application/json";
+ Response res = service.listByManagementGroupSync(
+ this.client.getEndpoint(), this.client.getApiVersion(), managementGroupId, accept, context);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(),
+ res.getValue().nextLink(), null);
+ }
+
+ /**
+ * List ManagementGroupChildResource resources by scope.
+ *
+ * @param managementGroupId The management group ID.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation as paginated response with
+ * {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listByManagementGroup(String managementGroupId) {
+ return new PagedIterable<>(() -> listByManagementGroupSinglePage(managementGroupId),
+ nextLink -> listByManagementGroupNextSinglePage(nextLink));
+ }
+
+ /**
+ * List ManagementGroupChildResource resources by scope.
+ *
+ * @param managementGroupId The management group ID.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation as paginated response with
+ * {@link PagedIterable}.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listByManagementGroup(String managementGroupId,
+ Context context) {
+ return new PagedIterable<>(() -> listByManagementGroupSinglePage(managementGroupId, context),
+ nextLink -> listByManagementGroupNextSinglePage(nextLink, context));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The URL to get the next list of items.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation along with {@link PagedResponse} on
+ * successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>
+ listByManagementGroupNextSinglePageAsync(String nextLink) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(
+ context -> service.listByManagementGroupNext(nextLink, this.client.getEndpoint(), accept, context))
+ .>map(res -> new PagedResponseBase<>(res.getRequest(),
+ res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The URL to get the next list of items.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listByManagementGroupNextSinglePage(String nextLink) {
+ final String accept = "application/json";
+ Response res
+ = service.listByManagementGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(),
+ res.getValue().nextLink(), null);
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The URL to get the next list of items.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response of a ManagementGroupChildResource list operation along with {@link PagedResponse}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private PagedResponse listByManagementGroupNextSinglePage(String nextLink,
+ Context context) {
+ final String accept = "application/json";
+ Response res
+ = service.listByManagementGroupNextSync(nextLink, this.client.getEndpoint(), accept, context);
+ return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(),
+ res.getValue().nextLink(), null);
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupChildResourcesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupChildResourcesImpl.java
new file mode 100644
index 00000000000..1b38a9f706c
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupChildResourcesImpl.java
@@ -0,0 +1,120 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.implementation;
+
+import azure.resourcemanager.managementgroup.fluent.ManagementGroupChildResourcesClient;
+import azure.resourcemanager.managementgroup.fluent.models.ManagementGroupChildResourceInner;
+import azure.resourcemanager.managementgroup.models.ManagementGroupChildResource;
+import azure.resourcemanager.managementgroup.models.ManagementGroupChildResources;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.SimpleResponse;
+import com.azure.core.util.Context;
+import com.azure.core.util.logging.ClientLogger;
+
+public final class ManagementGroupChildResourcesImpl implements ManagementGroupChildResources {
+ private static final ClientLogger LOGGER = new ClientLogger(ManagementGroupChildResourcesImpl.class);
+
+ private final ManagementGroupChildResourcesClient innerClient;
+
+ private final azure.resourcemanager.managementgroup.ManagementGroupManager serviceManager;
+
+ public ManagementGroupChildResourcesImpl(ManagementGroupChildResourcesClient innerClient,
+ azure.resourcemanager.managementgroup.ManagementGroupManager serviceManager) {
+ this.innerClient = innerClient;
+ this.serviceManager = serviceManager;
+ }
+
+ public Response getWithResponse(String managementGroupId,
+ String managementGroupChildResourceName, Context context) {
+ Response inner
+ = this.serviceClient().getWithResponse(managementGroupId, managementGroupChildResourceName, context);
+ return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
+ new ManagementGroupChildResourceImpl(inner.getValue(), this.manager()));
+ }
+
+ public ManagementGroupChildResource get(String managementGroupId, String managementGroupChildResourceName) {
+ ManagementGroupChildResourceInner inner
+ = this.serviceClient().get(managementGroupId, managementGroupChildResourceName);
+ if (inner != null) {
+ return new ManagementGroupChildResourceImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public ManagementGroupChildResource createOrUpdate(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner resource) {
+ ManagementGroupChildResourceInner inner
+ = this.serviceClient().createOrUpdate(managementGroupId, managementGroupChildResourceName, resource);
+ if (inner != null) {
+ return new ManagementGroupChildResourceImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public ManagementGroupChildResource createOrUpdate(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner resource, Context context) {
+ ManagementGroupChildResourceInner inner = this.serviceClient()
+ .createOrUpdate(managementGroupId, managementGroupChildResourceName, resource, context);
+ if (inner != null) {
+ return new ManagementGroupChildResourceImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response updateWithResponse(String managementGroupId,
+ String managementGroupChildResourceName, ManagementGroupChildResourceInner properties, Context context) {
+ Response inner = this.serviceClient()
+ .updateWithResponse(managementGroupId, managementGroupChildResourceName, properties, context);
+ return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
+ new ManagementGroupChildResourceImpl(inner.getValue(), this.manager()));
+ }
+
+ public ManagementGroupChildResource update(String managementGroupId, String managementGroupChildResourceName,
+ ManagementGroupChildResourceInner properties) {
+ ManagementGroupChildResourceInner inner
+ = this.serviceClient().update(managementGroupId, managementGroupChildResourceName, properties);
+ if (inner != null) {
+ return new ManagementGroupChildResourceImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response deleteByResourceGroupWithResponse(String managementGroupId,
+ String managementGroupChildResourceName, Context context) {
+ return this.serviceClient().deleteWithResponse(managementGroupId, managementGroupChildResourceName, context);
+ }
+
+ public void deleteByResourceGroup(String managementGroupId, String managementGroupChildResourceName) {
+ this.serviceClient().delete(managementGroupId, managementGroupChildResourceName);
+ }
+
+ public PagedIterable listByManagementGroup(String managementGroupId) {
+ PagedIterable inner
+ = this.serviceClient().listByManagementGroup(managementGroupId);
+ return ResourceManagerUtils.mapPage(inner,
+ inner1 -> new ManagementGroupChildResourceImpl(inner1, this.manager()));
+ }
+
+ public PagedIterable listByManagementGroup(String managementGroupId,
+ Context context) {
+ PagedIterable inner
+ = this.serviceClient().listByManagementGroup(managementGroupId, context);
+ return ResourceManagerUtils.mapPage(inner,
+ inner1 -> new ManagementGroupChildResourceImpl(inner1, this.manager()));
+ }
+
+ private ManagementGroupChildResourcesClient serviceClient() {
+ return this.innerClient;
+ }
+
+ private azure.resourcemanager.managementgroup.ManagementGroupManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupClientBuilder.java
new file mode 100644
index 00000000000..9a5147e1909
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupClientBuilder.java
@@ -0,0 +1,122 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.implementation;
+
+import com.azure.core.annotation.ServiceClientBuilder;
+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.management.AzureEnvironment;
+import com.azure.core.management.serializer.SerializerFactory;
+import com.azure.core.util.serializer.SerializerAdapter;
+import java.time.Duration;
+
+/**
+ * A builder for creating a new instance of the ManagementGroupClientImpl type.
+ */
+@ServiceClientBuilder(serviceClients = { ManagementGroupClientImpl.class })
+public final class ManagementGroupClientBuilder {
+ /*
+ * Service host
+ */
+ private String endpoint;
+
+ /**
+ * Sets Service host.
+ *
+ * @param endpoint the endpoint value.
+ * @return the ManagementGroupClientBuilder.
+ */
+ public ManagementGroupClientBuilder endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ /*
+ * The environment to connect to
+ */
+ private AzureEnvironment environment;
+
+ /**
+ * Sets The environment to connect to.
+ *
+ * @param environment the environment value.
+ * @return the ManagementGroupClientBuilder.
+ */
+ public ManagementGroupClientBuilder environment(AzureEnvironment environment) {
+ this.environment = environment;
+ return this;
+ }
+
+ /*
+ * The HTTP pipeline to send requests through
+ */
+ private HttpPipeline pipeline;
+
+ /**
+ * Sets The HTTP pipeline to send requests through.
+ *
+ * @param pipeline the pipeline value.
+ * @return the ManagementGroupClientBuilder.
+ */
+ public ManagementGroupClientBuilder pipeline(HttpPipeline pipeline) {
+ this.pipeline = pipeline;
+ return this;
+ }
+
+ /*
+ * The default poll interval for long-running operation
+ */
+ private Duration defaultPollInterval;
+
+ /**
+ * Sets The default poll interval for long-running operation.
+ *
+ * @param defaultPollInterval the defaultPollInterval value.
+ * @return the ManagementGroupClientBuilder.
+ */
+ public ManagementGroupClientBuilder defaultPollInterval(Duration defaultPollInterval) {
+ this.defaultPollInterval = defaultPollInterval;
+ return this;
+ }
+
+ /*
+ * The serializer to serialize an object into a string
+ */
+ private SerializerAdapter serializerAdapter;
+
+ /**
+ * Sets The serializer to serialize an object into a string.
+ *
+ * @param serializerAdapter the serializerAdapter value.
+ * @return the ManagementGroupClientBuilder.
+ */
+ public ManagementGroupClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) {
+ this.serializerAdapter = serializerAdapter;
+ return this;
+ }
+
+ /**
+ * Builds an instance of ManagementGroupClientImpl with the provided parameters.
+ *
+ * @return an instance of ManagementGroupClientImpl.
+ */
+ public ManagementGroupClientImpl buildClient() {
+ String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com";
+ AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE;
+ HttpPipeline localPipeline = (pipeline != null)
+ ? pipeline
+ : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build();
+ Duration localDefaultPollInterval
+ = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30);
+ SerializerAdapter localSerializerAdapter = (serializerAdapter != null)
+ ? serializerAdapter
+ : SerializerFactory.createDefaultManagementSerializerAdapter();
+ ManagementGroupClientImpl client = new ManagementGroupClientImpl(localPipeline, localSerializerAdapter,
+ localDefaultPollInterval, localEnvironment, localEndpoint);
+ return client;
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupClientImpl.java
new file mode 100644
index 00000000000..839fee59369
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ManagementGroupClientImpl.java
@@ -0,0 +1,292 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.implementation;
+
+import azure.resourcemanager.managementgroup.fluent.ManagementGroupChildResourcesClient;
+import azure.resourcemanager.managementgroup.fluent.ManagementGroupClient;
+import com.azure.core.annotation.ServiceClient;
+import com.azure.core.http.HttpHeaderName;
+import com.azure.core.http.HttpHeaders;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpResponse;
+import com.azure.core.http.rest.Response;
+import com.azure.core.management.AzureEnvironment;
+import com.azure.core.management.exception.ManagementError;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.management.polling.PollResult;
+import com.azure.core.management.polling.PollerFactory;
+import com.azure.core.management.polling.SyncPollerFactory;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.Context;
+import com.azure.core.util.CoreUtils;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.polling.AsyncPollResponse;
+import com.azure.core.util.polling.LongRunningOperationStatus;
+import com.azure.core.util.polling.PollerFlux;
+import com.azure.core.util.polling.SyncPoller;
+import com.azure.core.util.serializer.SerializerAdapter;
+import com.azure.core.util.serializer.SerializerEncoding;
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.time.Duration;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the ManagementGroupClientImpl type.
+ */
+@ServiceClient(builder = ManagementGroupClientBuilder.class)
+public final class ManagementGroupClientImpl implements ManagementGroupClient {
+ /**
+ * Service host.
+ */
+ private final String endpoint;
+
+ /**
+ * Gets Service host.
+ *
+ * @return the endpoint value.
+ */
+ public String getEndpoint() {
+ return this.endpoint;
+ }
+
+ /**
+ * Version parameter.
+ */
+ private final String apiVersion;
+
+ /**
+ * Gets Version parameter.
+ *
+ * @return the apiVersion value.
+ */
+ public String getApiVersion() {
+ return this.apiVersion;
+ }
+
+ /**
+ * 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.
+ */
+ SerializerAdapter getSerializerAdapter() {
+ return this.serializerAdapter;
+ }
+
+ /**
+ * The default poll interval for long-running operation.
+ */
+ private final Duration defaultPollInterval;
+
+ /**
+ * Gets The default poll interval for long-running operation.
+ *
+ * @return the defaultPollInterval value.
+ */
+ public Duration getDefaultPollInterval() {
+ return this.defaultPollInterval;
+ }
+
+ /**
+ * The ManagementGroupChildResourcesClient object to access its operations.
+ */
+ private final ManagementGroupChildResourcesClient managementGroupChildResources;
+
+ /**
+ * Gets the ManagementGroupChildResourcesClient object to access its operations.
+ *
+ * @return the ManagementGroupChildResourcesClient object.
+ */
+ public ManagementGroupChildResourcesClient getManagementGroupChildResources() {
+ return this.managementGroupChildResources;
+ }
+
+ /**
+ * Initializes an instance of ManagementGroupClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param serializerAdapter The serializer to serialize an object into a string.
+ * @param defaultPollInterval The default poll interval for long-running operation.
+ * @param environment The Azure environment.
+ * @param endpoint Service host.
+ */
+ ManagementGroupClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter,
+ Duration defaultPollInterval, AzureEnvironment environment, String endpoint) {
+ this.httpPipeline = httpPipeline;
+ this.serializerAdapter = serializerAdapter;
+ this.defaultPollInterval = defaultPollInterval;
+ this.endpoint = endpoint;
+ this.apiVersion = "2023-12-01-preview";
+ this.managementGroupChildResources = new ManagementGroupChildResourcesClientImpl(this);
+ }
+
+ /**
+ * Gets default client context.
+ *
+ * @return the default client context.
+ */
+ public Context getContext() {
+ return Context.NONE;
+ }
+
+ /**
+ * Merges default client context with provided context.
+ *
+ * @param context the context to be merged with default client context.
+ * @return the merged context.
+ */
+ public Context mergeContext(Context context) {
+ return CoreUtils.mergeContexts(this.getContext(), context);
+ }
+
+ /**
+ * Gets long running operation result.
+ *
+ * @param activationResponse the response of activation operation.
+ * @param httpPipeline the http pipeline.
+ * @param pollResultType type of poll result.
+ * @param finalResultType type of final result.
+ * @param context the context shared by all requests.
+ * @param type of poll result.
+ * @param type of final result.
+ * @return poller flux for poll result and final result.
+ */
+ public PollerFlux, U> getLroResult(Mono>> activationResponse,
+ HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) {
+ return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType,
+ defaultPollInterval, activationResponse, context);
+ }
+
+ /**
+ * Gets long running operation result.
+ *
+ * @param activationResponse the response of activation operation.
+ * @param pollResultType type of poll result.
+ * @param finalResultType type of final result.
+ * @param context the context shared by all requests.
+ * @param type of poll result.
+ * @param type of final result.
+ * @return SyncPoller for poll result and final result.
+ */
+ public SyncPoller, U> getLroResult(Response activationResponse,
+ Type pollResultType, Type finalResultType, Context context) {
+ return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType,
+ defaultPollInterval, () -> activationResponse, context);
+ }
+
+ /**
+ * Gets the final result, or an error, based on last async poll response.
+ *
+ * @param response the last async poll response.
+ * @param type of poll result.
+ * @param type of final result.
+ * @return the final result, or an error.
+ */
+ public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) {
+ if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) {
+ String errorMessage;
+ ManagementError managementError = null;
+ HttpResponse errorResponse = null;
+ PollResult.Error lroError = response.getValue().getError();
+ if (lroError != null) {
+ errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(),
+ lroError.getResponseBody());
+
+ errorMessage = response.getValue().getError().getMessage();
+ String errorBody = response.getValue().getError().getResponseBody();
+ if (errorBody != null) {
+ // try to deserialize error body to ManagementError
+ try {
+ managementError = this.getSerializerAdapter()
+ .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON);
+ if (managementError.getCode() == null || managementError.getMessage() == null) {
+ managementError = null;
+ }
+ } catch (IOException | RuntimeException ioe) {
+ LOGGER.logThrowableAsWarning(ioe);
+ }
+ }
+ } else {
+ // fallback to default error message
+ errorMessage = "Long running operation failed.";
+ }
+ if (managementError == null) {
+ // fallback to default ManagementError
+ managementError = new ManagementError(response.getStatus().toString(), errorMessage);
+ }
+ return Mono.error(new ManagementException(errorMessage, errorResponse, managementError));
+ } else {
+ return response.getFinalResult();
+ }
+ }
+
+ private static final class HttpResponseImpl extends HttpResponse {
+ private final int statusCode;
+
+ private final byte[] responseBody;
+
+ private final HttpHeaders httpHeaders;
+
+ HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) {
+ super(null);
+ this.statusCode = statusCode;
+ this.httpHeaders = httpHeaders;
+ this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8);
+ }
+
+ public int getStatusCode() {
+ return statusCode;
+ }
+
+ public String getHeaderValue(String s) {
+ return httpHeaders.getValue(HttpHeaderName.fromString(s));
+ }
+
+ public HttpHeaders getHeaders() {
+ return httpHeaders;
+ }
+
+ public Flux getBody() {
+ return Flux.just(ByteBuffer.wrap(responseBody));
+ }
+
+ public Mono getBodyAsByteArray() {
+ return Mono.just(responseBody);
+ }
+
+ public Mono getBodyAsString() {
+ return Mono.just(new String(responseBody, StandardCharsets.UTF_8));
+ }
+
+ public Mono getBodyAsString(Charset charset) {
+ return Mono.just(new String(responseBody, charset));
+ }
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(ManagementGroupClientImpl.class);
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ResourceManagerUtils.java
new file mode 100644
index 00000000000..1734d5cff5b
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/ResourceManagerUtils.java
@@ -0,0 +1,195 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.implementation;
+
+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.util.CoreUtils;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import reactor.core.publisher.Flux;
+
+final class ResourceManagerUtils {
+ private ResourceManagerUtils() {
+ }
+
+ static String getValueFromIdByName(String id, String name) {
+ if (id == null) {
+ return null;
+ }
+ Iterator itr = Arrays.stream(id.split("/")).iterator();
+ while (itr.hasNext()) {
+ String part = itr.next();
+ if (part != null && !part.trim().isEmpty()) {
+ if (part.equalsIgnoreCase(name)) {
+ if (itr.hasNext()) {
+ return itr.next();
+ } else {
+ return null;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) {
+ if (id == null || pathTemplate == null) {
+ return null;
+ }
+ String parameterNameParentheses = "{" + parameterName + "}";
+ List idSegmentsReverted = Arrays.asList(id.split("/"));
+ List pathSegments = Arrays.asList(pathTemplate.split("/"));
+ Collections.reverse(idSegmentsReverted);
+ Iterator idItrReverted = idSegmentsReverted.iterator();
+ int pathIndex = pathSegments.size();
+ while (idItrReverted.hasNext() && pathIndex > 0) {
+ String idSegment = idItrReverted.next();
+ String pathSegment = pathSegments.get(--pathIndex);
+ if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) {
+ if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) {
+ if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) {
+ List segments = new ArrayList<>();
+ segments.add(idSegment);
+ idItrReverted.forEachRemaining(segments::add);
+ Collections.reverse(segments);
+ if (!segments.isEmpty() && segments.get(0).isEmpty()) {
+ segments.remove(0);
+ }
+ return String.join("/", segments);
+ } else {
+ return idSegment;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) {
+ return new PagedIterableImpl<>(pageIterable, mapper);
+ }
+
+ private static final class PagedIterableImpl extends PagedIterable {
+
+ private final PagedIterable pagedIterable;
+ private final Function mapper;
+ private final Function, PagedResponse> pageMapper;
+
+ private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) {
+ super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux
+ .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper)))));
+ this.pagedIterable = pagedIterable;
+ this.mapper = mapper;
+ this.pageMapper = getPageMapper(mapper);
+ }
+
+ private static Function, PagedResponse> getPageMapper(Function mapper) {
+ return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(),
+ page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(),
+ null);
+ }
+
+ @Override
+ public Stream stream() {
+ return pagedIterable.stream().map(mapper);
+ }
+
+ @Override
+ public Stream> streamByPage() {
+ return pagedIterable.streamByPage().map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(String continuationToken) {
+ return pagedIterable.streamByPage(continuationToken).map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(int preferredPageSize) {
+ return pagedIterable.streamByPage(preferredPageSize).map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(String continuationToken, int preferredPageSize) {
+ return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper);
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new IteratorImpl<>(pagedIterable.iterator(), mapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage() {
+ return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(String continuationToken) {
+ return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(int preferredPageSize) {
+ return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(String continuationToken, int preferredPageSize) {
+ return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper);
+ }
+ }
+
+ private static final class IteratorImpl implements Iterator {
+
+ private final Iterator iterator;
+ private final Function mapper;
+
+ private IteratorImpl(Iterator iterator, Function mapper) {
+ this.iterator = iterator;
+ this.mapper = mapper;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ @Override
+ public S next() {
+ return mapper.apply(iterator.next());
+ }
+
+ @Override
+ public void remove() {
+ iterator.remove();
+ }
+ }
+
+ private static final class IterableImpl implements Iterable {
+
+ private final Iterable iterable;
+ private final Function mapper;
+
+ private IterableImpl(Iterable iterable, Function mapper) {
+ this.iterable = iterable;
+ this.mapper = mapper;
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new IteratorImpl<>(iterable.iterator(), mapper);
+ }
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/models/ManagementGroupChildResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/models/ManagementGroupChildResourceListResult.java
new file mode 100644
index 00000000000..7aa4fba8867
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/managementgroup/implementation/models/ManagementGroupChildResourceListResult.java
@@ -0,0 +1,98 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package azure.resourcemanager.managementgroup.implementation.models;
+
+import azure.resourcemanager.managementgroup.fluent.models.ManagementGroupChildResourceInner;
+import com.azure.core.annotation.Immutable;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonSerializable;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * The response of a ManagementGroupChildResource list operation.
+ */
+@Immutable
+public final class ManagementGroupChildResourceListResult
+ implements JsonSerializable