diff --git a/packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceImplementation.java b/packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceImplementation.java index 38b1a3003cc..43f119ea028 100644 --- a/packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceImplementation.java +++ b/packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceImplementation.java @@ -134,7 +134,8 @@ public FluentMethodCreateMode() { .visibility(JavaVisibility.Private) .methodSignature("boolean isInCreateMode()") .method(block -> { - block.methodReturn(String.format("this.%1$s().id() == null", ModelNaming.METHOD_INNER_MODEL)); + block.methodReturn(String.format("this.%1$s() == null || this.%1$s().id() == null", + ModelNaming.METHOD_INNER_MODEL)); }) .build(); } diff --git a/packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/method/FluentConstructorByName.java b/packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/method/FluentConstructorByName.java index b72cd335647..b1b3026bf26 100644 --- a/packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/method/FluentConstructorByName.java +++ b/packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/method/FluentConstructorByName.java @@ -3,12 +3,14 @@ package com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method; +import com.microsoft.typespec.http.client.generator.core.extension.plugin.JavaSettings; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClassType; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.IType; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ReturnValue; import com.microsoft.typespec.http.client.generator.core.model.javamodel.JavaJavadocComment; import com.microsoft.typespec.http.client.generator.core.model.javamodel.JavaVisibility; import com.microsoft.typespec.http.client.generator.core.template.prototype.MethodTemplate; +import com.microsoft.typespec.http.client.generator.core.util.ClientModelUtil; import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceModel; import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.ModelNaming; import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.LocalVariable; @@ -40,8 +42,12 @@ public FluentConstructorByName(FluentResourceModel model, FluentMethodType type, .visibility(JavaVisibility.PackagePrivate) .methodSignature(this.getImplementationMethodSignature()) .method(block -> { - block.line(String.format("this.%1$s = new %2$s();", ModelNaming.MODEL_PROPERTY_INNER, - model.getInnerModel().getName())); + // Resource model can be immutable output-only(private-ctor), when PUT request body is not resource + // model itself. + if (!ClientModelUtil.isImmutableOutputModel(model.getInnerModel(), JavaSettings.getInstance())) { + block.line(String.format("this.%1$s = new %2$s();", ModelNaming.MODEL_PROPERTY_INNER, + model.getInnerModel().getName())); + } block.line(String.format("this.%1$s = %2$s;", ModelNaming.MODEL_PROPERTY_MANAGER, ModelNaming.MODEL_PROPERTY_MANAGER)); if (!constantResourceName) { diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java index 92e976bbe48..f957e261401 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java @@ -36,6 +36,7 @@ import tsptest.armresourceprovider.implementation.ChildExtensionResourceInterfacesImpl; import tsptest.armresourceprovider.implementation.ChildResourcesInterfacesImpl; import tsptest.armresourceprovider.implementation.CustomTemplateResourceInterfacesImpl; +import tsptest.armresourceprovider.implementation.ImmutableResourceModelsImpl; import tsptest.armresourceprovider.implementation.ManagedMaintenanceWindowStatusOperationsImpl; import tsptest.armresourceprovider.implementation.ModelInterfaceSameNamesImpl; import tsptest.armresourceprovider.implementation.OperationsImpl; @@ -43,6 +44,7 @@ import tsptest.armresourceprovider.models.ChildExtensionResourceInterfaces; import tsptest.armresourceprovider.models.ChildResourcesInterfaces; import tsptest.armresourceprovider.models.CustomTemplateResourceInterfaces; +import tsptest.armresourceprovider.models.ImmutableResourceModels; import tsptest.armresourceprovider.models.ManagedMaintenanceWindowStatusOperations; import tsptest.armresourceprovider.models.ModelInterfaceSameNames; import tsptest.armresourceprovider.models.Operations; @@ -67,6 +69,8 @@ public final class ArmResourceProviderManager { private ModelInterfaceSameNames modelInterfaceSameNames; + private ImmutableResourceModels immutableResourceModels; + private final ArmClient clientObject; private ArmResourceProviderManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -372,6 +376,19 @@ public ModelInterfaceSameNames modelInterfaceSameNames() { return modelInterfaceSameNames; } + /** + * Gets the resource collection API of ImmutableResourceModels. It manages NginxConfigurationResponse. + * + * @return Resource collection API of ImmutableResourceModels. + */ + public ImmutableResourceModels immutableResourceModels() { + if (this.immutableResourceModels == null) { + this.immutableResourceModels + = new ImmutableResourceModelsImpl(clientObject.getImmutableResourceModels(), this); + } + return immutableResourceModels; + } + /** * Gets wrapped service client ArmClient providing direct access to the underlying auto-generated API * implementation, based on Azure REST API. diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java index dad78013c0e..e2725aa9c57 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java @@ -94,4 +94,11 @@ public interface ArmClient { * @return the ModelInterfaceSameNamesClient object. */ ModelInterfaceSameNamesClient getModelInterfaceSameNames(); + + /** + * Gets the ImmutableResourceModelsClient object to access its operations. + * + * @return the ImmutableResourceModelsClient object. + */ + ImmutableResourceModelsClient getImmutableResourceModels(); } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java new file mode 100644 index 00000000000..5b87283dd02 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.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 tsptest.armresourceprovider.fluent.models.NginxConfigurationResponseInner; +import tsptest.armresourceprovider.models.NginxConfigurationRequest; + +/** + * An instance of this class provides access to all the operations defined in ImmutableResourceModelsClient. + */ +public interface ImmutableResourceModelsClient { + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NginxConfigurationResponseInner> + beginCreateOrUpdate(String resourceGroupName, String configurationName); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NginxConfigurationResponseInner> beginCreateOrUpdate( + String resourceGroupName, String configurationName, NginxConfigurationRequest properties, Context context); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NginxConfigurationResponseInner createOrUpdate(String resourceGroupName, String configurationName); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NginxConfigurationResponseInner createOrUpdate(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/NginxConfigurationResponseInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/NginxConfigurationResponseInner.java new file mode 100644 index 00000000000..d730985af3f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/NginxConfigurationResponseInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armresourceprovider.models.NginxConfigurationResponseProperties; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Immutable +public final class NginxConfigurationResponseInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private NginxConfigurationResponseProperties 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 NginxConfigurationResponseInner class. + */ + private NginxConfigurationResponseInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public NginxConfigurationResponseProperties properties() { + return this.properties; + } + + /** + * 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.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NginxConfigurationResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NginxConfigurationResponseInner 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 NginxConfigurationResponseInner. + */ + public static NginxConfigurationResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NginxConfigurationResponseInner deserializedNginxConfigurationResponseInner + = new NginxConfigurationResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNginxConfigurationResponseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNginxConfigurationResponseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNginxConfigurationResponseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedNginxConfigurationResponseInner.properties + = NginxConfigurationResponseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedNginxConfigurationResponseInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNginxConfigurationResponseInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java index d8f405df373..c0a1d034752 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java @@ -38,6 +38,7 @@ import tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient; import tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient; import tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient; +import tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient; import tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient; import tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient; import tsptest.armresourceprovider.fluent.OperationsClient; @@ -230,6 +231,20 @@ public ModelInterfaceSameNamesClient getModelInterfaceSameNames() { return this.modelInterfaceSameNames; } + /** + * The ImmutableResourceModelsClient object to access its operations. + */ + private final ImmutableResourceModelsClient immutableResourceModels; + + /** + * Gets the ImmutableResourceModelsClient object to access its operations. + * + * @return the ImmutableResourceModelsClient object. + */ + public ImmutableResourceModelsClient getImmutableResourceModels() { + return this.immutableResourceModels; + } + /** * Initializes an instance of ArmClient client. * @@ -255,6 +270,7 @@ public ModelInterfaceSameNamesClient getModelInterfaceSameNames() { this.childExtensionResourceInterfaces = new ChildExtensionResourceInterfacesClientImpl(this); this.managedMaintenanceWindowStatusOperations = new ManagedMaintenanceWindowStatusOperationsClientImpl(this); this.modelInterfaceSameNames = new ModelInterfaceSameNamesClientImpl(this); + this.immutableResourceModels = new ImmutableResourceModelsClientImpl(this); } /** diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java index a5c4b6cb1bf..495b29a7b42 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java @@ -187,6 +187,6 @@ public ChildResourceImpl withTags(Map tags) { } private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java index 43814b8e71f..9c64a9ca0c5 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java @@ -221,6 +221,6 @@ public CustomTemplateResourceImpl withIfNoneMatch(String ifNoneMatch) { } private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java new file mode 100644 index 00000000000..bca0234ea86 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.BodyParam; +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.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 java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient; +import tsptest.armresourceprovider.fluent.models.NginxConfigurationResponseInner; +import tsptest.armresourceprovider.models.NginxConfigurationRequest; + +/** + * An instance of this class provides access to all the operations defined in ImmutableResourceModelsClient. + */ +public final class ImmutableResourceModelsClientImpl implements ImmutableResourceModelsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ImmutableResourceModelsService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of ImmutableResourceModelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImmutableResourceModelsClientImpl(ArmClientImpl client) { + this.service = RestProxy.create(ImmutableResourceModelsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientImmutableResourceModels to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientImmutableRe") + public interface ImmutableResourceModelsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/configurations/{configurationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NginxConfigurationRequest properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/configurations/{configurationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NginxConfigurationRequest properties, Context context); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String configurationName, NginxConfigurationRequest properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, configurationName, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configurationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, configurationName, accept, properties, Context.NONE); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configurationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (properties != null) { + properties.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, configurationName, accept, properties, context); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NginxConfigurationResponseInner> + beginCreateOrUpdateAsync(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, configurationName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NginxConfigurationResponseInner.class, NginxConfigurationResponseInner.class, + this.client.getContext()); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NginxConfigurationResponseInner> + beginCreateOrUpdateAsync(String resourceGroupName, String configurationName) { + final NginxConfigurationRequest properties = null; + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, configurationName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NginxConfigurationResponseInner.class, NginxConfigurationResponseInner.class, + this.client.getContext()); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NginxConfigurationResponseInner> + beginCreateOrUpdate(String resourceGroupName, String configurationName, NginxConfigurationRequest properties) { + Response response = createOrUpdateWithResponse(resourceGroupName, configurationName, properties); + return this.client.getLroResult(response, + NginxConfigurationResponseInner.class, NginxConfigurationResponseInner.class, Context.NONE); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NginxConfigurationResponseInner> + beginCreateOrUpdate(String resourceGroupName, String configurationName) { + final NginxConfigurationRequest properties = null; + Response response = createOrUpdateWithResponse(resourceGroupName, configurationName, properties); + return this.client.getLroResult(response, + NginxConfigurationResponseInner.class, NginxConfigurationResponseInner.class, Context.NONE); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NginxConfigurationResponseInner> beginCreateOrUpdate( + String resourceGroupName, String configurationName, NginxConfigurationRequest properties, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, configurationName, properties, context); + return this.client.getLroResult(response, + NginxConfigurationResponseInner.class, NginxConfigurationResponseInner.class, context); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String configurationName, NginxConfigurationRequest properties) { + return beginCreateOrUpdateAsync(resourceGroupName, configurationName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String configurationName) { + final NginxConfigurationRequest properties = null; + return beginCreateOrUpdateAsync(resourceGroupName, configurationName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NginxConfigurationResponseInner createOrUpdate(String resourceGroupName, String configurationName) { + final NginxConfigurationRequest properties = null; + return beginCreateOrUpdate(resourceGroupName, configurationName, properties).getFinalResult(); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NginxConfigurationResponseInner createOrUpdate(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties, Context context) { + return beginCreateOrUpdate(resourceGroupName, configurationName, properties, context).getFinalResult(); + } + + private static final ClientLogger LOGGER = new ClientLogger(ImmutableResourceModelsClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java new file mode 100644 index 00000000000..f96ddcbb88f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient; +import tsptest.armresourceprovider.models.ImmutableResourceModels; + +public final class ImmutableResourceModelsImpl implements ImmutableResourceModels { + private static final ClientLogger LOGGER = new ClientLogger(ImmutableResourceModelsImpl.class); + + private final ImmutableResourceModelsClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public ImmutableResourceModelsImpl(ImmutableResourceModelsClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + private ImmutableResourceModelsClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + public NginxConfigurationResponseImpl define(String name) { + return new NginxConfigurationResponseImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/NginxConfigurationResponseImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/NginxConfigurationResponseImpl.java new file mode 100644 index 00000000000..d5bf017dcd7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/NginxConfigurationResponseImpl.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import tsptest.armresourceprovider.fluent.models.NginxConfigurationResponseInner; +import tsptest.armresourceprovider.models.NginxConfigurationRequest; +import tsptest.armresourceprovider.models.NginxConfigurationResponse; +import tsptest.armresourceprovider.models.NginxConfigurationResponseProperties; + +public final class NginxConfigurationResponseImpl + implements NginxConfigurationResponse, NginxConfigurationResponse.Definition, NginxConfigurationResponse.Update { + private NginxConfigurationResponseInner innerObject; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public NginxConfigurationResponseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public NginxConfigurationResponseInner innerModel() { + return this.innerObject; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String configurationName; + + private NginxConfigurationRequest createProperties; + + private NginxConfigurationRequest updateProperties; + + public NginxConfigurationResponseImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public NginxConfigurationResponse create() { + this.innerObject = serviceManager.serviceClient() + .getImmutableResourceModels() + .createOrUpdate(resourceGroupName, configurationName, createProperties, Context.NONE); + return this; + } + + public NginxConfigurationResponse create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getImmutableResourceModels() + .createOrUpdate(resourceGroupName, configurationName, createProperties, context); + return this; + } + + NginxConfigurationResponseImpl(String name, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.serviceManager = serviceManager; + this.configurationName = name; + this.createProperties = new NginxConfigurationRequest(); + } + + public NginxConfigurationResponseImpl update() { + this.updateProperties = new NginxConfigurationRequest(); + return this; + } + + public NginxConfigurationResponse apply() { + this.innerObject = serviceManager.serviceClient() + .getImmutableResourceModels() + .createOrUpdate(resourceGroupName, configurationName, updateProperties, Context.NONE); + return this; + } + + public NginxConfigurationResponse apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getImmutableResourceModels() + .createOrUpdate(resourceGroupName, configurationName, updateProperties, context); + return this; + } + + NginxConfigurationResponseImpl(NginxConfigurationResponseInner innerObject, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.configurationName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "configurations"); + } + + public NginxConfigurationResponseImpl withRootFile(String rootFile) { + if (isInCreateMode()) { + this.createProperties.withRootFile(rootFile); + return this; + } else { + this.updateProperties.withRootFile(rootFile); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java index 4645fa86a17..7e2a1b291c4 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java @@ -243,6 +243,6 @@ public TopLevelArmResourceImpl withStartTimeStamp(OffsetDateTime startTimeStamp) } private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java new file mode 100644 index 00000000000..c65bd865a3e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +/** + * Resource collection API of ImmutableResourceModels. + */ +public interface ImmutableResourceModels { + /** + * Begins definition for a new NginxConfigurationResponse resource. + * + * @param name resource name. + * @return the first stage of the new NginxConfigurationResponse definition. + */ + NginxConfigurationResponse.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java new file mode 100644 index 00000000000..2a7e82423cc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.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 NginxConfigurationRequest model. + */ +@Fluent +public final class NginxConfigurationRequest implements JsonSerializable { + /* + * The rootFile property. + */ + private String rootFile; + + /** + * Creates an instance of NginxConfigurationRequest class. + */ + public NginxConfigurationRequest() { + } + + /** + * Get the rootFile property: The rootFile property. + * + * @return the rootFile value. + */ + public String rootFile() { + return this.rootFile; + } + + /** + * Set the rootFile property: The rootFile property. + * + * @param rootFile the rootFile value to set. + * @return the NginxConfigurationRequest object itself. + */ + public NginxConfigurationRequest withRootFile(String rootFile) { + this.rootFile = rootFile; + 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("rootFile", this.rootFile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NginxConfigurationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NginxConfigurationRequest 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 NginxConfigurationRequest. + */ + public static NginxConfigurationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NginxConfigurationRequest deserializedNginxConfigurationRequest = new NginxConfigurationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rootFile".equals(fieldName)) { + deserializedNginxConfigurationRequest.rootFile = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNginxConfigurationRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java new file mode 100644 index 00000000000..118714eab6c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import tsptest.armresourceprovider.fluent.models.NginxConfigurationResponseInner; + +/** + * An immutable client-side representation of NginxConfigurationResponse. + */ +public interface NginxConfigurationResponse { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + NginxConfigurationResponseProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner tsptest.armresourceprovider.fluent.models.NginxConfigurationResponseInner object. + * + * @return the inner object. + */ + NginxConfigurationResponseInner innerModel(); + + /** + * The entirety of the NginxConfigurationResponse definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The NginxConfigurationResponse definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the NginxConfigurationResponse definition. + */ + interface Blank extends WithResourceGroup { + } + + /** + * The stage of the NginxConfigurationResponse definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the NginxConfigurationResponse definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithRootFile { + /** + * Executes the create request. + * + * @return the created resource. + */ + NginxConfigurationResponse create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NginxConfigurationResponse create(Context context); + } + + /** + * The stage of the NginxConfigurationResponse definition allowing to specify rootFile. + */ + interface WithRootFile { + /** + * Specifies the rootFile property: The rootFile property.. + * + * @param rootFile The rootFile property. + * @return the next definition stage. + */ + WithCreate withRootFile(String rootFile); + } + } + + /** + * Begins update for the NginxConfigurationResponse resource. + * + * @return the stage of resource update. + */ + NginxConfigurationResponse.Update update(); + + /** + * The template for NginxConfigurationResponse update. + */ + interface Update extends UpdateStages.WithRootFile { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NginxConfigurationResponse apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NginxConfigurationResponse apply(Context context); + } + + /** + * The NginxConfigurationResponse update stages. + */ + interface UpdateStages { + /** + * The stage of the NginxConfigurationResponse update allowing to specify rootFile. + */ + interface WithRootFile { + /** + * Specifies the rootFile property: The rootFile property.. + * + * @param rootFile The rootFile property. + * @return the next definition stage. + */ + Update withRootFile(String rootFile); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java new file mode 100644 index 00000000000..47d711ab0cc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The NginxConfigurationResponseProperties model. + */ +@Immutable +public final class NginxConfigurationResponseProperties + implements JsonSerializable { + /* + * The provisioningState property. + */ + private ProvisioningState provisioningState; + + /* + * The rootFile property. + */ + private String rootFile; + + /** + * Creates an instance of NginxConfigurationResponseProperties class. + */ + private NginxConfigurationResponseProperties() { + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the rootFile property: The rootFile property. + * + * @return the rootFile value. + */ + public String rootFile() { + return this.rootFile; + } + + /** + * 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("rootFile", this.rootFile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NginxConfigurationResponseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NginxConfigurationResponseProperties 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 NginxConfigurationResponseProperties. + */ + public static NginxConfigurationResponseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NginxConfigurationResponseProperties deserializedNginxConfigurationResponseProperties + = new NginxConfigurationResponseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedNginxConfigurationResponseProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("rootFile".equals(fieldName)) { + deserializedNginxConfigurationResponseProperties.rootFile = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNginxConfigurationResponseProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json index f9b6d4202e6..fce0727b131 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json @@ -29,6 +29,9 @@ "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunning": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdate": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunning": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", + "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient": "TspTest.ArmResourceProvider.ImmutableResourceModel", + "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdate": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", + "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdate": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus", "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroup": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponse": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", @@ -59,6 +62,7 @@ "tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContent", "tsptest.armresourceprovider.fluent.models.ModelInterfaceDifferentNameProperties": "TspTest.ArmResourceProvider.ModelInterfaceDifferentNameProperties", "tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner": "TspTest.ArmResourceProvider.ModelInterfaceDifferentName", + "tsptest.armresourceprovider.fluent.models.NginxConfigurationResponseInner": "TspTest.ArmResourceProvider.NginxConfigurationResponse", "tsptest.armresourceprovider.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", "tsptest.armresourceprovider.fluent.models.ResultInner": "TspTest.ArmResourceProvider.Result", "tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner": "TspTest.ArmResourceProvider.TopLevelArmResource", @@ -81,6 +85,8 @@ "tsptest.armresourceprovider.models.Golden": "TspTest.ArmResourceProvider.Golden", "tsptest.armresourceprovider.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", "tsptest.armresourceprovider.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "tsptest.armresourceprovider.models.NginxConfigurationRequest": "TspTest.ArmResourceProvider.NginxConfigurationRequest", + "tsptest.armresourceprovider.models.NginxConfigurationResponseProperties": "TspTest.ArmResourceProvider.NginxConfigurationResponseProperties", "tsptest.armresourceprovider.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", "tsptest.armresourceprovider.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", "tsptest.armresourceprovider.models.PriorityModel": "TspTest.ArmResourceProvider.PriorityModel", diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json index d1a58566938..c24db67a2d9 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json @@ -1 +1 @@ -{"flavor":"Azure","apiVersion":"2023-11-01","crossLanguageDefinitions":{"tsptest.armresourceprovider.fluent.ArmClient":"TspTest.ArmResourceProvider","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient":"TspTest.ArmResourceProvider.ChildExtensionResourceInterface","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDelete":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.delete":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.get":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponse":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResource":"Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.update":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponse":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient":"TspTest.ArmResourceProvider.ChildResourcesInterface","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBody":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBody":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDelete":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdate":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.delete":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.get":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponse":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResource":"TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.update":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponse":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunning":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunning":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroup":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponse":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient":"TspTest.ArmResourceProvider.ModelInterfaceSameName","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroup":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponse":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.OperationsClient":"TspTest.ArmResourceProvider.Operations","tsptest.armresourceprovider.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.action":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginAction":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDelete":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.delete":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroup":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.list":"Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroup":"Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.update":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponse":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner":"TspTest.ArmResourceProvider.ChildExtensionResource","tsptest.armresourceprovider.fluent.models.ChildResourceInner":"TspTest.ArmResourceProvider.ChildResource","tsptest.armresourceprovider.fluent.models.ChildResourceProperties":"TspTest.ArmResourceProvider.ChildResourceProperties","tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner":"TspTest.ArmResourceProvider.CustomTemplateResource","tsptest.armresourceprovider.fluent.models.CustomTemplateResourceProperties":"TspTest.ArmResourceProvider.CustomTemplateResourceProperties","tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusContentProperties":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContentProperties","tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContent","tsptest.armresourceprovider.fluent.models.ModelInterfaceDifferentNameProperties":"TspTest.ArmResourceProvider.ModelInterfaceDifferentNameProperties","tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner":"TspTest.ArmResourceProvider.ModelInterfaceDifferentName","tsptest.armresourceprovider.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","tsptest.armresourceprovider.fluent.models.ResultInner":"TspTest.ArmResourceProvider.Result","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner":"TspTest.ArmResourceProvider.TopLevelArmResource","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceProperties":"TspTest.ArmResourceProvider.TopLevelArmResourceProperties","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceUpdateProperties":"Azure.ResourceManager.Foundations.ResourceUpdateModelProperties","tsptest.armresourceprovider.implementation.ArmClientBuilder":"TspTest.ArmResourceProvider","tsptest.armresourceprovider.implementation.models.ChildExtensionResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.implementation.models.ChildResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","tsptest.armresourceprovider.implementation.models.ResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","tsptest.armresourceprovider.models.AnonymousEmptyModel":"TspTest.ArmResourceProvider.CustomTemplateResourceProperties.anonymousEmptyModel.anonymous","tsptest.armresourceprovider.models.ChildExtensionResourceProperties":"TspTest.ArmResourceProvider.ChildExtensionResourceProperties","tsptest.armresourceprovider.models.ChildExtensionResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.ChildResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.CustomTemplateResourcePatch":"TspTest.ArmResourceProvider.CustomTemplateResourcePatch","tsptest.armresourceprovider.models.Dog":"TspTest.ArmResourceProvider.Dog","tsptest.armresourceprovider.models.DogKind":"TspTest.ArmResourceProvider.DogKind","tsptest.armresourceprovider.models.EmptyModel":"TspTest.ArmResourceProvider.EmptyModel","tsptest.armresourceprovider.models.Golden":"TspTest.ArmResourceProvider.Golden","tsptest.armresourceprovider.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","tsptest.armresourceprovider.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","tsptest.armresourceprovider.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","tsptest.armresourceprovider.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","tsptest.armresourceprovider.models.PriorityModel":"TspTest.ArmResourceProvider.PriorityModel","tsptest.armresourceprovider.models.ProvisioningState":"TspTest.ArmResourceProvider.ProvisioningState","tsptest.armresourceprovider.models.TopLevelArmResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity"}} \ No newline at end of file +{"flavor":"Azure","apiVersion":"2023-11-01","crossLanguageDefinitions":{"tsptest.armresourceprovider.fluent.ArmClient":"TspTest.ArmResourceProvider","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient":"TspTest.ArmResourceProvider.ChildExtensionResourceInterface","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDelete":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.delete":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.get":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponse":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResource":"Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.update":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponse":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient":"TspTest.ArmResourceProvider.ChildResourcesInterface","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBody":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBody":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDelete":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdate":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.delete":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.get":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponse":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResource":"TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.update":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponse":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunning":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunning":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient":"TspTest.ArmResourceProvider.ImmutableResourceModel","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdate":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdate":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroup":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponse":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient":"TspTest.ArmResourceProvider.ModelInterfaceSameName","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroup":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponse":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.OperationsClient":"TspTest.ArmResourceProvider.Operations","tsptest.armresourceprovider.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.action":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginAction":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDelete":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.delete":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroup":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.list":"Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroup":"Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.update":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponse":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner":"TspTest.ArmResourceProvider.ChildExtensionResource","tsptest.armresourceprovider.fluent.models.ChildResourceInner":"TspTest.ArmResourceProvider.ChildResource","tsptest.armresourceprovider.fluent.models.ChildResourceProperties":"TspTest.ArmResourceProvider.ChildResourceProperties","tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner":"TspTest.ArmResourceProvider.CustomTemplateResource","tsptest.armresourceprovider.fluent.models.CustomTemplateResourceProperties":"TspTest.ArmResourceProvider.CustomTemplateResourceProperties","tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusContentProperties":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContentProperties","tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContent","tsptest.armresourceprovider.fluent.models.ModelInterfaceDifferentNameProperties":"TspTest.ArmResourceProvider.ModelInterfaceDifferentNameProperties","tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner":"TspTest.ArmResourceProvider.ModelInterfaceDifferentName","tsptest.armresourceprovider.fluent.models.NginxConfigurationResponseInner":"TspTest.ArmResourceProvider.NginxConfigurationResponse","tsptest.armresourceprovider.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","tsptest.armresourceprovider.fluent.models.ResultInner":"TspTest.ArmResourceProvider.Result","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner":"TspTest.ArmResourceProvider.TopLevelArmResource","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceProperties":"TspTest.ArmResourceProvider.TopLevelArmResourceProperties","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceUpdateProperties":"Azure.ResourceManager.Foundations.ResourceUpdateModelProperties","tsptest.armresourceprovider.implementation.ArmClientBuilder":"TspTest.ArmResourceProvider","tsptest.armresourceprovider.implementation.models.ChildExtensionResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.implementation.models.ChildResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","tsptest.armresourceprovider.implementation.models.ResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","tsptest.armresourceprovider.models.AnonymousEmptyModel":"TspTest.ArmResourceProvider.CustomTemplateResourceProperties.anonymousEmptyModel.anonymous","tsptest.armresourceprovider.models.ChildExtensionResourceProperties":"TspTest.ArmResourceProvider.ChildExtensionResourceProperties","tsptest.armresourceprovider.models.ChildExtensionResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.ChildResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.CustomTemplateResourcePatch":"TspTest.ArmResourceProvider.CustomTemplateResourcePatch","tsptest.armresourceprovider.models.Dog":"TspTest.ArmResourceProvider.Dog","tsptest.armresourceprovider.models.DogKind":"TspTest.ArmResourceProvider.DogKind","tsptest.armresourceprovider.models.EmptyModel":"TspTest.ArmResourceProvider.EmptyModel","tsptest.armresourceprovider.models.Golden":"TspTest.ArmResourceProvider.Golden","tsptest.armresourceprovider.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","tsptest.armresourceprovider.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","tsptest.armresourceprovider.models.NginxConfigurationRequest":"TspTest.ArmResourceProvider.NginxConfigurationRequest","tsptest.armresourceprovider.models.NginxConfigurationResponseProperties":"TspTest.ArmResourceProvider.NginxConfigurationResponseProperties","tsptest.armresourceprovider.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","tsptest.armresourceprovider.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","tsptest.armresourceprovider.models.PriorityModel":"TspTest.ArmResourceProvider.PriorityModel","tsptest.armresourceprovider.models.ProvisioningState":"TspTest.ArmResourceProvider.ProvisioningState","tsptest.armresourceprovider.models.TopLevelArmResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity"}} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json index b076302abc0..1bed01673f7 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json @@ -1 +1 @@ -[["tsptest.armresourceprovider.implementation.ChildExtensionResourceInterfacesClientImpl$ChildExtensionResourceInterfacesService"],["tsptest.armresourceprovider.implementation.ChildResourcesInterfacesClientImpl$ChildResourcesInterfacesService"],["tsptest.armresourceprovider.implementation.CustomTemplateResourceInterfacesClientImpl$CustomTemplateResourceInterfacesService"],["tsptest.armresourceprovider.implementation.ManagedMaintenanceWindowStatusOperationsClientImpl$ManagedMaintenanceWindowStatusOperationsService"],["tsptest.armresourceprovider.implementation.ModelInterfaceSameNamesClientImpl$ModelInterfaceSameNamesService"],["tsptest.armresourceprovider.implementation.OperationsClientImpl$OperationsService"],["tsptest.armresourceprovider.implementation.TopLevelArmResourceInterfacesClientImpl$TopLevelArmResourceInterfacesService"]] \ No newline at end of file +[["tsptest.armresourceprovider.implementation.ChildExtensionResourceInterfacesClientImpl$ChildExtensionResourceInterfacesService"],["tsptest.armresourceprovider.implementation.ChildResourcesInterfacesClientImpl$ChildResourcesInterfacesService"],["tsptest.armresourceprovider.implementation.CustomTemplateResourceInterfacesClientImpl$CustomTemplateResourceInterfacesService"],["tsptest.armresourceprovider.implementation.ImmutableResourceModelsClientImpl$ImmutableResourceModelsService"],["tsptest.armresourceprovider.implementation.ManagedMaintenanceWindowStatusOperationsClientImpl$ManagedMaintenanceWindowStatusOperationsService"],["tsptest.armresourceprovider.implementation.ModelInterfaceSameNamesClientImpl$ModelInterfaceSameNamesService"],["tsptest.armresourceprovider.implementation.OperationsClientImpl$OperationsService"],["tsptest.armresourceprovider.implementation.TopLevelArmResourceInterfacesClientImpl$TopLevelArmResourceInterfacesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/tsp/arm.tsp b/packages/http-client-java/generator/http-client-generator-test/tsp/arm.tsp index 67d9b7fa583..2094f7e7865 100644 --- a/packages/http-client-java/generator/http-client-generator-test/tsp/arm.tsp +++ b/packages/http-client-java/generator/http-client-generator-test/tsp/arm.tsp @@ -243,6 +243,27 @@ model ModelInterfaceDifferentNameProperties { provisioningState: string; } +model NginxConfigurationResponse + is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = NginxConfigurationResponse, + KeyName = "configurationName", + SegmentName = "configurations", + NamePattern = "" + >; +} + +model NginxConfigurationResponseProperties { + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + rootFile?: string; +} + +model NginxConfigurationRequest { + rootFile?: string; +} + //----------------------- Paths ----------------------- @armResourceOperations interface ChildResourcesInterface @@ -315,6 +336,25 @@ interface ModelInterfaceSameName { get is ArmResourceRead; } +// Resource model is immutable output only. +@armResourceOperations +interface ImmutableResourceModel { + @put + createOrUpdate is Azure.ResourceManager.Legacy.UpdateOperation< + ResourceInstanceParameters< + NginxConfigurationResponse, + Azure.ResourceManager.Foundations.DefaultBaseParameters + >, + NginxConfigurationRequest, + NginxConfigurationResponse | ArmResourceCreatedResponse< + NginxConfigurationResponse, + LroHeaders = ArmAsyncOperationHeader + >, + ErrorResponse, + OptionalRequestBody = true + >; +} + @@clientName(TspTest.ArmResourceProvider, "ArmClient"); @@clientName(ManagedMaintenanceWindowStatusContent, "ManagedMaintenanceWindowStatus"); @@clientName(ModelInterfaceDifferentName, "ModelInterfaceSameName");