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 Service Groups service API entry point.
+ *
+ * @param credential the credential to use.
+ * @param profile the Azure profile for client.
+ * @return the Service Groups service API instance.
+ */
+ public ServiceGroupsManager 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("com.azure.resourcemanager.servicegroups")
+ .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 ServiceGroupsManager(httpPipeline, profile, defaultPollInterval);
+ }
+ }
+
+ /**
+ * Gets the resource collection API of ServiceGroups.
+ *
+ * @return Resource collection API of ServiceGroups.
+ */
+ public ServiceGroups serviceGroups() {
+ if (this.serviceGroups == null) {
+ this.serviceGroups = new ServiceGroupsImpl(clientObject.getServiceGroups(), this);
+ }
+ return serviceGroups;
+ }
+
+ /**
+ * Gets the resource collection API of ResourceProviders.
+ *
+ * @return Resource collection API of ResourceProviders.
+ */
+ public ResourceProviders resourceProviders() {
+ if (this.resourceProviders == null) {
+ this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this);
+ }
+ return resourceProviders;
+ }
+
+ /**
+ * Gets wrapped service client ServiceGroupsManagementClient providing direct access to the underlying
+ * auto-generated API implementation, based on Azure REST API.
+ *
+ * @return Wrapped service client ServiceGroupsManagementClient.
+ */
+ public ServiceGroupsManagementClient serviceClient() {
+ return this.clientObject;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/ResourceProvidersClient.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/ResourceProvidersClient.java
new file mode 100644
index 000000000000..bd1320b12d0d
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/ResourceProvidersClient.java
@@ -0,0 +1,179 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.fluent;
+
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.management.polling.PollResult;
+import com.azure.core.util.Context;
+import com.azure.core.util.polling.SyncPoller;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+
+/**
+ * An instance of this class provides access to all the operations defined in ResourceProvidersClient.
+ */
+public interface ResourceProvidersClient {
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, ServiceGroupInner>
+ beginCreateOrUpdateServiceGroup(String serviceGroupName, ServiceGroupInner createServiceGroupRequest);
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, ServiceGroupInner> beginCreateOrUpdateServiceGroup(
+ String serviceGroupName, ServiceGroupInner createServiceGroupRequest, Context context);
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ServiceGroupInner createOrUpdateServiceGroup(String serviceGroupName, ServiceGroupInner createServiceGroupRequest);
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ServiceGroupInner createOrUpdateServiceGroup(String serviceGroupName, ServiceGroupInner createServiceGroupRequest,
+ Context context);
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, ServiceGroupInner> beginUpdateServiceGroup(String serviceGroupName,
+ ServiceGroupInner updateServiceGroupRequest);
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, ServiceGroupInner> beginUpdateServiceGroup(String serviceGroupName,
+ ServiceGroupInner updateServiceGroupRequest, Context context);
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ServiceGroupInner updateServiceGroup(String serviceGroupName, ServiceGroupInner updateServiceGroupRequest);
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ServiceGroupInner updateServiceGroup(String serviceGroupName, ServiceGroupInner updateServiceGroupRequest,
+ Context context);
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, Void> beginDeleteServiceGroup(String serviceGroupName);
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller, Void> beginDeleteServiceGroup(String serviceGroupName, Context context);
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 deleteServiceGroup(String serviceGroupName);
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ void deleteServiceGroup(String serviceGroupName, Context context);
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/ServiceGroupsClient.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/ServiceGroupsClient.java
new file mode 100644
index 000000000000..dd2d5279deae
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/ServiceGroupsClient.java
@@ -0,0 +1,67 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.fluent;
+
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.Context;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupCollectionResponseInner;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+
+/**
+ * An instance of this class provides access to all the operations defined in ServiceGroupsClient.
+ */
+public interface ServiceGroupsClient {
+ /**
+ * Get the details of the serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response getWithResponse(String serviceGroupName, Context context);
+
+ /**
+ * Get the details of the serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ServiceGroupInner get(String serviceGroupName);
+
+ /**
+ * Get the details of the serviceGroup's ancestors.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup's ancestors along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response listAncestorsWithResponse(String serviceGroupName, Context context);
+
+ /**
+ * Get the details of the serviceGroup's ancestors.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup's ancestors.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ServiceGroupCollectionResponseInner listAncestors(String serviceGroupName);
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/ServiceGroupsManagementClient.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/ServiceGroupsManagementClient.java
new file mode 100644
index 000000000000..ad086f69b4f9
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/ServiceGroupsManagementClient.java
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.fluent;
+
+import com.azure.core.http.HttpPipeline;
+import java.time.Duration;
+
+/**
+ * The interface for ServiceGroupsManagementClient class.
+ */
+public interface ServiceGroupsManagementClient {
+ /**
+ * Gets server parameter.
+ *
+ * @return the endpoint value.
+ */
+ String getEndpoint();
+
+ /**
+ * Gets Api Version.
+ *
+ * @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 ServiceGroupsClient object to access its operations.
+ *
+ * @return the ServiceGroupsClient object.
+ */
+ ServiceGroupsClient getServiceGroups();
+
+ /**
+ * Gets the ResourceProvidersClient object to access its operations.
+ *
+ * @return the ResourceProvidersClient object.
+ */
+ ResourceProvidersClient getResourceProviders();
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/models/ServiceGroupCollectionResponseInner.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/models/ServiceGroupCollectionResponseInner.java
new file mode 100644
index 000000000000..a970dc66a085
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/models/ServiceGroupCollectionResponseInner.java
@@ -0,0 +1,128 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.fluent.models;
+
+import com.azure.core.annotation.Fluent;
+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;
+
+/**
+ * Response holding an array of service groups and a nextLink that supports pagination.
+ */
+@Fluent
+public final class ServiceGroupCollectionResponseInner
+ implements JsonSerializable {
+ /*
+ * Array of service groups based on the request criteria
+ */
+ private List value;
+
+ /*
+ * URL to query the next page of results for this request
+ */
+ private String nextLink;
+
+ /**
+ * Creates an instance of ServiceGroupCollectionResponseInner class.
+ */
+ public ServiceGroupCollectionResponseInner() {
+ }
+
+ /**
+ * Get the value property: Array of service groups based on the request criteria.
+ *
+ * @return the value value.
+ */
+ public List value() {
+ return this.value;
+ }
+
+ /**
+ * Set the value property: Array of service groups based on the request criteria.
+ *
+ * @param value the value value to set.
+ * @return the ServiceGroupCollectionResponseInner object itself.
+ */
+ public ServiceGroupCollectionResponseInner withValue(List value) {
+ this.value = value;
+ return this;
+ }
+
+ /**
+ * Get the nextLink property: URL to query the next page of results for this request.
+ *
+ * @return the nextLink value.
+ */
+ public String nextLink() {
+ return this.nextLink;
+ }
+
+ /**
+ * Set the nextLink property: URL to query the next page of results for this request.
+ *
+ * @param nextLink the nextLink value to set.
+ * @return the ServiceGroupCollectionResponseInner object itself.
+ */
+ public ServiceGroupCollectionResponseInner withNextLink(String nextLink) {
+ this.nextLink = nextLink;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (value() != null) {
+ value().forEach(e -> e.validate());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element));
+ jsonWriter.writeStringField("nextLink", this.nextLink);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ServiceGroupCollectionResponseInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ServiceGroupCollectionResponseInner if the JsonReader was pointing to an instance of it,
+ * or null if it was pointing to JSON null.
+ * @throws IOException If an error occurs while reading the ServiceGroupCollectionResponseInner.
+ */
+ public static ServiceGroupCollectionResponseInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ServiceGroupCollectionResponseInner deserializedServiceGroupCollectionResponseInner
+ = new ServiceGroupCollectionResponseInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("value".equals(fieldName)) {
+ List value = reader.readArray(reader1 -> ServiceGroupInner.fromJson(reader1));
+ deserializedServiceGroupCollectionResponseInner.value = value;
+ } else if ("nextLink".equals(fieldName)) {
+ deserializedServiceGroupCollectionResponseInner.nextLink = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedServiceGroupCollectionResponseInner;
+ });
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/models/ServiceGroupInner.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/models/ServiceGroupInner.java
new file mode 100644
index 000000000000..c071c6d7aeb4
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/models/ServiceGroupInner.java
@@ -0,0 +1,224 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.fluent.models;
+
+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 com.azure.resourcemanager.servicegroups.models.ServiceGroupProperties;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * The serviceGroup details.
+ */
+@Fluent
+public final class ServiceGroupInner extends ProxyResource {
+ /*
+ * The kind of the serviceGroup.
+ */
+ private String kind;
+
+ /*
+ * The serviceGroup tags.
+ */
+ private Map tags;
+
+ /*
+ * ServiceGroup creation request body parameters.
+ */
+ private ServiceGroupProperties 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 ServiceGroupInner class.
+ */
+ public ServiceGroupInner() {
+ }
+
+ /**
+ * Get the kind property: The kind of the serviceGroup.
+ *
+ * @return the kind value.
+ */
+ public String kind() {
+ return this.kind;
+ }
+
+ /**
+ * Set the kind property: The kind of the serviceGroup.
+ *
+ * @param kind the kind value to set.
+ * @return the ServiceGroupInner object itself.
+ */
+ public ServiceGroupInner withKind(String kind) {
+ this.kind = kind;
+ return this;
+ }
+
+ /**
+ * Get the tags property: The serviceGroup tags.
+ *
+ * @return the tags value.
+ */
+ public Map tags() {
+ return this.tags;
+ }
+
+ /**
+ * Set the tags property: The serviceGroup tags.
+ *
+ * @param tags the tags value to set.
+ * @return the ServiceGroupInner object itself.
+ */
+ public ServiceGroupInner withTags(Map tags) {
+ this.tags = tags;
+ return this;
+ }
+
+ /**
+ * Get the properties property: ServiceGroup creation request body parameters.
+ *
+ * @return the properties value.
+ */
+ public ServiceGroupProperties properties() {
+ return this.properties;
+ }
+
+ /**
+ * Set the properties property: ServiceGroup creation request body parameters.
+ *
+ * @param properties the properties value to set.
+ * @return the ServiceGroupInner object itself.
+ */
+ public ServiceGroupInner withProperties(ServiceGroupProperties 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;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (properties() != null) {
+ properties().validate();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("kind", this.kind);
+ jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
+ jsonWriter.writeJsonField("properties", this.properties);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ServiceGroupInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ServiceGroupInner 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 ServiceGroupInner.
+ */
+ public static ServiceGroupInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ServiceGroupInner deserializedServiceGroupInner = new ServiceGroupInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedServiceGroupInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedServiceGroupInner.name = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedServiceGroupInner.type = reader.getString();
+ } else if ("kind".equals(fieldName)) {
+ deserializedServiceGroupInner.kind = reader.getString();
+ } else if ("tags".equals(fieldName)) {
+ Map tags = reader.readMap(reader1 -> reader1.getString());
+ deserializedServiceGroupInner.tags = tags;
+ } else if ("properties".equals(fieldName)) {
+ deserializedServiceGroupInner.properties = ServiceGroupProperties.fromJson(reader);
+ } else if ("systemData".equals(fieldName)) {
+ deserializedServiceGroupInner.systemData = SystemData.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedServiceGroupInner;
+ });
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/models/package-info.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/models/package-info.java
new file mode 100644
index 000000000000..b7bb97f4ebe7
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/models/package-info.java
@@ -0,0 +1,11 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the inner data models for ServiceGroupsManagementClient.
+ * The Groups RP provides Service Groups as a construct to group multiple resources, resource groups, subscriptions and
+ * other service groups into an organizational hierarchy and centrally manage access control, policies, alerting and
+ * reporting for those resources.
+ */
+package com.azure.resourcemanager.servicegroups.fluent.models;
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/package-info.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/package-info.java
new file mode 100644
index 000000000000..57599a4ff330
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/fluent/package-info.java
@@ -0,0 +1,11 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the service clients for ServiceGroupsManagementClient.
+ * The Groups RP provides Service Groups as a construct to group multiple resources, resource groups, subscriptions and
+ * other service groups into an organizational hierarchy and centrally manage access control, policies, alerting and
+ * reporting for those resources.
+ */
+package com.azure.resourcemanager.servicegroups.fluent;
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ResourceManagerUtils.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ResourceManagerUtils.java
new file mode 100644
index 000000000000..f1f8904685bb
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ResourceManagerUtils.java
@@ -0,0 +1,195 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.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/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ResourceProvidersClientImpl.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ResourceProvidersClientImpl.java
new file mode 100644
index 000000000000..80b45831927e
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ResourceProvidersClientImpl.java
@@ -0,0 +1,709 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.implementation;
+
+import com.azure.core.annotation.BodyParam;
+import com.azure.core.annotation.Delete;
+import com.azure.core.annotation.ExpectedResponses;
+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.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.logging.ClientLogger;
+import com.azure.core.util.polling.PollerFlux;
+import com.azure.core.util.polling.SyncPoller;
+import com.azure.resourcemanager.servicegroups.fluent.ResourceProvidersClient;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+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 ResourceProvidersClient.
+ */
+public final class ResourceProvidersClientImpl implements ResourceProvidersClient {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final ResourceProvidersService service;
+
+ /**
+ * The service client containing this operation class.
+ */
+ private final ServiceGroupsManagementClientImpl client;
+
+ /**
+ * Initializes an instance of ResourceProvidersClientImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ ResourceProvidersClientImpl(ServiceGroupsManagementClientImpl client) {
+ this.service
+ = RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for ServiceGroupsManagementClientResourceProviders to be used by the
+ * proxy service to perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "ServiceGroupsManagementClientResourceProviders")
+ public interface ResourceProvidersService {
+ @Headers({ "Content-Type: application/json" })
+ @Put("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}")
+ @ExpectedResponses({ 200, 201 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono>> createOrUpdateServiceGroup(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @BodyParam("application/json") ServiceGroupInner createServiceGroupRequest,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Put("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}")
+ @ExpectedResponses({ 200, 201 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response createOrUpdateServiceGroupSync(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @BodyParam("application/json") ServiceGroupInner createServiceGroupRequest,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Patch("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}")
+ @ExpectedResponses({ 200, 202 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono>> updateServiceGroup(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @BodyParam("application/json") ServiceGroupInner updateServiceGroupRequest,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Patch("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}")
+ @ExpectedResponses({ 200, 202 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response updateServiceGroupSync(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @BodyParam("application/json") ServiceGroupInner updateServiceGroupRequest,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Delete("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}")
+ @ExpectedResponses({ 202, 204 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono>> deleteServiceGroup(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Delete("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}")
+ @ExpectedResponses({ 202, 204 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response deleteServiceGroupSync(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, Context context);
+ }
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>> createOrUpdateServiceGroupWithResponseAsync(String serviceGroupName,
+ ServiceGroupInner createServiceGroupRequest) {
+ if (this.client.getEndpoint() == null) {
+ return Mono.error(
+ new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ return Mono
+ .error(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ if (createServiceGroupRequest == null) {
+ return Mono.error(
+ new IllegalArgumentException("Parameter createServiceGroupRequest is required and cannot be null."));
+ } else {
+ createServiceGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.createOrUpdateServiceGroup(this.client.getEndpoint(), serviceGroupName,
+ this.client.getApiVersion(), createServiceGroupRequest, accept, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response createOrUpdateServiceGroupWithResponse(String serviceGroupName,
+ ServiceGroupInner createServiceGroupRequest) {
+ if (this.client.getEndpoint() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ if (createServiceGroupRequest == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter createServiceGroupRequest is required and cannot be null."));
+ } else {
+ createServiceGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ return service.createOrUpdateServiceGroupSync(this.client.getEndpoint(), serviceGroupName,
+ this.client.getApiVersion(), createServiceGroupRequest, accept, Context.NONE);
+ }
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response createOrUpdateServiceGroupWithResponse(String serviceGroupName,
+ ServiceGroupInner createServiceGroupRequest, Context context) {
+ if (this.client.getEndpoint() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ if (createServiceGroupRequest == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter createServiceGroupRequest is required and cannot be null."));
+ } else {
+ createServiceGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ return service.createOrUpdateServiceGroupSync(this.client.getEndpoint(), serviceGroupName,
+ this.client.getApiVersion(), createServiceGroupRequest, accept, context);
+ }
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, ServiceGroupInner>
+ beginCreateOrUpdateServiceGroupAsync(String serviceGroupName, ServiceGroupInner createServiceGroupRequest) {
+ Mono>> mono
+ = createOrUpdateServiceGroupWithResponseAsync(serviceGroupName, createServiceGroupRequest);
+ return this.client.getLroResult(mono, this.client.getHttpPipeline(),
+ ServiceGroupInner.class, ServiceGroupInner.class, this.client.getContext());
+ }
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ServiceGroupInner>
+ beginCreateOrUpdateServiceGroup(String serviceGroupName, ServiceGroupInner createServiceGroupRequest) {
+ Response response
+ = createOrUpdateServiceGroupWithResponse(serviceGroupName, createServiceGroupRequest);
+ return this.client.getLroResult(response, ServiceGroupInner.class,
+ ServiceGroupInner.class, Context.NONE);
+ }
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ServiceGroupInner> beginCreateOrUpdateServiceGroup(
+ String serviceGroupName, ServiceGroupInner createServiceGroupRequest, Context context) {
+ Response response
+ = createOrUpdateServiceGroupWithResponse(serviceGroupName, createServiceGroupRequest, context);
+ return this.client.getLroResult(response, ServiceGroupInner.class,
+ ServiceGroupInner.class, context);
+ }
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono createOrUpdateServiceGroupAsync(String serviceGroupName,
+ ServiceGroupInner createServiceGroupRequest) {
+ return beginCreateOrUpdateServiceGroupAsync(serviceGroupName, createServiceGroupRequest).last()
+ .flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ServiceGroupInner createOrUpdateServiceGroup(String serviceGroupName,
+ ServiceGroupInner createServiceGroupRequest) {
+ return beginCreateOrUpdateServiceGroup(serviceGroupName, createServiceGroupRequest).getFinalResult();
+ }
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ServiceGroupInner createOrUpdateServiceGroup(String serviceGroupName,
+ ServiceGroupInner createServiceGroupRequest, Context context) {
+ return beginCreateOrUpdateServiceGroup(serviceGroupName, createServiceGroupRequest, context).getFinalResult();
+ }
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>> updateServiceGroupWithResponseAsync(String serviceGroupName,
+ ServiceGroupInner updateServiceGroupRequest) {
+ if (this.client.getEndpoint() == null) {
+ return Mono.error(
+ new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ return Mono
+ .error(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ if (updateServiceGroupRequest == null) {
+ return Mono.error(
+ new IllegalArgumentException("Parameter updateServiceGroupRequest is required and cannot be null."));
+ } else {
+ updateServiceGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.updateServiceGroup(this.client.getEndpoint(), serviceGroupName,
+ this.client.getApiVersion(), updateServiceGroupRequest, accept, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response updateServiceGroupWithResponse(String serviceGroupName,
+ ServiceGroupInner updateServiceGroupRequest) {
+ if (this.client.getEndpoint() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ if (updateServiceGroupRequest == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter updateServiceGroupRequest is required and cannot be null."));
+ } else {
+ updateServiceGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ return service.updateServiceGroupSync(this.client.getEndpoint(), serviceGroupName, this.client.getApiVersion(),
+ updateServiceGroupRequest, accept, Context.NONE);
+ }
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response updateServiceGroupWithResponse(String serviceGroupName,
+ ServiceGroupInner updateServiceGroupRequest, Context context) {
+ if (this.client.getEndpoint() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ if (updateServiceGroupRequest == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter updateServiceGroupRequest is required and cannot be null."));
+ } else {
+ updateServiceGroupRequest.validate();
+ }
+ final String accept = "application/json";
+ return service.updateServiceGroupSync(this.client.getEndpoint(), serviceGroupName, this.client.getApiVersion(),
+ updateServiceGroupRequest, accept, context);
+ }
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, ServiceGroupInner>
+ beginUpdateServiceGroupAsync(String serviceGroupName, ServiceGroupInner updateServiceGroupRequest) {
+ Mono>> mono
+ = updateServiceGroupWithResponseAsync(serviceGroupName, updateServiceGroupRequest);
+ return this.client.getLroResult(mono, this.client.getHttpPipeline(),
+ ServiceGroupInner.class, ServiceGroupInner.class, this.client.getContext());
+ }
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ServiceGroupInner> beginUpdateServiceGroup(String serviceGroupName,
+ ServiceGroupInner updateServiceGroupRequest) {
+ Response response = updateServiceGroupWithResponse(serviceGroupName, updateServiceGroupRequest);
+ return this.client.getLroResult(response, ServiceGroupInner.class,
+ ServiceGroupInner.class, Context.NONE);
+ }
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 the serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, ServiceGroupInner> beginUpdateServiceGroup(String serviceGroupName,
+ ServiceGroupInner updateServiceGroupRequest, Context context) {
+ Response response
+ = updateServiceGroupWithResponse(serviceGroupName, updateServiceGroupRequest, context);
+ return this.client.getLroResult(response, ServiceGroupInner.class,
+ ServiceGroupInner.class, context);
+ }
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono updateServiceGroupAsync(String serviceGroupName,
+ ServiceGroupInner updateServiceGroupRequest) {
+ return beginUpdateServiceGroupAsync(serviceGroupName, updateServiceGroupRequest).last()
+ .flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ServiceGroupInner updateServiceGroup(String serviceGroupName, ServiceGroupInner updateServiceGroupRequest) {
+ return beginUpdateServiceGroup(serviceGroupName, updateServiceGroupRequest).getFinalResult();
+ }
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ServiceGroupInner updateServiceGroup(String serviceGroupName, ServiceGroupInner updateServiceGroupRequest,
+ Context context) {
+ return beginUpdateServiceGroup(serviceGroupName, updateServiceGroupRequest, context).getFinalResult();
+ }
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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>> deleteServiceGroupWithResponseAsync(String serviceGroupName) {
+ if (this.client.getEndpoint() == null) {
+ return Mono.error(
+ new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ return Mono
+ .error(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.deleteServiceGroup(this.client.getEndpoint(), serviceGroupName,
+ this.client.getApiVersion(), accept, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 body along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response deleteServiceGroupWithResponse(String serviceGroupName) {
+ if (this.client.getEndpoint() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return service.deleteServiceGroupSync(this.client.getEndpoint(), serviceGroupName, this.client.getApiVersion(),
+ accept, Context.NONE);
+ }
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 body along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response deleteServiceGroupWithResponse(String serviceGroupName, Context context) {
+ if (this.client.getEndpoint() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return service.deleteServiceGroupSync(this.client.getEndpoint(), serviceGroupName, this.client.getApiVersion(),
+ accept, context);
+ }
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ private PollerFlux, Void> beginDeleteServiceGroupAsync(String serviceGroupName) {
+ Mono>> mono = deleteServiceGroupWithResponseAsync(serviceGroupName);
+ return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
+ this.client.getContext());
+ }
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, Void> beginDeleteServiceGroup(String serviceGroupName) {
+ Response response = deleteServiceGroupWithResponse(serviceGroupName);
+ return this.client.getLroResult(response, Void.class, Void.class, Context.NONE);
+ }
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 long-running operation.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller, Void> beginDeleteServiceGroup(String serviceGroupName, Context context) {
+ Response response = deleteServiceGroupWithResponse(serviceGroupName, context);
+ return this.client.getLroResult(response, Void.class, Void.class, context);
+ }
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 deleteServiceGroupAsync(String serviceGroupName) {
+ return beginDeleteServiceGroupAsync(serviceGroupName).last().flatMap(this.client::getLroFinalResultOrError);
+ }
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 deleteServiceGroup(String serviceGroupName) {
+ beginDeleteServiceGroup(serviceGroupName).getFinalResult();
+ }
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void deleteServiceGroup(String serviceGroupName, Context context) {
+ beginDeleteServiceGroup(serviceGroupName, context).getFinalResult();
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersClientImpl.class);
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ResourceProvidersImpl.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ResourceProvidersImpl.java
new file mode 100644
index 000000000000..f77074acce83
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ResourceProvidersImpl.java
@@ -0,0 +1,84 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.implementation;
+
+import com.azure.core.util.Context;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.servicegroups.fluent.ResourceProvidersClient;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ResourceProviders;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroup;
+
+public final class ResourceProvidersImpl implements ResourceProviders {
+ private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class);
+
+ private final ResourceProvidersClient innerClient;
+
+ private final com.azure.resourcemanager.servicegroups.ServiceGroupsManager serviceManager;
+
+ public ResourceProvidersImpl(ResourceProvidersClient innerClient,
+ com.azure.resourcemanager.servicegroups.ServiceGroupsManager serviceManager) {
+ this.innerClient = innerClient;
+ this.serviceManager = serviceManager;
+ }
+
+ public ServiceGroup createOrUpdateServiceGroup(String serviceGroupName,
+ ServiceGroupInner createServiceGroupRequest) {
+ ServiceGroupInner inner
+ = this.serviceClient().createOrUpdateServiceGroup(serviceGroupName, createServiceGroupRequest);
+ if (inner != null) {
+ return new ServiceGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public ServiceGroup createOrUpdateServiceGroup(String serviceGroupName, ServiceGroupInner createServiceGroupRequest,
+ Context context) {
+ ServiceGroupInner inner
+ = this.serviceClient().createOrUpdateServiceGroup(serviceGroupName, createServiceGroupRequest, context);
+ if (inner != null) {
+ return new ServiceGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public ServiceGroup updateServiceGroup(String serviceGroupName, ServiceGroupInner updateServiceGroupRequest) {
+ ServiceGroupInner inner = this.serviceClient().updateServiceGroup(serviceGroupName, updateServiceGroupRequest);
+ if (inner != null) {
+ return new ServiceGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public ServiceGroup updateServiceGroup(String serviceGroupName, ServiceGroupInner updateServiceGroupRequest,
+ Context context) {
+ ServiceGroupInner inner
+ = this.serviceClient().updateServiceGroup(serviceGroupName, updateServiceGroupRequest, context);
+ if (inner != null) {
+ return new ServiceGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public void deleteServiceGroup(String serviceGroupName) {
+ this.serviceClient().deleteServiceGroup(serviceGroupName);
+ }
+
+ public void deleteServiceGroup(String serviceGroupName, Context context) {
+ this.serviceClient().deleteServiceGroup(serviceGroupName, context);
+ }
+
+ private ResourceProvidersClient serviceClient() {
+ return this.innerClient;
+ }
+
+ private com.azure.resourcemanager.servicegroups.ServiceGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupCollectionResponseImpl.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupCollectionResponseImpl.java
new file mode 100644
index 000000000000..3e43f5d01e09
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupCollectionResponseImpl.java
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.implementation;
+
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupCollectionResponseInner;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroup;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupCollectionResponse;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public final class ServiceGroupCollectionResponseImpl implements ServiceGroupCollectionResponse {
+ private ServiceGroupCollectionResponseInner innerObject;
+
+ private final com.azure.resourcemanager.servicegroups.ServiceGroupsManager serviceManager;
+
+ ServiceGroupCollectionResponseImpl(ServiceGroupCollectionResponseInner innerObject,
+ com.azure.resourcemanager.servicegroups.ServiceGroupsManager serviceManager) {
+ this.innerObject = innerObject;
+ this.serviceManager = serviceManager;
+ }
+
+ public List value() {
+ List inner = this.innerModel().value();
+ if (inner != null) {
+ return Collections.unmodifiableList(inner.stream()
+ .map(inner1 -> new ServiceGroupImpl(inner1, this.manager()))
+ .collect(Collectors.toList()));
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ public String nextLink() {
+ return this.innerModel().nextLink();
+ }
+
+ public ServiceGroupCollectionResponseInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.servicegroups.ServiceGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupImpl.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupImpl.java
new file mode 100644
index 000000000000..172fabd7b4bb
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupImpl.java
@@ -0,0 +1,65 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.implementation;
+
+import com.azure.core.management.SystemData;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroup;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupProperties;
+import java.util.Collections;
+import java.util.Map;
+
+public final class ServiceGroupImpl implements ServiceGroup {
+ private ServiceGroupInner innerObject;
+
+ private final com.azure.resourcemanager.servicegroups.ServiceGroupsManager serviceManager;
+
+ ServiceGroupImpl(ServiceGroupInner innerObject,
+ com.azure.resourcemanager.servicegroups.ServiceGroupsManager 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 String kind() {
+ return this.innerModel().kind();
+ }
+
+ public Map tags() {
+ Map inner = this.innerModel().tags();
+ if (inner != null) {
+ return Collections.unmodifiableMap(inner);
+ } else {
+ return Collections.emptyMap();
+ }
+ }
+
+ public ServiceGroupProperties properties() {
+ return this.innerModel().properties();
+ }
+
+ public SystemData systemData() {
+ return this.innerModel().systemData();
+ }
+
+ public ServiceGroupInner innerModel() {
+ return this.innerObject;
+ }
+
+ private com.azure.resourcemanager.servicegroups.ServiceGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsClientImpl.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsClientImpl.java
new file mode 100644
index 000000000000..0991fbb9b141
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsClientImpl.java
@@ -0,0 +1,260 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.implementation;
+
+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.PathParam;
+import com.azure.core.annotation.Post;
+import com.azure.core.annotation.QueryParam;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.servicegroups.fluent.ServiceGroupsClient;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupCollectionResponseInner;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import reactor.core.publisher.Mono;
+
+/**
+ * An instance of this class provides access to all the operations defined in ServiceGroupsClient.
+ */
+public final class ServiceGroupsClientImpl implements ServiceGroupsClient {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final ServiceGroupsService service;
+
+ /**
+ * The service client containing this operation class.
+ */
+ private final ServiceGroupsManagementClientImpl client;
+
+ /**
+ * Initializes an instance of ServiceGroupsClientImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ ServiceGroupsClientImpl(ServiceGroupsManagementClientImpl client) {
+ this.service
+ = RestProxy.create(ServiceGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for ServiceGroupsManagementClientServiceGroups to be used by the proxy
+ * service to perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "ServiceGroupsManagementClientServiceGroups")
+ public interface ServiceGroupsService {
+ @Headers({ "Content-Type: application/json" })
+ @Get("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> get(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Get("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response getSync(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Post("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}/listAncestors")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Mono> listAncestors(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, Context context);
+
+ @Headers({ "Content-Type: application/json" })
+ @Post("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}/listAncestors")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(ManagementException.class)
+ Response listAncestorsSync(@HostParam("$host") String endpoint,
+ @PathParam("serviceGroupName") String serviceGroupName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, Context context);
+ }
+
+ /**
+ * Get the details of the serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> getWithResponseAsync(String serviceGroupName) {
+ if (this.client.getEndpoint() == null) {
+ return Mono.error(
+ new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ return Mono
+ .error(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.get(this.client.getEndpoint(), serviceGroupName,
+ this.client.getApiVersion(), accept, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get the details of the serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono getAsync(String serviceGroupName) {
+ return getWithResponseAsync(serviceGroupName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Get the details of the serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getWithResponse(String serviceGroupName, Context context) {
+ if (this.client.getEndpoint() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return service.getSync(this.client.getEndpoint(), serviceGroupName, this.client.getApiVersion(), accept,
+ context);
+ }
+
+ /**
+ * Get the details of the serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ServiceGroupInner get(String serviceGroupName) {
+ return getWithResponse(serviceGroupName, Context.NONE).getValue();
+ }
+
+ /**
+ * Get the details of the serviceGroup's ancestors.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup's ancestors along with {@link Response} on successful completion of
+ * {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono>
+ listAncestorsWithResponseAsync(String serviceGroupName) {
+ if (this.client.getEndpoint() == null) {
+ return Mono.error(
+ new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ return Mono
+ .error(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.listAncestors(this.client.getEndpoint(), serviceGroupName,
+ this.client.getApiVersion(), accept, context))
+ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
+ }
+
+ /**
+ * Get the details of the serviceGroup's ancestors.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup's ancestors on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono listAncestorsAsync(String serviceGroupName) {
+ return listAncestorsWithResponseAsync(serviceGroupName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
+ }
+
+ /**
+ * Get the details of the serviceGroup's ancestors.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup's ancestors along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response listAncestorsWithResponse(String serviceGroupName,
+ Context context) {
+ if (this.client.getEndpoint() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Parameter this.client.getEndpoint() is required and cannot be null."));
+ }
+ if (serviceGroupName == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Parameter serviceGroupName is required and cannot be null."));
+ }
+ final String accept = "application/json";
+ return service.listAncestorsSync(this.client.getEndpoint(), serviceGroupName, this.client.getApiVersion(),
+ accept, context);
+ }
+
+ /**
+ * Get the details of the serviceGroup's ancestors.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup's ancestors.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ServiceGroupCollectionResponseInner listAncestors(String serviceGroupName) {
+ return listAncestorsWithResponse(serviceGroupName, Context.NONE).getValue();
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(ServiceGroupsClientImpl.class);
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsImpl.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsImpl.java
new file mode 100644
index 000000000000..99da39ed7c4b
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsImpl.java
@@ -0,0 +1,78 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.implementation;
+
+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;
+import com.azure.resourcemanager.servicegroups.fluent.ServiceGroupsClient;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupCollectionResponseInner;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroup;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupCollectionResponse;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroups;
+
+public final class ServiceGroupsImpl implements ServiceGroups {
+ private static final ClientLogger LOGGER = new ClientLogger(ServiceGroupsImpl.class);
+
+ private final ServiceGroupsClient innerClient;
+
+ private final com.azure.resourcemanager.servicegroups.ServiceGroupsManager serviceManager;
+
+ public ServiceGroupsImpl(ServiceGroupsClient innerClient,
+ com.azure.resourcemanager.servicegroups.ServiceGroupsManager serviceManager) {
+ this.innerClient = innerClient;
+ this.serviceManager = serviceManager;
+ }
+
+ public Response getWithResponse(String serviceGroupName, Context context) {
+ Response inner = this.serviceClient().getWithResponse(serviceGroupName, context);
+ if (inner != null) {
+ return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
+ new ServiceGroupImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public ServiceGroup get(String serviceGroupName) {
+ ServiceGroupInner inner = this.serviceClient().get(serviceGroupName);
+ if (inner != null) {
+ return new ServiceGroupImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ public Response listAncestorsWithResponse(String serviceGroupName,
+ Context context) {
+ Response inner
+ = this.serviceClient().listAncestorsWithResponse(serviceGroupName, context);
+ if (inner != null) {
+ return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
+ new ServiceGroupCollectionResponseImpl(inner.getValue(), this.manager()));
+ } else {
+ return null;
+ }
+ }
+
+ public ServiceGroupCollectionResponse listAncestors(String serviceGroupName) {
+ ServiceGroupCollectionResponseInner inner = this.serviceClient().listAncestors(serviceGroupName);
+ if (inner != null) {
+ return new ServiceGroupCollectionResponseImpl(inner, this.manager());
+ } else {
+ return null;
+ }
+ }
+
+ private ServiceGroupsClient serviceClient() {
+ return this.innerClient;
+ }
+
+ private com.azure.resourcemanager.servicegroups.ServiceGroupsManager manager() {
+ return this.serviceManager;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsManagementClientBuilder.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsManagementClientBuilder.java
new file mode 100644
index 000000000000..384cd319f6b1
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsManagementClientBuilder.java
@@ -0,0 +1,122 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.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 ServiceGroupsManagementClientImpl type.
+ */
+@ServiceClientBuilder(serviceClients = { ServiceGroupsManagementClientImpl.class })
+public final class ServiceGroupsManagementClientBuilder {
+ /*
+ * server parameter
+ */
+ private String endpoint;
+
+ /**
+ * Sets server parameter.
+ *
+ * @param endpoint the endpoint value.
+ * @return the ServiceGroupsManagementClientBuilder.
+ */
+ public ServiceGroupsManagementClientBuilder 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 ServiceGroupsManagementClientBuilder.
+ */
+ public ServiceGroupsManagementClientBuilder 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 ServiceGroupsManagementClientBuilder.
+ */
+ public ServiceGroupsManagementClientBuilder 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 ServiceGroupsManagementClientBuilder.
+ */
+ public ServiceGroupsManagementClientBuilder 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 ServiceGroupsManagementClientBuilder.
+ */
+ public ServiceGroupsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) {
+ this.serializerAdapter = serializerAdapter;
+ return this;
+ }
+
+ /**
+ * Builds an instance of ServiceGroupsManagementClientImpl with the provided parameters.
+ *
+ * @return an instance of ServiceGroupsManagementClientImpl.
+ */
+ public ServiceGroupsManagementClientImpl 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();
+ ServiceGroupsManagementClientImpl client = new ServiceGroupsManagementClientImpl(localPipeline,
+ localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint);
+ return client;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsManagementClientImpl.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsManagementClientImpl.java
new file mode 100644
index 000000000000..89c15e625e12
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/ServiceGroupsManagementClientImpl.java
@@ -0,0 +1,308 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.implementation;
+
+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 com.azure.resourcemanager.servicegroups.fluent.ResourceProvidersClient;
+import com.azure.resourcemanager.servicegroups.fluent.ServiceGroupsClient;
+import com.azure.resourcemanager.servicegroups.fluent.ServiceGroupsManagementClient;
+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 ServiceGroupsManagementClientImpl type.
+ */
+@ServiceClient(builder = ServiceGroupsManagementClientBuilder.class)
+public final class ServiceGroupsManagementClientImpl implements ServiceGroupsManagementClient {
+ /**
+ * server parameter.
+ */
+ private final String endpoint;
+
+ /**
+ * Gets server parameter.
+ *
+ * @return the endpoint value.
+ */
+ public String getEndpoint() {
+ return this.endpoint;
+ }
+
+ /**
+ * Api Version.
+ */
+ private final String apiVersion;
+
+ /**
+ * Gets Api Version.
+ *
+ * @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 ServiceGroupsClient object to access its operations.
+ */
+ private final ServiceGroupsClient serviceGroups;
+
+ /**
+ * Gets the ServiceGroupsClient object to access its operations.
+ *
+ * @return the ServiceGroupsClient object.
+ */
+ public ServiceGroupsClient getServiceGroups() {
+ return this.serviceGroups;
+ }
+
+ /**
+ * The ResourceProvidersClient object to access its operations.
+ */
+ private final ResourceProvidersClient resourceProviders;
+
+ /**
+ * Gets the ResourceProvidersClient object to access its operations.
+ *
+ * @return the ResourceProvidersClient object.
+ */
+ public ResourceProvidersClient getResourceProviders() {
+ return this.resourceProviders;
+ }
+
+ /**
+ * Initializes an instance of ServiceGroupsManagementClient 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 server parameter.
+ */
+ ServiceGroupsManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter,
+ Duration defaultPollInterval, AzureEnvironment environment, String endpoint) {
+ this.httpPipeline = httpPipeline;
+ this.serializerAdapter = serializerAdapter;
+ this.defaultPollInterval = defaultPollInterval;
+ this.endpoint = endpoint;
+ this.apiVersion = "2024-02-01-preview";
+ this.serviceGroups = new ServiceGroupsClientImpl(this);
+ this.resourceProviders = new ResourceProvidersClientImpl(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(ServiceGroupsManagementClientImpl.class);
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/package-info.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/package-info.java
new file mode 100644
index 000000000000..4e6ad7ced579
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/implementation/package-info.java
@@ -0,0 +1,11 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the implementations for ServiceGroupsManagementClient.
+ * The Groups RP provides Service Groups as a construct to group multiple resources, resource groups, subscriptions and
+ * other service groups into an organizational hierarchy and centrally manage access control, policies, alerting and
+ * reporting for those resources.
+ */
+package com.azure.resourcemanager.servicegroups.implementation;
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ParentServiceGroupProperties.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ParentServiceGroupProperties.java
new file mode 100644
index 000000000000..db844542bc9b
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ParentServiceGroupProperties.java
@@ -0,0 +1,96 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonSerializable;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
+
+/**
+ * The details of the parent serviceGroup.
+ */
+@Fluent
+public final class ParentServiceGroupProperties implements JsonSerializable {
+ /*
+ * The fully qualified ID of the parent serviceGroup. For example,
+ * '/providers/Microsoft.Management/serviceGroups/TestServiceGroup'
+ */
+ private String resourceId;
+
+ /**
+ * Creates an instance of ParentServiceGroupProperties class.
+ */
+ public ParentServiceGroupProperties() {
+ }
+
+ /**
+ * Get the resourceId property: The fully qualified ID of the parent serviceGroup. For example,
+ * '/providers/Microsoft.Management/serviceGroups/TestServiceGroup'.
+ *
+ * @return the resourceId value.
+ */
+ public String resourceId() {
+ return this.resourceId;
+ }
+
+ /**
+ * Set the resourceId property: The fully qualified ID of the parent serviceGroup. For example,
+ * '/providers/Microsoft.Management/serviceGroups/TestServiceGroup'.
+ *
+ * @param resourceId the resourceId value to set.
+ * @return the ParentServiceGroupProperties object itself.
+ */
+ public ParentServiceGroupProperties withResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("resourceId", this.resourceId);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ParentServiceGroupProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ParentServiceGroupProperties if the JsonReader was pointing to an instance of it, or null
+ * if it was pointing to JSON null.
+ * @throws IOException If an error occurs while reading the ParentServiceGroupProperties.
+ */
+ public static ParentServiceGroupProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ParentServiceGroupProperties deserializedParentServiceGroupProperties = new ParentServiceGroupProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("resourceId".equals(fieldName)) {
+ deserializedParentServiceGroupProperties.resourceId = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedParentServiceGroupProperties;
+ });
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ProvisioningState.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ProvisioningState.java
new file mode 100644
index 000000000000..fea6a3660b21
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ProvisioningState.java
@@ -0,0 +1,66 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.models;
+
+import com.azure.core.util.ExpandableStringEnum;
+import java.util.Collection;
+
+/**
+ * The provisioning state of the serviceGroup. For example, Running.
+ */
+public final class ProvisioningState extends ExpandableStringEnum {
+ /**
+ * Static value NotStarted for ProvisioningState.
+ */
+ public static final ProvisioningState NOT_STARTED = fromString("NotStarted");
+
+ /**
+ * Static value Running for ProvisioningState.
+ */
+ public static final ProvisioningState RUNNING = fromString("Running");
+
+ /**
+ * Static value Succeeded for ProvisioningState.
+ */
+ public static final ProvisioningState SUCCEEDED = fromString("Succeeded");
+
+ /**
+ * Static value Failed for ProvisioningState.
+ */
+ public static final ProvisioningState FAILED = fromString("Failed");
+
+ /**
+ * Static value Canceled for ProvisioningState.
+ */
+ public static final ProvisioningState CANCELED = fromString("Canceled");
+
+ /**
+ * Creates a new instance of ProvisioningState value.
+ *
+ * @deprecated Use the {@link #fromString(String)} factory method.
+ */
+ @Deprecated
+ public ProvisioningState() {
+ }
+
+ /**
+ * Creates or finds a ProvisioningState from its string representation.
+ *
+ * @param name a name to look for.
+ * @return the corresponding ProvisioningState.
+ */
+ public static ProvisioningState fromString(String name) {
+ return fromString(name, ProvisioningState.class);
+ }
+
+ /**
+ * Gets known ProvisioningState values.
+ *
+ * @return known ProvisioningState values.
+ */
+ public static Collection values() {
+ return values(ProvisioningState.class);
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ResourceProviders.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ResourceProviders.java
new file mode 100644
index 000000000000..8eaa87c387d4
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ResourceProviders.java
@@ -0,0 +1,86 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.models;
+
+import com.azure.core.util.Context;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+
+/**
+ * Resource collection API of ResourceProviders.
+ */
+public interface ResourceProviders {
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details.
+ */
+ ServiceGroup createOrUpdateServiceGroup(String serviceGroupName, ServiceGroupInner createServiceGroupRequest);
+
+ /**
+ * Create or Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param createServiceGroupRequest ServiceGroup creation 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 serviceGroup details.
+ */
+ ServiceGroup createOrUpdateServiceGroup(String serviceGroupName, ServiceGroupInner createServiceGroupRequest,
+ Context context);
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details.
+ */
+ ServiceGroup updateServiceGroup(String serviceGroupName, ServiceGroupInner updateServiceGroupRequest);
+
+ /**
+ * Update a serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @param updateServiceGroupRequest ServiceGroup update 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 serviceGroup details.
+ */
+ ServiceGroup updateServiceGroup(String serviceGroupName, ServiceGroupInner updateServiceGroupRequest,
+ Context context);
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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.
+ */
+ void deleteServiceGroup(String serviceGroupName);
+
+ /**
+ * Delete a ServiceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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.
+ */
+ void deleteServiceGroup(String serviceGroupName, Context context);
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroup.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroup.java
new file mode 100644
index 000000000000..4aa98c578f1e
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroup.java
@@ -0,0 +1,70 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.models;
+
+import com.azure.core.management.SystemData;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import java.util.Map;
+
+/**
+ * An immutable client-side representation of ServiceGroup.
+ */
+public interface ServiceGroup {
+ /**
+ * Gets the id property: Fully qualified resource Id for the resource.
+ *
+ * @return the id value.
+ */
+ String id();
+
+ /**
+ * Gets the name property: The name of the resource.
+ *
+ * @return the name value.
+ */
+ String name();
+
+ /**
+ * Gets the type property: The type of the resource.
+ *
+ * @return the type value.
+ */
+ String type();
+
+ /**
+ * Gets the kind property: The kind of the serviceGroup.
+ *
+ * @return the kind value.
+ */
+ String kind();
+
+ /**
+ * Gets the tags property: The serviceGroup tags.
+ *
+ * @return the tags value.
+ */
+ Map tags();
+
+ /**
+ * Gets the properties property: ServiceGroup creation request body parameters.
+ *
+ * @return the properties value.
+ */
+ ServiceGroupProperties properties();
+
+ /**
+ * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ *
+ * @return the systemData value.
+ */
+ SystemData systemData();
+
+ /**
+ * Gets the inner com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner object.
+ *
+ * @return the inner object.
+ */
+ ServiceGroupInner innerModel();
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroupCollectionResponse.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroupCollectionResponse.java
new file mode 100644
index 000000000000..bc337710fd98
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroupCollectionResponse.java
@@ -0,0 +1,34 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.models;
+
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupCollectionResponseInner;
+import java.util.List;
+
+/**
+ * An immutable client-side representation of ServiceGroupCollectionResponse.
+ */
+public interface ServiceGroupCollectionResponse {
+ /**
+ * Gets the value property: Array of service groups based on the request criteria.
+ *
+ * @return the value value.
+ */
+ List value();
+
+ /**
+ * Gets the nextLink property: URL to query the next page of results for this request.
+ *
+ * @return the nextLink value.
+ */
+ String nextLink();
+
+ /**
+ * Gets the inner com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupCollectionResponseInner object.
+ *
+ * @return the inner object.
+ */
+ ServiceGroupCollectionResponseInner innerModel();
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroupProperties.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroupProperties.java
new file mode 100644
index 000000000000..57459532ca0a
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroupProperties.java
@@ -0,0 +1,141 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.models;
+
+import com.azure.core.annotation.Fluent;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonSerializable;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
+
+/**
+ * ServiceGroup creation request body parameters.
+ */
+@Fluent
+public final class ServiceGroupProperties implements JsonSerializable {
+ /*
+ * The provisioning state of the serviceGroup. For example, Running
+ */
+ private ProvisioningState provisioningState;
+
+ /*
+ * The display name of the serviceGroup. For example, ServiceGroupTest1
+ */
+ private String displayName;
+
+ /*
+ * The details of the parent serviceGroup.
+ */
+ private ParentServiceGroupProperties parent;
+
+ /**
+ * Creates an instance of ServiceGroupProperties class.
+ */
+ public ServiceGroupProperties() {
+ }
+
+ /**
+ * Get the provisioningState property: The provisioning state of the serviceGroup. For example, Running.
+ *
+ * @return the provisioningState value.
+ */
+ public ProvisioningState provisioningState() {
+ return this.provisioningState;
+ }
+
+ /**
+ * Get the displayName property: The display name of the serviceGroup. For example, ServiceGroupTest1.
+ *
+ * @return the displayName value.
+ */
+ public String displayName() {
+ return this.displayName;
+ }
+
+ /**
+ * Set the displayName property: The display name of the serviceGroup. For example, ServiceGroupTest1.
+ *
+ * @param displayName the displayName value to set.
+ * @return the ServiceGroupProperties object itself.
+ */
+ public ServiceGroupProperties withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ /**
+ * Get the parent property: The details of the parent serviceGroup.
+ *
+ * @return the parent value.
+ */
+ public ParentServiceGroupProperties parent() {
+ return this.parent;
+ }
+
+ /**
+ * Set the parent property: The details of the parent serviceGroup.
+ *
+ * @param parent the parent value to set.
+ * @return the ServiceGroupProperties object itself.
+ */
+ public ServiceGroupProperties withParent(ParentServiceGroupProperties parent) {
+ this.parent = parent;
+ return this;
+ }
+
+ /**
+ * Validates the instance.
+ *
+ * @throws IllegalArgumentException thrown if the instance is not valid.
+ */
+ public void validate() {
+ if (parent() != null) {
+ parent().validate();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("displayName", this.displayName);
+ jsonWriter.writeJsonField("parent", this.parent);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ServiceGroupProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ServiceGroupProperties if the JsonReader was pointing to an instance of it, or null if it
+ * was pointing to JSON null.
+ * @throws IOException If an error occurs while reading the ServiceGroupProperties.
+ */
+ public static ServiceGroupProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ServiceGroupProperties deserializedServiceGroupProperties = new ServiceGroupProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("provisioningState".equals(fieldName)) {
+ deserializedServiceGroupProperties.provisioningState
+ = ProvisioningState.fromString(reader.getString());
+ } else if ("displayName".equals(fieldName)) {
+ deserializedServiceGroupProperties.displayName = reader.getString();
+ } else if ("parent".equals(fieldName)) {
+ deserializedServiceGroupProperties.parent = ParentServiceGroupProperties.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedServiceGroupProperties;
+ });
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroups.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroups.java
new file mode 100644
index 000000000000..7fea7b103fa8
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/ServiceGroups.java
@@ -0,0 +1,59 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.models;
+
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.Context;
+
+/**
+ * Resource collection API of ServiceGroups.
+ */
+public interface ServiceGroups {
+ /**
+ * Get the details of the serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup along with {@link Response}.
+ */
+ Response getWithResponse(String serviceGroupName, Context context);
+
+ /**
+ * Get the details of the serviceGroup.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup.
+ */
+ ServiceGroup get(String serviceGroupName);
+
+ /**
+ * Get the details of the serviceGroup's ancestors.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup's ancestors along with {@link Response}.
+ */
+ Response listAncestorsWithResponse(String serviceGroupName, Context context);
+
+ /**
+ * Get the details of the serviceGroup's ancestors.
+ *
+ * @param serviceGroupName ServiceGroup Name.
+ * @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 details of the serviceGroup's ancestors.
+ */
+ ServiceGroupCollectionResponse listAncestors(String serviceGroupName);
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/package-info.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/package-info.java
new file mode 100644
index 000000000000..6659bc1bb8f9
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/models/package-info.java
@@ -0,0 +1,11 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the data models for ServiceGroupsManagementClient.
+ * The Groups RP provides Service Groups as a construct to group multiple resources, resource groups, subscriptions and
+ * other service groups into an organizational hierarchy and centrally manage access control, policies, alerting and
+ * reporting for those resources.
+ */
+package com.azure.resourcemanager.servicegroups.models;
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/package-info.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/package-info.java
new file mode 100644
index 000000000000..4b46bbf6b4d9
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/com/azure/resourcemanager/servicegroups/package-info.java
@@ -0,0 +1,11 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/**
+ * Package containing the classes for ServiceGroupsManagementClient.
+ * The Groups RP provides Service Groups as a construct to group multiple resources, resource groups, subscriptions and
+ * other service groups into an organizational hierarchy and centrally manage access control, policies, alerting and
+ * reporting for those resources.
+ */
+package com.azure.resourcemanager.servicegroups;
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/module-info.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/module-info.java
new file mode 100644
index 000000000000..97a0c10b870f
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/java/module-info.java
@@ -0,0 +1,15 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+module com.azure.resourcemanager.servicegroups {
+ requires transitive com.azure.core.management;
+
+ exports com.azure.resourcemanager.servicegroups;
+ exports com.azure.resourcemanager.servicegroups.fluent;
+ exports com.azure.resourcemanager.servicegroups.fluent.models;
+ exports com.azure.resourcemanager.servicegroups.models;
+
+ opens com.azure.resourcemanager.servicegroups.fluent.models to com.azure.core;
+ opens com.azure.resourcemanager.servicegroups.models to com.azure.core;
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-servicegroups/proxy-config.json b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-servicegroups/proxy-config.json
new file mode 100644
index 000000000000..7cc5a85c7b3b
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-servicegroups/proxy-config.json
@@ -0,0 +1 @@
+[["com.azure.resourcemanager.servicegroups.implementation.ResourceProvidersClientImpl$ResourceProvidersService"],["com.azure.resourcemanager.servicegroups.implementation.ServiceGroupsClientImpl$ServiceGroupsService"]]
\ No newline at end of file
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-servicegroups/reflect-config.json b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-servicegroups/reflect-config.json
new file mode 100644
index 000000000000..0637a088a01e
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-servicegroups/reflect-config.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/resources/azure-resourcemanager-servicegroups.properties b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/resources/azure-resourcemanager-servicegroups.properties
new file mode 100644
index 000000000000..defbd48204e4
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/main/resources/azure-resourcemanager-servicegroups.properties
@@ -0,0 +1 @@
+version=${project.version}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ResourceProviderCreateOrUpdateServiceGroupSamples.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ResourceProviderCreateOrUpdateServiceGroupSamples.java
new file mode 100644
index 000000000000..59aaf20b00a9
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ResourceProviderCreateOrUpdateServiceGroupSamples.java
@@ -0,0 +1,34 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ParentServiceGroupProperties;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupProperties;
+
+/**
+ * Samples for ResourceProvider CreateOrUpdateServiceGroup.
+ */
+public final class ResourceProviderCreateOrUpdateServiceGroupSamples {
+ /*
+ * x-ms-original-file:
+ * specification/management/resource-manager/Microsoft.Management/ServiceGroups/preview/2024-02-01-preview/examples/
+ * ServiceGroup_Put.json
+ */
+ /**
+ * Sample code: PutServiceGroup.
+ *
+ * @param manager Entry point to ServiceGroupsManager.
+ */
+ public static void putServiceGroup(com.azure.resourcemanager.servicegroups.ServiceGroupsManager manager) {
+ manager.resourceProviders()
+ .createOrUpdateServiceGroup("ServiceGroup1",
+ new ServiceGroupInner()
+ .withProperties(new ServiceGroupProperties().withDisplayName("ServiceGroup 1 Name")
+ .withParent(new ParentServiceGroupProperties()
+ .withResourceId("/providers/Microsoft.Management/serviceGroups/RootGroup"))),
+ com.azure.core.util.Context.NONE);
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ResourceProviderDeleteServiceGroupSamples.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ResourceProviderDeleteServiceGroupSamples.java
new file mode 100644
index 000000000000..852103e8bee5
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ResourceProviderDeleteServiceGroupSamples.java
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+/**
+ * Samples for ResourceProvider DeleteServiceGroup.
+ */
+public final class ResourceProviderDeleteServiceGroupSamples {
+ /*
+ * x-ms-original-file:
+ * specification/management/resource-manager/Microsoft.Management/ServiceGroups/preview/2024-02-01-preview/examples/
+ * ServiceGroup_Delete.json
+ */
+ /**
+ * Sample code: DeleteServiceGroup.
+ *
+ * @param manager Entry point to ServiceGroupsManager.
+ */
+ public static void deleteServiceGroup(com.azure.resourcemanager.servicegroups.ServiceGroupsManager manager) {
+ manager.resourceProviders()
+ .deleteServiceGroup("20000000-0001-0000-0000-000000000000", com.azure.core.util.Context.NONE);
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ResourceProviderUpdateServiceGroupSamples.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ResourceProviderUpdateServiceGroupSamples.java
new file mode 100644
index 000000000000..3cf6d6aad7d5
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ResourceProviderUpdateServiceGroupSamples.java
@@ -0,0 +1,45 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupProperties;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Samples for ResourceProvider UpdateServiceGroup.
+ */
+public final class ResourceProviderUpdateServiceGroupSamples {
+ /*
+ * x-ms-original-file:
+ * specification/management/resource-manager/Microsoft.Management/ServiceGroups/preview/2024-02-01-preview/examples/
+ * ServiceGroup_Patch.json
+ */
+ /**
+ * Sample code: PatchServiceGroup.
+ *
+ * @param manager Entry point to ServiceGroupsManager.
+ */
+ public static void patchServiceGroup(com.azure.resourcemanager.servicegroups.ServiceGroupsManager manager) {
+ manager.resourceProviders()
+ .updateServiceGroup("ServiceGroup1",
+ new ServiceGroupInner().withTags(mapOf("tag1", "value1", "tag2", "value2"))
+ .withProperties(new ServiceGroupProperties().withDisplayName("ServiceGroup 1 Name")),
+ com.azure.core.util.Context.NONE);
+ }
+
+ // Use "Map.of" if available
+ @SuppressWarnings("unchecked")
+ private static Map mapOf(Object... inputs) {
+ Map map = new HashMap<>();
+ for (int i = 0; i < inputs.length; i += 2) {
+ String key = (String) inputs[i];
+ T value = (T) inputs[i + 1];
+ map.put(key, value);
+ }
+ return map;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsGetSamples.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsGetSamples.java
new file mode 100644
index 000000000000..9f39e0990606
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsGetSamples.java
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+/**
+ * Samples for ServiceGroups Get.
+ */
+public final class ServiceGroupsGetSamples {
+ /*
+ * x-ms-original-file:
+ * specification/management/resource-manager/Microsoft.Management/ServiceGroups/preview/2024-02-01-preview/examples/
+ * ServiceGroup_Get.json
+ */
+ /**
+ * Sample code: GetServiceGroup.
+ *
+ * @param manager Entry point to ServiceGroupsManager.
+ */
+ public static void getServiceGroup(com.azure.resourcemanager.servicegroups.ServiceGroupsManager manager) {
+ manager.serviceGroups()
+ .getWithResponse("20000000-0001-0000-0000-000000000000", com.azure.core.util.Context.NONE);
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsListAncestorsSamples.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsListAncestorsSamples.java
new file mode 100644
index 000000000000..e9489ac1dcd5
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/samples/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsListAncestorsSamples.java
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+/**
+ * Samples for ServiceGroups ListAncestors.
+ */
+public final class ServiceGroupsListAncestorsSamples {
+ /*
+ * x-ms-original-file:
+ * specification/management/resource-manager/Microsoft.Management/ServiceGroups/preview/2024-02-01-preview/examples/
+ * ServiceGroup_ListAncestors.json
+ */
+ /**
+ * Sample code: ListServiceGroupAncestors.
+ *
+ * @param manager Entry point to ServiceGroupsManager.
+ */
+ public static void listServiceGroupAncestors(com.azure.resourcemanager.servicegroups.ServiceGroupsManager manager) {
+ manager.serviceGroups()
+ .listAncestorsWithResponse("20000000-0001-0000-0000-000000000000", com.azure.core.util.Context.NONE);
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ParentServiceGroupPropertiesTests.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ParentServiceGroupPropertiesTests.java
new file mode 100644
index 000000000000..654cd974b0cb
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ParentServiceGroupPropertiesTests.java
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.core.util.BinaryData;
+import com.azure.resourcemanager.servicegroups.models.ParentServiceGroupProperties;
+import org.junit.jupiter.api.Assertions;
+
+public final class ParentServiceGroupPropertiesTests {
+ @org.junit.jupiter.api.Test
+ public void testDeserialize() throws Exception {
+ ParentServiceGroupProperties model
+ = BinaryData.fromString("{\"resourceId\":\"rifkwm\"}").toObject(ParentServiceGroupProperties.class);
+ Assertions.assertEquals("rifkwm", model.resourceId());
+ }
+
+ @org.junit.jupiter.api.Test
+ public void testSerialize() throws Exception {
+ ParentServiceGroupProperties model = new ParentServiceGroupProperties().withResourceId("rifkwm");
+ model = BinaryData.fromObject(model).toObject(ParentServiceGroupProperties.class);
+ Assertions.assertEquals("rifkwm", model.resourceId());
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ResourceProvidersCreateOrUpdateServiceGroupMockTests.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ResourceProvidersCreateOrUpdateServiceGroupMockTests.java
new file mode 100644
index 000000000000..054658c903dc
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ResourceProvidersCreateOrUpdateServiceGroupMockTests.java
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.core.credential.AccessToken;
+import com.azure.core.http.HttpClient;
+import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.models.AzureCloud;
+import com.azure.core.test.http.MockHttpResponse;
+import com.azure.resourcemanager.servicegroups.ServiceGroupsManager;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ParentServiceGroupProperties;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroup;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupProperties;
+import java.nio.charset.StandardCharsets;
+import java.time.OffsetDateTime;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import reactor.core.publisher.Mono;
+
+public final class ResourceProvidersCreateOrUpdateServiceGroupMockTests {
+ @Test
+ public void testCreateOrUpdateServiceGroup() throws Exception {
+ String responseStr
+ = "{\"kind\":\"eiachboosflnr\",\"tags\":{\"zvypyqrimzinp\":\"qpteeh\",\"dqxhcrmnohjtckwh\":\"swjdkirso\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"iy\",\"parent\":{\"resourceId\":\"xsqwpgrjbznorc\"}},\"id\":\"vsnb\",\"name\":\"xqabnmocpcysh\",\"type\":\"rzafbljjgpbtoqcj\"}";
+
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
+ ServiceGroupsManager manager = ServiceGroupsManager.configure()
+ .withHttpClient(httpClient)
+ .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
+ new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD));
+
+ ServiceGroup response = manager.resourceProviders()
+ .createOrUpdateServiceGroup("hmuouqfprwzwbn",
+ new ServiceGroupInner().withKind("itnwuizgazxufi")
+ .withTags(mapOf("rfidfvzwdz", "kyfi", "sdkf", "htymw"))
+ .withProperties(new ServiceGroupProperties().withDisplayName("nteiwaopv")
+ .withParent(new ParentServiceGroupProperties().withResourceId("jcmmxdcufufsrp"))),
+ com.azure.core.util.Context.NONE);
+
+ Assertions.assertEquals("eiachboosflnr", response.kind());
+ Assertions.assertEquals("qpteeh", response.tags().get("zvypyqrimzinp"));
+ Assertions.assertEquals("iy", response.properties().displayName());
+ Assertions.assertEquals("xsqwpgrjbznorc", response.properties().parent().resourceId());
+ }
+
+ // Use "Map.of" if available
+ @SuppressWarnings("unchecked")
+ private static Map mapOf(Object... inputs) {
+ Map map = new HashMap<>();
+ for (int i = 0; i < inputs.length; i += 2) {
+ String key = (String) inputs[i];
+ T value = (T) inputs[i + 1];
+ map.put(key, value);
+ }
+ return map;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ResourceProvidersUpdateServiceGroupMockTests.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ResourceProvidersUpdateServiceGroupMockTests.java
new file mode 100644
index 000000000000..cac9886a5fa4
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ResourceProvidersUpdateServiceGroupMockTests.java
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.core.credential.AccessToken;
+import com.azure.core.http.HttpClient;
+import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.models.AzureCloud;
+import com.azure.core.test.http.MockHttpResponse;
+import com.azure.resourcemanager.servicegroups.ServiceGroupsManager;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ParentServiceGroupProperties;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroup;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupProperties;
+import java.nio.charset.StandardCharsets;
+import java.time.OffsetDateTime;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import reactor.core.publisher.Mono;
+
+public final class ResourceProvidersUpdateServiceGroupMockTests {
+ @Test
+ public void testUpdateServiceGroup() throws Exception {
+ String responseStr
+ = "{\"kind\":\"ajrmvdjwzrlovmc\",\"tags\":{\"aqsqsycbkbfk\":\"ijcoejctb\",\"c\":\"ukdkexxppofmxa\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"dtocj\",\"parent\":{\"resourceId\":\"vpmouexhdzxib\"}},\"id\":\"ojnxqbzvdd\",\"name\":\"t\",\"type\":\"ndei\"}";
+
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
+ ServiceGroupsManager manager = ServiceGroupsManager.configure()
+ .withHttpClient(httpClient)
+ .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
+ new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD));
+
+ ServiceGroup response = manager.resourceProviders()
+ .updateServiceGroup("klj",
+ new ServiceGroupInner().withKind("bqidtqaj")
+ .withTags(mapOf("kudjkrlkhb", "l", "locx", "hfepgzgqex", "aierhhb", "c"))
+ .withProperties(new ServiceGroupProperties().withDisplayName("mmajtjaodx")
+ .withParent(new ParentServiceGroupProperties().withResourceId("bdxkqpxokaj"))),
+ com.azure.core.util.Context.NONE);
+
+ Assertions.assertEquals("ajrmvdjwzrlovmc", response.kind());
+ Assertions.assertEquals("ijcoejctb", response.tags().get("aqsqsycbkbfk"));
+ Assertions.assertEquals("dtocj", response.properties().displayName());
+ Assertions.assertEquals("vpmouexhdzxib", response.properties().parent().resourceId());
+ }
+
+ // Use "Map.of" if available
+ @SuppressWarnings("unchecked")
+ private static Map mapOf(Object... inputs) {
+ Map map = new HashMap<>();
+ for (int i = 0; i < inputs.length; i += 2) {
+ String key = (String) inputs[i];
+ T value = (T) inputs[i + 1];
+ map.put(key, value);
+ }
+ return map;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupCollectionResponseInnerTests.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupCollectionResponseInnerTests.java
new file mode 100644
index 000000000000..2cbc2d819316
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupCollectionResponseInnerTests.java
@@ -0,0 +1,71 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.core.util.BinaryData;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupCollectionResponseInner;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ParentServiceGroupProperties;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupProperties;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+
+public final class ServiceGroupCollectionResponseInnerTests {
+ @org.junit.jupiter.api.Test
+ public void testDeserialize() throws Exception {
+ ServiceGroupCollectionResponseInner model = BinaryData.fromString(
+ "{\"value\":[{\"kind\":\"siznto\",\"tags\":{\"uajpsquc\":\"a\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"dkfo\",\"parent\":{\"resourceId\":\"ygjofjdd\"}},\"id\":\"s\",\"name\":\"deupewnwrei\",\"type\":\"jzyflu\"},{\"kind\":\"rh\",\"tags\":{\"urkdtmlx\":\"cqhsm\",\"kc\":\"ekuksjtx\",\"xzdxtayrlhmwh\":\"mparcryuanzw\"},\"properties\":{\"provisioningState\":\"Canceled\",\"displayName\":\"obmtukk\",\"parent\":{\"resourceId\":\"rtihfxtijbpz\"}},\"id\":\"nwzsymg\",\"name\":\"zufcyzkohdbi\",\"type\":\"anufhfcbjysag\"},{\"kind\":\"hxqh\",\"tags\":{\"scnpqxuhivy\":\"fpikxwczb\",\"wby\":\"n\",\"grtfwvu\":\"rkxvdum\"},\"properties\":{\"provisioningState\":\"Running\",\"displayName\":\"dcc\",\"parent\":{\"resourceId\":\"s\"}},\"id\":\"nyejhkryhtnap\",\"name\":\"zw\",\"type\":\"okjye\"},{\"kind\":\"kvnipjoxz\",\"tags\":{\"lzydehojwyahux\":\"hgejspodma\",\"vcputegj\":\"npmqnjaqwixjspro\",\"uuvmkjozkrwfnd\":\"wmfdatscmdvpjhul\"},\"properties\":{\"provisioningState\":\"Canceled\",\"displayName\":\"slwejdpvw\",\"parent\":{\"resourceId\":\"qpsoacctazak\"}},\"id\":\"lahbcryff\",\"name\":\"fdosyg\",\"type\":\"xpaojakhmsbz\"}],\"nextLink\":\"crzevdphlx\"}")
+ .toObject(ServiceGroupCollectionResponseInner.class);
+ Assertions.assertEquals("siznto", model.value().get(0).kind());
+ Assertions.assertEquals("a", model.value().get(0).tags().get("uajpsquc"));
+ Assertions.assertEquals("dkfo", model.value().get(0).properties().displayName());
+ Assertions.assertEquals("ygjofjdd", model.value().get(0).properties().parent().resourceId());
+ Assertions.assertEquals("crzevdphlx", model.nextLink());
+ }
+
+ @org.junit.jupiter.api.Test
+ public void testSerialize() throws Exception {
+ ServiceGroupCollectionResponseInner model = new ServiceGroupCollectionResponseInner()
+ .withValue(Arrays.asList(
+ new ServiceGroupInner().withKind("siznto")
+ .withTags(mapOf("uajpsquc", "a"))
+ .withProperties(new ServiceGroupProperties().withDisplayName("dkfo")
+ .withParent(new ParentServiceGroupProperties().withResourceId("ygjofjdd"))),
+ new ServiceGroupInner().withKind("rh")
+ .withTags(mapOf("urkdtmlx", "cqhsm", "kc", "ekuksjtx", "xzdxtayrlhmwh", "mparcryuanzw"))
+ .withProperties(new ServiceGroupProperties().withDisplayName("obmtukk")
+ .withParent(new ParentServiceGroupProperties().withResourceId("rtihfxtijbpz"))),
+ new ServiceGroupInner().withKind("hxqh")
+ .withTags(mapOf("scnpqxuhivy", "fpikxwczb", "wby", "n", "grtfwvu", "rkxvdum"))
+ .withProperties(new ServiceGroupProperties().withDisplayName("dcc")
+ .withParent(new ParentServiceGroupProperties().withResourceId("s"))),
+ new ServiceGroupInner().withKind("kvnipjoxz")
+ .withTags(mapOf("lzydehojwyahux", "hgejspodma", "vcputegj", "npmqnjaqwixjspro", "uuvmkjozkrwfnd",
+ "wmfdatscmdvpjhul"))
+ .withProperties(new ServiceGroupProperties().withDisplayName("slwejdpvw")
+ .withParent(new ParentServiceGroupProperties().withResourceId("qpsoacctazak")))))
+ .withNextLink("crzevdphlx");
+ model = BinaryData.fromObject(model).toObject(ServiceGroupCollectionResponseInner.class);
+ Assertions.assertEquals("siznto", model.value().get(0).kind());
+ Assertions.assertEquals("a", model.value().get(0).tags().get("uajpsquc"));
+ Assertions.assertEquals("dkfo", model.value().get(0).properties().displayName());
+ Assertions.assertEquals("ygjofjdd", model.value().get(0).properties().parent().resourceId());
+ Assertions.assertEquals("crzevdphlx", model.nextLink());
+ }
+
+ // Use "Map.of" if available
+ @SuppressWarnings("unchecked")
+ private static Map mapOf(Object... inputs) {
+ Map map = new HashMap<>();
+ for (int i = 0; i < inputs.length; i += 2) {
+ String key = (String) inputs[i];
+ T value = (T) inputs[i + 1];
+ map.put(key, value);
+ }
+ return map;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupInnerTests.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupInnerTests.java
new file mode 100644
index 000000000000..091131359c94
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupInnerTests.java
@@ -0,0 +1,51 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.core.util.BinaryData;
+import com.azure.resourcemanager.servicegroups.fluent.models.ServiceGroupInner;
+import com.azure.resourcemanager.servicegroups.models.ParentServiceGroupProperties;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupProperties;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+
+public final class ServiceGroupInnerTests {
+ @org.junit.jupiter.api.Test
+ public void testDeserialize() throws Exception {
+ ServiceGroupInner model = BinaryData.fromString(
+ "{\"kind\":\"mhquvgjxp\",\"tags\":{\"hmtzopbsphrup\":\"zm\",\"bb\":\"dgs\",\"sx\":\"jhphoyc\",\"tbmufpo\":\"obhdxbmtqioqjze\"},\"properties\":{\"provisioningState\":\"NotStarted\",\"displayName\":\"hwlrx\",\"parent\":{\"resourceId\":\"soqijg\"}},\"id\":\"mbpazlobcufpdzn\",\"name\":\"btcqq\",\"type\":\"nq\"}")
+ .toObject(ServiceGroupInner.class);
+ Assertions.assertEquals("mhquvgjxp", model.kind());
+ Assertions.assertEquals("zm", model.tags().get("hmtzopbsphrup"));
+ Assertions.assertEquals("hwlrx", model.properties().displayName());
+ Assertions.assertEquals("soqijg", model.properties().parent().resourceId());
+ }
+
+ @org.junit.jupiter.api.Test
+ public void testSerialize() throws Exception {
+ ServiceGroupInner model = new ServiceGroupInner().withKind("mhquvgjxp")
+ .withTags(mapOf("hmtzopbsphrup", "zm", "bb", "dgs", "sx", "jhphoyc", "tbmufpo", "obhdxbmtqioqjze"))
+ .withProperties(new ServiceGroupProperties().withDisplayName("hwlrx")
+ .withParent(new ParentServiceGroupProperties().withResourceId("soqijg")));
+ model = BinaryData.fromObject(model).toObject(ServiceGroupInner.class);
+ Assertions.assertEquals("mhquvgjxp", model.kind());
+ Assertions.assertEquals("zm", model.tags().get("hmtzopbsphrup"));
+ Assertions.assertEquals("hwlrx", model.properties().displayName());
+ Assertions.assertEquals("soqijg", model.properties().parent().resourceId());
+ }
+
+ // Use "Map.of" if available
+ @SuppressWarnings("unchecked")
+ private static Map mapOf(Object... inputs) {
+ Map map = new HashMap<>();
+ for (int i = 0; i < inputs.length; i += 2) {
+ String key = (String) inputs[i];
+ T value = (T) inputs[i + 1];
+ map.put(key, value);
+ }
+ return map;
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupPropertiesTests.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupPropertiesTests.java
new file mode 100644
index 000000000000..0dd2cd065635
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupPropertiesTests.java
@@ -0,0 +1,30 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.core.util.BinaryData;
+import com.azure.resourcemanager.servicegroups.models.ParentServiceGroupProperties;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupProperties;
+import org.junit.jupiter.api.Assertions;
+
+public final class ServiceGroupPropertiesTests {
+ @org.junit.jupiter.api.Test
+ public void testDeserialize() throws Exception {
+ ServiceGroupProperties model = BinaryData.fromString(
+ "{\"provisioningState\":\"Succeeded\",\"displayName\":\"gnufoooj\",\"parent\":{\"resourceId\":\"fsqesaagdfmglzlh\"}}")
+ .toObject(ServiceGroupProperties.class);
+ Assertions.assertEquals("gnufoooj", model.displayName());
+ Assertions.assertEquals("fsqesaagdfmglzlh", model.parent().resourceId());
+ }
+
+ @org.junit.jupiter.api.Test
+ public void testSerialize() throws Exception {
+ ServiceGroupProperties model = new ServiceGroupProperties().withDisplayName("gnufoooj")
+ .withParent(new ParentServiceGroupProperties().withResourceId("fsqesaagdfmglzlh"));
+ model = BinaryData.fromObject(model).toObject(ServiceGroupProperties.class);
+ Assertions.assertEquals("gnufoooj", model.displayName());
+ Assertions.assertEquals("fsqesaagdfmglzlh", model.parent().resourceId());
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsGetWithResponseMockTests.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsGetWithResponseMockTests.java
new file mode 100644
index 000000000000..79fd340a62b1
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsGetWithResponseMockTests.java
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.core.credential.AccessToken;
+import com.azure.core.http.HttpClient;
+import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.models.AzureCloud;
+import com.azure.core.test.http.MockHttpResponse;
+import com.azure.resourcemanager.servicegroups.ServiceGroupsManager;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroup;
+import java.nio.charset.StandardCharsets;
+import java.time.OffsetDateTime;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import reactor.core.publisher.Mono;
+
+public final class ServiceGroupsGetWithResponseMockTests {
+ @Test
+ public void testGetWithResponse() throws Exception {
+ String responseStr
+ = "{\"kind\":\"fsinzgvfcjrwzoxx\",\"tags\":{\"eqfpj\":\"elluwfziton\",\"ninmayhuyb\":\"jlxofpdvhpfxxyp\",\"ooginuvamih\":\"kpode\",\"vyevcciqi\":\"ognarxzxtheotus\"},\"properties\":{\"provisioningState\":\"Failed\",\"displayName\":\"gbwjzrnf\",\"parent\":{\"resourceId\":\"gispemvtzfkufubl\"}},\"id\":\"fxqeof\",\"name\":\"aeqjhqjbasvms\",\"type\":\"jqul\"}";
+
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
+ ServiceGroupsManager manager = ServiceGroupsManager.configure()
+ .withHttpClient(httpClient)
+ .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
+ new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD));
+
+ ServiceGroup response
+ = manager.serviceGroups().getWithResponse("olthqtrgqjbp", com.azure.core.util.Context.NONE).getValue();
+
+ Assertions.assertEquals("fsinzgvfcjrwzoxx", response.kind());
+ Assertions.assertEquals("elluwfziton", response.tags().get("eqfpj"));
+ Assertions.assertEquals("gbwjzrnf", response.properties().displayName());
+ Assertions.assertEquals("gispemvtzfkufubl", response.properties().parent().resourceId());
+ }
+}
diff --git a/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsListAncestorsWithResponseMockTests.java b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsListAncestorsWithResponseMockTests.java
new file mode 100644
index 000000000000..e0a47aea4ab5
--- /dev/null
+++ b/sdk/servicegroups/azure-resourcemanager-servicegroups/src/test/java/com/azure/resourcemanager/servicegroups/generated/ServiceGroupsListAncestorsWithResponseMockTests.java
@@ -0,0 +1,43 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.resourcemanager.servicegroups.generated;
+
+import com.azure.core.credential.AccessToken;
+import com.azure.core.http.HttpClient;
+import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.models.AzureCloud;
+import com.azure.core.test.http.MockHttpResponse;
+import com.azure.resourcemanager.servicegroups.ServiceGroupsManager;
+import com.azure.resourcemanager.servicegroups.models.ServiceGroupCollectionResponse;
+import java.nio.charset.StandardCharsets;
+import java.time.OffsetDateTime;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import reactor.core.publisher.Mono;
+
+public final class ServiceGroupsListAncestorsWithResponseMockTests {
+ @Test
+ public void testListAncestorsWithResponse() throws Exception {
+ String responseStr
+ = "{\"value\":[{\"kind\":\"xwrljdouskcqvkoc\",\"tags\":{\"hxbnjbiksqrg\":\"dkwt\",\"fmppe\":\"ssainqpjwnzll\",\"c\":\"bvmgxsabkyqduuji\"},\"properties\":{\"provisioningState\":\"Running\",\"displayName\":\"evndh\",\"parent\":{\"resourceId\":\"pdappds\"}},\"id\":\"kvwrwjfeu\",\"name\":\"nhutjeltmrldhugj\",\"type\":\"zdatqxhocdg\"},{\"kind\":\"blgphuticn\",\"tags\":{\"okftyxolniwpwcuk\":\"aozwyiftyhxhu\"},\"properties\":{\"provisioningState\":\"NotStarted\",\"displayName\":\"awxklr\",\"parent\":{\"resourceId\":\"wckbasyypnd\"}},\"id\":\"sgcbac\",\"name\":\"hejkotynqgou\",\"type\":\"zndlikwy\"},{\"kind\":\"gfgibm\",\"tags\":{\"xybz\":\"akeqs\",\"mnkzsmod\":\"qedqytbciqfoufl\"},\"properties\":{\"provisioningState\":\"Canceled\",\"displayName\":\"gpbkwtmut\",\"parent\":{\"resourceId\":\"ktapspwgcuertu\"}},\"id\":\"dosvqwhbmdgbbjf\",\"name\":\"dgmb\",\"type\":\"bexppb\"},{\"kind\":\"q\",\"tags\":{\"psalgbqux\":\"lfp\"},\"properties\":{\"provisioningState\":\"Canceled\",\"displayName\":\"gzjaoyfhrtxilne\",\"parent\":{\"resourceId\":\"jysvl\"}},\"id\":\"uvfqawrlyxwj\",\"name\":\"cpr\",\"type\":\"nwbxgjvtbvpyssz\"}],\"nextLink\":\"rujqg\"}";
+
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
+ ServiceGroupsManager manager = ServiceGroupsManager.configure()
+ .withHttpClient(httpClient)
+ .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
+ new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD));
+
+ ServiceGroupCollectionResponse response = manager.serviceGroups()
+ .listAncestorsWithResponse("gsntnbybkzgcwr", com.azure.core.util.Context.NONE)
+ .getValue();
+
+ Assertions.assertEquals("xwrljdouskcqvkoc", response.value().get(0).kind());
+ Assertions.assertEquals("dkwt", response.value().get(0).tags().get("hxbnjbiksqrg"));
+ Assertions.assertEquals("evndh", response.value().get(0).properties().displayName());
+ Assertions.assertEquals("pdappds", response.value().get(0).properties().parent().resourceId());
+ Assertions.assertEquals("rujqg", response.nextLink());
+ }
+}
diff --git a/sdk/servicegroups/ci.yml b/sdk/servicegroups/ci.yml
new file mode 100644
index 000000000000..51c30d230fc7
--- /dev/null
+++ b/sdk/servicegroups/ci.yml
@@ -0,0 +1,46 @@
+# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
+
+trigger:
+ branches:
+ include:
+ - main
+ - hotfix/*
+ - release/*
+ paths:
+ include:
+ - sdk/servicegroups/ci.yml
+ - sdk/servicegroups/azure-resourcemanager-servicegroups/
+ exclude:
+ - sdk/servicegroups/pom.xml
+ - sdk/servicegroups/azure-resourcemanager-servicegroups/pom.xml
+
+pr:
+ branches:
+ include:
+ - main
+ - feature/*
+ - hotfix/*
+ - release/*
+ paths:
+ include:
+ - sdk/servicegroups/ci.yml
+ - sdk/servicegroups/azure-resourcemanager-servicegroups/
+ exclude:
+ - sdk/servicegroups/pom.xml
+ - sdk/servicegroups/azure-resourcemanager-servicegroups/pom.xml
+
+parameters:
+ - name: release_azureresourcemanagerservicegroups
+ displayName: azure-resourcemanager-servicegroups
+ type: boolean
+ default: false
+
+extends:
+ template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
+ parameters:
+ ServiceDirectory: servicegroups
+ Artifacts:
+ - name: azure-resourcemanager-servicegroups
+ groupId: com.azure.resourcemanager
+ safeName: azureresourcemanagerservicegroups
+ releaseInBatch: ${{ parameters.release_azureresourcemanagerservicegroups }}
diff --git a/sdk/servicegroups/pom.xml b/sdk/servicegroups/pom.xml
new file mode 100644
index 000000000000..717c80e9fbe6
--- /dev/null
+++ b/sdk/servicegroups/pom.xml
@@ -0,0 +1,15 @@
+
+
+ 4.0.0
+ com.azure
+ azure-servicegroups-service
+ pom
+ 1.0.0
+
+
+ azure-resourcemanager-servicegroups
+
+