diff --git a/AutoRest.sln b/AutoRest.sln index a3b6f48ed2caa..f6f9818f25228 100644 --- a/AutoRest.sln +++ b/AutoRest.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Core", "AutoRest\AutoRest.Core\AutoRest.Core.csproj", "{C876085F-9DC3-41F0-B7B4-17022CD84684}" EndProject @@ -120,6 +120,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.AzureRes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.AzureResourceSchema.Tests", "AutoRest\Generators\AzureResourceSchema\AzureResourceSchema.Tests\AutoRest.Generator.AzureResourceSchema.Tests.csproj", "{1C3B4A33-E045-4C8F-9202-1B651A686567}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Azure.Java.Fluent", "AutoRest\Generators\Java\Azure.Java.Fluent\AutoRest.Generator.Azure.Java.Fluent.csproj", "{D35E97FD-E360-4DAA-96D0-DA45F32150B9}" +EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CSharp.Tests", "AutoRest\Generators\CSharp\CSharp.Tests\CSharp.Tests.xproj", "{784D4B45-F12A-4B8F-A86C-35A080814A19}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Azure.CSharp.Tests", "AutoRest\Generators\CSharp\Azure.CSharp.Tests\Azure.CSharp.Tests.xproj", "{43DFEF27-2FD7-4827-A669-DFD2DD1CBBCC}" @@ -496,6 +498,16 @@ Global {1C3B4A33-E045-4C8F-9202-1B651A686567}.Portable-Release|Any CPU.Build.0 = Release|Any CPU {1C3B4A33-E045-4C8F-9202-1B651A686567}.Release|Any CPU.ActiveCfg = Release|Any CPU {1C3B4A33-E045-4C8F-9202-1B651A686567}.Release|Any CPU.Build.0 = Release|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Portable-Debug|Any CPU.Build.0 = Portable-Debug|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Portable-Release|Any CPU.Build.0 = Portable-Release|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Release|Any CPU.ActiveCfg = Portable-Release|Any CPU {784D4B45-F12A-4B8F-A86C-35A080814A19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {784D4B45-F12A-4B8F-A86C-35A080814A19}.Debug|Any CPU.Build.0 = Debug|Any CPU {784D4B45-F12A-4B8F-A86C-35A080814A19}.Net45-Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -574,6 +586,7 @@ Global {B6A1FC1E-0779-4900-84EE-262DD0E53FF4} = {EF9E346D-70C6-45F5-8FF9-9B734F4A1298} {654344A5-0556-49C7-BFB3-59676D7440D3} = {B6A1FC1E-0779-4900-84EE-262DD0E53FF4} {1C3B4A33-E045-4C8F-9202-1B651A686567} = {B6A1FC1E-0779-4900-84EE-262DD0E53FF4} + {D35E97FD-E360-4DAA-96D0-DA45F32150B9} = {A9C01442-1E93-4C2D-9182-B61C9F53C3FF} {784D4B45-F12A-4B8F-A86C-35A080814A19} = {03E75B1D-A443-4A12-B31F-860DB2B45140} {43DFEF27-2FD7-4827-A669-DFD2DD1CBBCC} = {03E75B1D-A443-4A12-B31F-860DB2B45140} {8192BAA3-C606-4D44-B0D7-46BE7AFA4096} = {03E75B1D-A443-4A12-B31F-860DB2B45140} diff --git a/AutoRest/AutoRest.Core/CodeNamer.cs b/AutoRest/AutoRest.Core/CodeNamer.cs index 6c1421c3d6964..6182518a4f7e4 100644 --- a/AutoRest/AutoRest.Core/CodeNamer.cs +++ b/AutoRest/AutoRest.Core/CodeNamer.cs @@ -114,7 +114,7 @@ public virtual void NormalizeClientModel(ServiceClient client) throw new ArgumentNullException("client"); } - client.Name = GetTypeName(client.Name); + client.Name = GetClientName(client.Name); client.Namespace = GetNamespaceName(client.Namespace); NormalizeClientProperties(client); @@ -392,6 +392,15 @@ public virtual string GetMethodGroupName(string name) return PascalCase(RemoveInvalidCharacters(GetEscapedReservedName(name, "Model"))); } + public virtual string GetClientName(string name) + { + if (string.IsNullOrWhiteSpace(name)) + { + return name; + } + return PascalCase(RemoveInvalidCharacters(GetEscapedReservedName(name, "Model"))); + } + /// /// Formats a string for naming a local variable using Camel case by default. /// @@ -680,7 +689,7 @@ protected virtual void ResolveMethodGroupNameCollision(ServiceClient serviceClie } } - private static string ResolveNameConflict( + protected static string ResolveNameConflict( Dictionary exclusionDictionary, string typeName, string type, diff --git a/AutoRest/AutoRest.Core/GlobalSuppressions.cs b/AutoRest/AutoRest.Core/GlobalSuppressions.cs index df197f6d5a762..b9a12a5b4423b 100644 --- a/AutoRest/AutoRest.Core/GlobalSuppressions.cs +++ b/AutoRest/AutoRest.Core/GlobalSuppressions.cs @@ -60,3 +60,4 @@ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.ClientModel.ServiceClient.#Methods")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.ClientModel.ServiceClient.#Properties")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.ClientModel.ParameterTransformation.#ParameterMappings")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.CodeNamer.#ResolveNameConflict(System.Collections.Generic.Dictionary`2,System.String,System.String,System.String)")] diff --git a/AutoRest/AutoRest.Core/Settings.cs b/AutoRest/AutoRest.Core/Settings.cs index 81ea5ca05c3df..5731df02869ef 100644 --- a/AutoRest/AutoRest.Core/Settings.cs +++ b/AutoRest/AutoRest.Core/Settings.cs @@ -161,7 +161,7 @@ public string Header } else if (value == "MICROSOFT_MIT_NO_CODEGEN") { - _header = MicrosoftMitLicenseHeader; + _header = MicrosoftMitLicenseHeader + Environment.NewLine + "Code generated by Microsoft (R) AutoRest Code Generator."; } else if (value == "NONE") { diff --git a/AutoRest/AutoRest/AutoRest.json b/AutoRest/AutoRest/AutoRest.json index f368702db7a63..6ea68906d5894 100644 --- a/AutoRest/AutoRest/AutoRest.json +++ b/AutoRest/AutoRest/AutoRest.json @@ -24,6 +24,9 @@ "Azure.Java": { "type": "AzureJavaCodeGenerator, AutoRest.Generator.Azure.Java" }, + "Azure.Java.Fluent": { + "type": "AzureJavaFluentCodeGenerator, AutoRest.Generator.Azure.Java.Fluent" + }, "Python": { "type": "PythonCodeGenerator, AutoRest.Generator.Python" }, diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/build.gradle b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/build.gradle new file mode 100644 index 0000000000000..436e0f2ff050f --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/build.gradle @@ -0,0 +1,99 @@ +apply plugin: 'java' +apply plugin: 'checkstyle' + +group = 'com.microsoft.azure' +version = '1.0.0-SNAPSHOT' + +tasks.withType(JavaCompile) { + options.encoding = "UTF-8" +} + +repositories { + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } +} + +checkstyle { + toolVersion = "6.9" + configFile = new File("$rootDir/Tools/checkstyle/checkstyle.xml") + configProperties = [samedir: "$rootDir/Tools/checkstyle"] + reportsDir = new File("$rootDir/Tools/checkstyle/reports") +} + +dependencies { + compile 'commons-codec:commons-codec:1.10' + compile 'com.microsoft.azure:azure-client-runtime:1.0.0-SNAPSHOT' + compile 'joda-time:joda-time:2.8.2' + compile 'javax.validation:validation-api:1.1.0.Final' + testCompile 'junit:junit:4.12' + testCompile 'junit:junit-dep:4.11' + testCompile 'commons-io:commons-io:2.4' +} + +test { + testLogging { + events "passed", "skipped", "failed", "standardError" + } +} + +javadoc { + options.encoding = 'UTF-8' +} + +test { + reports.getHtml() + reports.html.destination = file("${projectDir}/../../../../TestResults/JavaAzureFluentCodeGen") +} + +task buildRuntime(type: Exec) { + workingDir "${projectDir}/../../../../ClientRuntimes/Java" + if (System.getProperty('os.name').toLowerCase().contains('windows')) { + commandLine 'cmd', '/c', 'gradle', 'uploadArchives' + } else { + commandLine 'gradle', 'uploadArchives' + } +} + +task npmrestore(type: Exec) { + workingDir "${projectDir}/../../../TestServer/server" + if (System.getProperty('os.name').toLowerCase().contains('windows')) { + commandLine 'cmd', '/c', 'npm', 'install' + } else { + commandLine 'npm', 'install' + } +} + +task installforever(type: Exec, dependsOn: 'npmrestore') { + if (System.getProperty('os.name').toLowerCase().contains('windows')) { + commandLine 'cmd', '/c', 'npm', 'install', '-g', 'forever' + } else { + commandLine 'npm', 'install', '-g', 'forever' + } +} + +task runserver(type: Exec, dependsOn: 'installforever') { + workingDir "${projectDir}/../../../TestServer/server" + if (System.getProperty('os.name').toLowerCase().contains('windows')) { + commandLine 'cmd', '/c', 'forever', 'start', 'startup/www.js' + } else { + commandLine 'forever', 'start', 'startup/www.js' + } +} + +task testcoverage(type: JavaExec, dependsOn: 'runserver') { + main = 'fixtures.azurereport.CoverageReporter' + classpath = sourceSets.test.runtimeClasspath +} + +task stopserver(type: Exec, dependsOn: 'testcoverage') { + workingDir "${projectDir}/../../../TestServer/server" + if (System.getProperty('os.name').toLowerCase().contains('windows')) { + commandLine 'cmd', '/c', 'forever', 'stop', 'startup/www.js' + } else { + commandLine 'forever', 'stop', 'startup/www.js' + } +} + +tasks.compileJava.dependsOn 'clean' +tasks.test.dependsOn 'runserver' +tasks.test.finalizedBy 'stopserver' \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/Error.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/Error.java new file mode 100644 index 0000000000000..29cdf0fda1c94 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/Error.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureparametergrouping; + + +/** + * The Error model. + */ +public class Error { + /** + * The status property. + */ + private Integer status; + + /** + * The message property. + */ + private String message; + + /** + * Get the status value. + * + * @return the status value + */ + public Integer status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the Error object itself. + */ + public Error withStatus(Integer status) { + this.status = status; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/ErrorException.java new file mode 100644 index 0000000000000..848bf2e0b782b --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/ErrorException.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureparametergrouping; + +import com.microsoft.rest.RestException; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with Error information. + */ +public class ErrorException extends RestException { + /** + * Information about the associated HTTP response. + */ + private Response response; + /** + * The actual response body. + */ + private Error body; + /** + * Initializes a new instance of the ErrorException class. + */ + public ErrorException() { } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message The exception message. + */ + public ErrorException(final String message) { + super(message); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message + * @param cause exception that caused this exception to occur + */ + public ErrorException(final String message, final Throwable cause) { + super(message, cause); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param cause exception that caused this exception to occur + */ + public ErrorException(final Throwable cause) { + super(cause); + } + /** + * Gets information about the associated HTTP response. + * + * @return the HTTP response + */ + public Response getResponse() { + return response; + } + /** + * Gets the HTTP response body. + * + * @return the response body + */ + public Error getBody() { + return body; + } + /** + * Sets the HTTP response. + * + * @param response the HTTP response + */ + public void setResponse(Response response) { + this.response = response; + } + /** + * Sets the HTTP response body. + * + * @param body the response body + */ + public void setBody(Error body) { + this.body = body; + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/AutoRestParameterGroupingTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/AutoRestParameterGroupingTestServiceImpl.java new file mode 100644 index 0000000000000..cb9559c86857e --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/AutoRestParameterGroupingTestServiceImpl.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureparametergrouping.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Initializes a new instance of the AutoRestParameterGroupingTestServiceImpl class. + */ +public final class AutoRestParameterGroupingTestServiceImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestParameterGroupingTestServiceImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestParameterGroupingTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestParameterGroupingTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ParameterGroupingsInner object to access its operations. + */ + private ParameterGroupingsInner parameterGroupings; + + /** + * Gets the ParameterGroupingsInner object to access its operations. + * @return the ParameterGroupingsInner object. + */ + public ParameterGroupingsInner parameterGroupings() { + return this.parameterGroupings; + } + + /** + * Initializes an instance of AutoRestParameterGroupingTestService client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestParameterGroupingTestServiceImpl(ServiceClientCredentials credentials) { + this("https://localhost", credentials); + } + + /** + * Initializes an instance of AutoRestParameterGroupingTestService client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AutoRestParameterGroupingTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestParameterGroupingTestService client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestParameterGroupingTestServiceImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.parameterGroupings = new ParameterGroupingsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestParameterGroupingTestService, 1.0.0"); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/FirstParameterGroupInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/FirstParameterGroupInner.java new file mode 100644 index 0000000000000..47e3dbc35e8b6 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/FirstParameterGroupInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureparametergrouping.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for a set of operations, such as: + * parameterGrouping_postMultiParamGroups, + * parameterGrouping_postSharedParameterGroupObject. + */ +public class FirstParameterGroupInner { + /** + * The headerOne property. + */ + @JsonProperty(value = "") + private String headerOne; + + /** + * Query parameter with default. + */ + @JsonProperty(value = "") + private Integer queryOne; + + /** + * Get the headerOne value. + * + * @return the headerOne value + */ + public String headerOne() { + return this.headerOne; + } + + /** + * Set the headerOne value. + * + * @param headerOne the headerOne value to set + * @return the FirstParameterGroupInner object itself. + */ + public FirstParameterGroupInner withHeaderOne(String headerOne) { + this.headerOne = headerOne; + return this; + } + + /** + * Get the queryOne value. + * + * @return the queryOne value + */ + public Integer queryOne() { + return this.queryOne; + } + + /** + * Set the queryOne value. + * + * @param queryOne the queryOne value to set + * @return the FirstParameterGroupInner object itself. + */ + public FirstParameterGroupInner withQueryOne(Integer queryOne) { + this.queryOne = queryOne; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingPostMultiParamGroupsSecondParamGroupInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingPostMultiParamGroupsSecondParamGroupInner.java new file mode 100644 index 0000000000000..cc3cbe9cceefb --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingPostMultiParamGroupsSecondParamGroupInner.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureparametergrouping.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for the parameterGrouping_postMultiParamGroups + * operation. + */ +public class ParameterGroupingPostMultiParamGroupsSecondParamGroupInner { + /** + * The headerTwo property. + */ + @JsonProperty(value = "") + private String headerTwo; + + /** + * Query parameter with default. + */ + @JsonProperty(value = "") + private Integer queryTwo; + + /** + * Get the headerTwo value. + * + * @return the headerTwo value + */ + public String headerTwo() { + return this.headerTwo; + } + + /** + * Set the headerTwo value. + * + * @param headerTwo the headerTwo value to set + * @return the ParameterGroupingPostMultiParamGroupsSecondParamGroupInner object itself. + */ + public ParameterGroupingPostMultiParamGroupsSecondParamGroupInner withHeaderTwo(String headerTwo) { + this.headerTwo = headerTwo; + return this; + } + + /** + * Get the queryTwo value. + * + * @return the queryTwo value + */ + public Integer queryTwo() { + return this.queryTwo; + } + + /** + * Set the queryTwo value. + * + * @param queryTwo the queryTwo value to set + * @return the ParameterGroupingPostMultiParamGroupsSecondParamGroupInner object itself. + */ + public ParameterGroupingPostMultiParamGroupsSecondParamGroupInner withQueryTwo(Integer queryTwo) { + this.queryTwo = queryTwo; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingPostOptionalParametersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingPostOptionalParametersInner.java new file mode 100644 index 0000000000000..1c05150738afe --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingPostOptionalParametersInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureparametergrouping.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for the parameterGrouping_postOptional operation. + */ +public class ParameterGroupingPostOptionalParametersInner { + /** + * The customHeader property. + */ + @JsonProperty(value = "") + private String customHeader; + + /** + * Query parameter with default. + */ + @JsonProperty(value = "") + private Integer query; + + /** + * Get the customHeader value. + * + * @return the customHeader value + */ + public String customHeader() { + return this.customHeader; + } + + /** + * Set the customHeader value. + * + * @param customHeader the customHeader value to set + * @return the ParameterGroupingPostOptionalParametersInner object itself. + */ + public ParameterGroupingPostOptionalParametersInner withCustomHeader(String customHeader) { + this.customHeader = customHeader; + return this; + } + + /** + * Get the query value. + * + * @return the query value + */ + public Integer query() { + return this.query; + } + + /** + * Set the query value. + * + * @param query the query value to set + * @return the ParameterGroupingPostOptionalParametersInner object itself. + */ + public ParameterGroupingPostOptionalParametersInner withQuery(Integer query) { + this.query = query; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingPostRequiredParametersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingPostRequiredParametersInner.java new file mode 100644 index 0000000000000..59adb759da10a --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingPostRequiredParametersInner.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureparametergrouping.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for the parameterGrouping_postRequired operation. + */ +public class ParameterGroupingPostRequiredParametersInner { + /** + * The body property. + */ + @JsonProperty(value = "", required = true) + private int body; + + /** + * The customHeader property. + */ + @JsonProperty(value = "") + private String customHeader; + + /** + * Query parameter with default. + */ + @JsonProperty(value = "") + private Integer query; + + /** + * Path parameter. + */ + @JsonProperty(value = "", required = true) + private String path; + + /** + * Get the body value. + * + * @return the body value + */ + public int body() { + return this.body; + } + + /** + * Set the body value. + * + * @param body the body value to set + * @return the ParameterGroupingPostRequiredParametersInner object itself. + */ + public ParameterGroupingPostRequiredParametersInner withBody(int body) { + this.body = body; + return this; + } + + /** + * Get the customHeader value. + * + * @return the customHeader value + */ + public String customHeader() { + return this.customHeader; + } + + /** + * Set the customHeader value. + * + * @param customHeader the customHeader value to set + * @return the ParameterGroupingPostRequiredParametersInner object itself. + */ + public ParameterGroupingPostRequiredParametersInner withCustomHeader(String customHeader) { + this.customHeader = customHeader; + return this; + } + + /** + * Get the query value. + * + * @return the query value + */ + public Integer query() { + return this.query; + } + + /** + * Set the query value. + * + * @param query the query value to set + * @return the ParameterGroupingPostRequiredParametersInner object itself. + */ + public ParameterGroupingPostRequiredParametersInner withQuery(Integer query) { + this.query = query; + return this; + } + + /** + * Get the path value. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set the path value. + * + * @param path the path value to set + * @return the ParameterGroupingPostRequiredParametersInner object itself. + */ + public ParameterGroupingPostRequiredParametersInner withPath(String path) { + this.path = path; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingsInner.java new file mode 100644 index 0000000000000..1322f4fb0828b --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingsInner.java @@ -0,0 +1,495 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureparametergrouping.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.Validator; +import fixtures.azureparametergrouping.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in ParameterGroupings. + */ +public final class ParameterGroupingsInner { + /** The Retrofit service to perform REST calls. */ + private ParameterGroupingsService service; + /** The service client containing this operation class. */ + private AutoRestParameterGroupingTestServiceImpl client; + + /** + * Initializes an instance of ParameterGroupingsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ParameterGroupingsInner(Retrofit retrofit, AutoRestParameterGroupingTestServiceImpl client) { + this.service = retrofit.create(ParameterGroupingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ParameterGroupings to be + * used by Retrofit to perform actually REST calls. + */ + interface ParameterGroupingsService { + @Headers("Content-Type: application/json; charset=utf-8") + @POST("parameterGrouping/postRequired/{path}") + Call postRequired(@Path("path") String path, @Header("accept-language") String acceptLanguage, @Body int body, @Header("customHeader") String customHeader, @Query("query") Integer query, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("parameterGrouping/postOptional") + Call postOptional(@Header("accept-language") String acceptLanguage, @Header("customHeader") String customHeader, @Query("query") Integer query, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("parameterGrouping/postMultipleParameterGroups") + Call postMultiParamGroups(@Header("accept-language") String acceptLanguage, @Header("header-one") String headerOne, @Query("query-one") Integer queryOne, @Header("header-two") String headerTwo, @Query("query-two") Integer queryTwo, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("parameterGrouping/sharedParameterGroupObject") + Call postSharedParameterGroupObject(@Header("accept-language") String acceptLanguage, @Header("header-one") String headerOne, @Query("query-one") Integer queryOne, @Header("User-Agent") String userAgent); + + } + + /** + * Post a bunch of required parameters grouped. + * + * @param parameterGroupingPostRequiredParameters Additional parameters for the operation + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postRequired(ParameterGroupingPostRequiredParametersInner parameterGroupingPostRequiredParameters) throws ErrorException, IOException, IllegalArgumentException { + if (parameterGroupingPostRequiredParameters == null) { + throw new IllegalArgumentException("Parameter parameterGroupingPostRequiredParameters is required and cannot be null."); + } + Validator.validate(parameterGroupingPostRequiredParameters); + int body = parameterGroupingPostRequiredParameters.body(); + String customHeader = parameterGroupingPostRequiredParameters.customHeader(); + Integer query = parameterGroupingPostRequiredParameters.query(); + String path = parameterGroupingPostRequiredParameters.path(); + Call call = service.postRequired(path, this.client.acceptLanguage(), body, customHeader, query, this.client.userAgent()); + return postRequiredDelegate(call.execute()); + } + + /** + * Post a bunch of required parameters grouped. + * + * @param parameterGroupingPostRequiredParameters Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postRequiredAsync(ParameterGroupingPostRequiredParametersInner parameterGroupingPostRequiredParameters, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (parameterGroupingPostRequiredParameters == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter parameterGroupingPostRequiredParameters is required and cannot be null.")); + return null; + } + Validator.validate(parameterGroupingPostRequiredParameters, serviceCallback); + int body = parameterGroupingPostRequiredParameters.body(); + String customHeader = parameterGroupingPostRequiredParameters.customHeader(); + Integer query = parameterGroupingPostRequiredParameters.query(); + String path = parameterGroupingPostRequiredParameters.path(); + Call call = service.postRequired(path, this.client.acceptLanguage(), body, customHeader, query, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postRequiredDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postRequiredDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Post a bunch of optional parameters grouped. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postOptional() throws ErrorException, IOException { + final ParameterGroupingPostOptionalParametersInner parameterGroupingPostOptionalParameters = null; + String customHeader = null; + Integer query = null; + Call call = service.postOptional(this.client.acceptLanguage(), customHeader, query, this.client.userAgent()); + return postOptionalDelegate(call.execute()); + } + + /** + * Post a bunch of optional parameters grouped. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postOptionalAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ParameterGroupingPostOptionalParametersInner parameterGroupingPostOptionalParameters = null; + String customHeader = null; + Integer query = null; + Call call = service.postOptional(this.client.acceptLanguage(), customHeader, query, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postOptionalDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Post a bunch of optional parameters grouped. + * + * @param parameterGroupingPostOptionalParameters Additional parameters for the operation + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postOptional(ParameterGroupingPostOptionalParametersInner parameterGroupingPostOptionalParameters) throws ErrorException, IOException { + Validator.validate(parameterGroupingPostOptionalParameters); + String customHeader = null; + if (parameterGroupingPostOptionalParameters != null) { + customHeader = parameterGroupingPostOptionalParameters.customHeader(); + } + Integer query = null; + if (parameterGroupingPostOptionalParameters != null) { + query = parameterGroupingPostOptionalParameters.query(); + } + Call call = service.postOptional(this.client.acceptLanguage(), customHeader, query, this.client.userAgent()); + return postOptionalDelegate(call.execute()); + } + + /** + * Post a bunch of optional parameters grouped. + * + * @param parameterGroupingPostOptionalParameters Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postOptionalAsync(ParameterGroupingPostOptionalParametersInner parameterGroupingPostOptionalParameters, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(parameterGroupingPostOptionalParameters, serviceCallback); + String customHeader = null; + if (parameterGroupingPostOptionalParameters != null) { + customHeader = parameterGroupingPostOptionalParameters.customHeader(); + } + Integer query = null; + if (parameterGroupingPostOptionalParameters != null) { + query = parameterGroupingPostOptionalParameters.query(); + } + Call call = service.postOptional(this.client.acceptLanguage(), customHeader, query, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postOptionalDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postOptionalDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Post parameters from multiple different parameter groups. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postMultiParamGroups() throws ErrorException, IOException { + final FirstParameterGroupInner firstParameterGroup = null; + final ParameterGroupingPostMultiParamGroupsSecondParamGroupInner parameterGroupingPostMultiParamGroupsSecondParamGroup = null; + String headerOne = null; + Integer queryOne = null; + String headerTwo = null; + Integer queryTwo = null; + Call call = service.postMultiParamGroups(this.client.acceptLanguage(), headerOne, queryOne, headerTwo, queryTwo, this.client.userAgent()); + return postMultiParamGroupsDelegate(call.execute()); + } + + /** + * Post parameters from multiple different parameter groups. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postMultiParamGroupsAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final FirstParameterGroupInner firstParameterGroup = null; + final ParameterGroupingPostMultiParamGroupsSecondParamGroupInner parameterGroupingPostMultiParamGroupsSecondParamGroup = null; + String headerOne = null; + Integer queryOne = null; + String headerTwo = null; + Integer queryTwo = null; + Call call = service.postMultiParamGroups(this.client.acceptLanguage(), headerOne, queryOne, headerTwo, queryTwo, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postMultiParamGroupsDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Post parameters from multiple different parameter groups. + * + * @param firstParameterGroup Additional parameters for the operation + * @param parameterGroupingPostMultiParamGroupsSecondParamGroup Additional parameters for the operation + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postMultiParamGroups(FirstParameterGroupInner firstParameterGroup, ParameterGroupingPostMultiParamGroupsSecondParamGroupInner parameterGroupingPostMultiParamGroupsSecondParamGroup) throws ErrorException, IOException { + Validator.validate(firstParameterGroup); + Validator.validate(parameterGroupingPostMultiParamGroupsSecondParamGroup); + String headerOne = null; + if (firstParameterGroup != null) { + headerOne = firstParameterGroup.headerOne(); + } + Integer queryOne = null; + if (firstParameterGroup != null) { + queryOne = firstParameterGroup.queryOne(); + } + String headerTwo = null; + if (parameterGroupingPostMultiParamGroupsSecondParamGroup != null) { + headerTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.headerTwo(); + } + Integer queryTwo = null; + if (parameterGroupingPostMultiParamGroupsSecondParamGroup != null) { + queryTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.queryTwo(); + } + Call call = service.postMultiParamGroups(this.client.acceptLanguage(), headerOne, queryOne, headerTwo, queryTwo, this.client.userAgent()); + return postMultiParamGroupsDelegate(call.execute()); + } + + /** + * Post parameters from multiple different parameter groups. + * + * @param firstParameterGroup Additional parameters for the operation + * @param parameterGroupingPostMultiParamGroupsSecondParamGroup Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postMultiParamGroupsAsync(FirstParameterGroupInner firstParameterGroup, ParameterGroupingPostMultiParamGroupsSecondParamGroupInner parameterGroupingPostMultiParamGroupsSecondParamGroup, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(firstParameterGroup, serviceCallback); + Validator.validate(parameterGroupingPostMultiParamGroupsSecondParamGroup, serviceCallback); + String headerOne = null; + if (firstParameterGroup != null) { + headerOne = firstParameterGroup.headerOne(); + } + Integer queryOne = null; + if (firstParameterGroup != null) { + queryOne = firstParameterGroup.queryOne(); + } + String headerTwo = null; + if (parameterGroupingPostMultiParamGroupsSecondParamGroup != null) { + headerTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.headerTwo(); + } + Integer queryTwo = null; + if (parameterGroupingPostMultiParamGroupsSecondParamGroup != null) { + queryTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.queryTwo(); + } + Call call = service.postMultiParamGroups(this.client.acceptLanguage(), headerOne, queryOne, headerTwo, queryTwo, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postMultiParamGroupsDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postMultiParamGroupsDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Post parameters with a shared parameter group object. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postSharedParameterGroupObject() throws ErrorException, IOException { + final FirstParameterGroupInner firstParameterGroup = null; + String headerOne = null; + Integer queryOne = null; + Call call = service.postSharedParameterGroupObject(this.client.acceptLanguage(), headerOne, queryOne, this.client.userAgent()); + return postSharedParameterGroupObjectDelegate(call.execute()); + } + + /** + * Post parameters with a shared parameter group object. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postSharedParameterGroupObjectAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final FirstParameterGroupInner firstParameterGroup = null; + String headerOne = null; + Integer queryOne = null; + Call call = service.postSharedParameterGroupObject(this.client.acceptLanguage(), headerOne, queryOne, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postSharedParameterGroupObjectDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Post parameters with a shared parameter group object. + * + * @param firstParameterGroup Additional parameters for the operation + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postSharedParameterGroupObject(FirstParameterGroupInner firstParameterGroup) throws ErrorException, IOException { + Validator.validate(firstParameterGroup); + String headerOne = null; + if (firstParameterGroup != null) { + headerOne = firstParameterGroup.headerOne(); + } + Integer queryOne = null; + if (firstParameterGroup != null) { + queryOne = firstParameterGroup.queryOne(); + } + Call call = service.postSharedParameterGroupObject(this.client.acceptLanguage(), headerOne, queryOne, this.client.userAgent()); + return postSharedParameterGroupObjectDelegate(call.execute()); + } + + /** + * Post parameters with a shared parameter group object. + * + * @param firstParameterGroup Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postSharedParameterGroupObjectAsync(FirstParameterGroupInner firstParameterGroup, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(firstParameterGroup, serviceCallback); + String headerOne = null; + if (firstParameterGroup != null) { + headerOne = firstParameterGroup.headerOne(); + } + Integer queryOne = null; + if (firstParameterGroup != null) { + queryOne = firstParameterGroup.queryOne(); + } + Call call = service.postSharedParameterGroupObject(this.client.acceptLanguage(), headerOne, queryOne, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postSharedParameterGroupObjectDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postSharedParameterGroupObjectDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/package-info.java new file mode 100644 index 0000000000000..191b184e65a7d --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestParameterGroupingTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.azureparametergrouping.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/package-info.java new file mode 100644 index 0000000000000..e7d821411f361 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureparametergrouping/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for AutoRestParameterGroupingTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.azureparametergrouping; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/Error.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/Error.java new file mode 100644 index 0000000000000..5b5927e320a8c --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/Error.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurereport; + + +/** + * The Error model. + */ +public class Error { + /** + * The status property. + */ + private Integer status; + + /** + * The message property. + */ + private String message; + + /** + * Get the status value. + * + * @return the status value + */ + public Integer status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the Error object itself. + */ + public Error withStatus(Integer status) { + this.status = status; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/ErrorException.java new file mode 100644 index 0000000000000..b9e28d9bce633 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/ErrorException.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurereport; + +import com.microsoft.rest.RestException; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with Error information. + */ +public class ErrorException extends RestException { + /** + * Information about the associated HTTP response. + */ + private Response response; + /** + * The actual response body. + */ + private Error body; + /** + * Initializes a new instance of the ErrorException class. + */ + public ErrorException() { } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message The exception message. + */ + public ErrorException(final String message) { + super(message); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message + * @param cause exception that caused this exception to occur + */ + public ErrorException(final String message, final Throwable cause) { + super(message, cause); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param cause exception that caused this exception to occur + */ + public ErrorException(final Throwable cause) { + super(cause); + } + /** + * Gets information about the associated HTTP response. + * + * @return the HTTP response + */ + public Response getResponse() { + return response; + } + /** + * Gets the HTTP response body. + * + * @return the response body + */ + public Error getBody() { + return body; + } + /** + * Sets the HTTP response. + * + * @param response the HTTP response + */ + public void setResponse(Response response) { + this.response = response; + } + /** + * Sets the HTTP response body. + * + * @param body the response body + */ + public void setBody(Error body) { + this.body = body; + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/implementation/AutoRestReportServiceForAzureImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/implementation/AutoRestReportServiceForAzureImpl.java new file mode 100644 index 0000000000000..fef1b3b84a103 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/implementation/AutoRestReportServiceForAzureImpl.java @@ -0,0 +1,231 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurereport.implementation; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.azurereport.ErrorException; +import java.io.IOException; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.Response; + +/** + * Initializes a new instance of the AutoRestReportServiceForAzureImpl class. + */ +public final class AutoRestReportServiceForAzureImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private AutoRestReportServiceForAzureService service; + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestReportServiceForAzureImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestReportServiceForAzureImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestReportServiceForAzureImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * Initializes an instance of AutoRestReportServiceForAzure client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestReportServiceForAzureImpl(ServiceClientCredentials credentials) { + this("http://localhost", credentials); + } + + /** + * Initializes an instance of AutoRestReportServiceForAzure client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AutoRestReportServiceForAzureImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestReportServiceForAzure client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestReportServiceForAzureImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestReportServiceForAzure, 1.0.0"); + } + + private void initializeService() { + service = restClient().retrofit().create(AutoRestReportServiceForAzureService.class); + } + + /** + * The interface defining all the services for AutoRestReportServiceForAzure to be + * used by Retrofit to perform actually REST calls. + */ + interface AutoRestReportServiceForAzureService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("report/azure") + Call getReport(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get test coverage report. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the Map<String, Integer> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getReport() throws ErrorException, IOException { + Call call = service.getReport(this.acceptLanguage(), this.userAgent()); + return getReportDelegate(call.execute()); + } + + /** + * Get test coverage report. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getReportAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getReport(this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getReportDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getReportDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder, ErrorException>(this.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/implementation/package-info.java new file mode 100644 index 0000000000000..769426621a74d --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestReportServiceForAzure. + * Test Infrastructure for AutoRest. + */ +package fixtures.azurereport.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/package-info.java new file mode 100644 index 0000000000000..8138a8bbc3b98 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurereport/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for AutoRestReportServiceForAzure. + * Test Infrastructure for AutoRest. + */ +package fixtures.azurereport; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/Error.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/Error.java new file mode 100644 index 0000000000000..ce3a77e997f78 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/Error.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureresource; + + +/** + * The Error model. + */ +public class Error { + /** + * The status property. + */ + private Integer status; + + /** + * The message property. + */ + private String message; + + /** + * Get the status value. + * + * @return the status value + */ + public Integer status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the Error object itself. + */ + public Error withStatus(Integer status) { + this.status = status; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/ErrorException.java new file mode 100644 index 0000000000000..1de42933fbfad --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/ErrorException.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureresource; + +import com.microsoft.rest.RestException; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with Error information. + */ +public class ErrorException extends RestException { + /** + * Information about the associated HTTP response. + */ + private Response response; + /** + * The actual response body. + */ + private Error body; + /** + * Initializes a new instance of the ErrorException class. + */ + public ErrorException() { } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message The exception message. + */ + public ErrorException(final String message) { + super(message); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message + * @param cause exception that caused this exception to occur + */ + public ErrorException(final String message, final Throwable cause) { + super(message, cause); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param cause exception that caused this exception to occur + */ + public ErrorException(final Throwable cause) { + super(cause); + } + /** + * Gets information about the associated HTTP response. + * + * @return the HTTP response + */ + public Response getResponse() { + return response; + } + /** + * Gets the HTTP response body. + * + * @return the response body + */ + public Error getBody() { + return body; + } + /** + * Sets the HTTP response. + * + * @param response the HTTP response + */ + public void setResponse(Response response) { + this.response = response; + } + /** + * Sets the HTTP response body. + * + * @param body the response body + */ + public void setBody(Error body) { + this.body = body; + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/AutoRestResourceFlatteningTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/AutoRestResourceFlatteningTestServiceImpl.java new file mode 100644 index 0000000000000..03ee6909d63b0 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/AutoRestResourceFlatteningTestServiceImpl.java @@ -0,0 +1,612 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureresource.implementation; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.Validator; +import fixtures.azureresource.ErrorException; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PUT; +import retrofit2.Response; + +/** + * Initializes a new instance of the AutoRestResourceFlatteningTestServiceImpl class. + */ +public final class AutoRestResourceFlatteningTestServiceImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private AutoRestResourceFlatteningTestServiceService service; + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestResourceFlatteningTestServiceImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestResourceFlatteningTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestResourceFlatteningTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * Initializes an instance of AutoRestResourceFlatteningTestService client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestResourceFlatteningTestServiceImpl(ServiceClientCredentials credentials) { + this("http://localhost", credentials); + } + + /** + * Initializes an instance of AutoRestResourceFlatteningTestService client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AutoRestResourceFlatteningTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestResourceFlatteningTestService client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestResourceFlatteningTestServiceImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestResourceFlatteningTestService, 1.0.0"); + } + + private void initializeService() { + service = restClient().retrofit().create(AutoRestResourceFlatteningTestServiceService.class); + } + + /** + * The interface defining all the services for AutoRestResourceFlatteningTestService to be + * used by Retrofit to perform actually REST calls. + */ + interface AutoRestResourceFlatteningTestServiceService { + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("azure/resource-flatten/array") + Call putArray(@Body List resourceArray, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azure/resource-flatten/array") + Call getArray(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("azure/resource-flatten/dictionary") + Call putDictionary(@Body Map resourceDictionary, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azure/resource-flatten/dictionary") + Call getDictionary(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("azure/resource-flatten/resourcecollection") + Call putResourceCollection(@Body ResourceCollectionInner resourceComplexObject, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azure/resource-flatten/resourcecollection") + Call getResourceCollection(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Put External Resource as an Array. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putArray() throws ErrorException, IOException { + final List resourceArray = null; + Call call = service.putArray(resourceArray, this.acceptLanguage(), this.userAgent()); + return putArrayDelegate(call.execute()); + } + + /** + * Put External Resource as an Array. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putArrayAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final List resourceArray = null; + Call call = service.putArray(resourceArray, this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putArrayDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Put External Resource as an Array. + * + * @param resourceArray External Resource as an Array to put + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putArray(List resourceArray) throws ErrorException, IOException { + Validator.validate(resourceArray); + Call call = service.putArray(resourceArray, this.acceptLanguage(), this.userAgent()); + return putArrayDelegate(call.execute()); + } + + /** + * Put External Resource as an Array. + * + * @param resourceArray External Resource as an Array to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putArrayAsync(List resourceArray, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(resourceArray, serviceCallback); + Call call = service.putArray(resourceArray, this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putArrayDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putArrayDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get External Resource as an Array. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<FlattenedProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getArray() throws ErrorException, IOException { + Call call = service.getArray(this.acceptLanguage(), this.userAgent()); + return getArrayDelegate(call.execute()); + } + + /** + * Get External Resource as an Array. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getArrayAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getArray(this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getArrayDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getArrayDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder, ErrorException>(this.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Put External Resource as a Dictionary. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putDictionary() throws ErrorException, IOException { + final Map resourceDictionary = null; + Call call = service.putDictionary(resourceDictionary, this.acceptLanguage(), this.userAgent()); + return putDictionaryDelegate(call.execute()); + } + + /** + * Put External Resource as a Dictionary. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putDictionaryAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final Map resourceDictionary = null; + Call call = service.putDictionary(resourceDictionary, this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putDictionaryDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Put External Resource as a Dictionary. + * + * @param resourceDictionary External Resource as a Dictionary to put + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putDictionary(Map resourceDictionary) throws ErrorException, IOException { + Validator.validate(resourceDictionary); + Call call = service.putDictionary(resourceDictionary, this.acceptLanguage(), this.userAgent()); + return putDictionaryDelegate(call.execute()); + } + + /** + * Put External Resource as a Dictionary. + * + * @param resourceDictionary External Resource as a Dictionary to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putDictionaryAsync(Map resourceDictionary, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(resourceDictionary, serviceCallback); + Call call = service.putDictionary(resourceDictionary, this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putDictionaryDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putDictionaryDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get External Resource as a Dictionary. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the Map<String, FlattenedProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDictionary() throws ErrorException, IOException { + Call call = service.getDictionary(this.acceptLanguage(), this.userAgent()); + return getDictionaryDelegate(call.execute()); + } + + /** + * Get External Resource as a Dictionary. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDictionaryAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDictionary(this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDictionaryDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDictionaryDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder, ErrorException>(this.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Put External Resource as a ResourceCollection. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putResourceCollection() throws ErrorException, IOException { + final ResourceCollectionInner resourceComplexObject = null; + Call call = service.putResourceCollection(resourceComplexObject, this.acceptLanguage(), this.userAgent()); + return putResourceCollectionDelegate(call.execute()); + } + + /** + * Put External Resource as a ResourceCollection. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putResourceCollectionAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ResourceCollectionInner resourceComplexObject = null; + Call call = service.putResourceCollection(resourceComplexObject, this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putResourceCollectionDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Put External Resource as a ResourceCollection. + * + * @param resourceComplexObject External Resource as a ResourceCollection to put + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putResourceCollection(ResourceCollectionInner resourceComplexObject) throws ErrorException, IOException { + Validator.validate(resourceComplexObject); + Call call = service.putResourceCollection(resourceComplexObject, this.acceptLanguage(), this.userAgent()); + return putResourceCollectionDelegate(call.execute()); + } + + /** + * Put External Resource as a ResourceCollection. + * + * @param resourceComplexObject External Resource as a ResourceCollection to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putResourceCollectionAsync(ResourceCollectionInner resourceComplexObject, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(resourceComplexObject, serviceCallback); + Call call = service.putResourceCollection(resourceComplexObject, this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putResourceCollectionDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putResourceCollectionDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get External Resource as a ResourceCollection. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ResourceCollectionInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse getResourceCollection() throws ErrorException, IOException { + Call call = service.getResourceCollection(this.acceptLanguage(), this.userAgent()); + return getResourceCollectionDelegate(call.execute()); + } + + /** + * Get External Resource as a ResourceCollection. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getResourceCollectionAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getResourceCollection(this.acceptLanguage(), this.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getResourceCollectionDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getResourceCollectionDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/FlattenedProductInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/FlattenedProductInner.java new file mode 100644 index 0000000000000..41b1d0019e075 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/FlattenedProductInner.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureresource.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The FlattenedProductInner model. + */ +@JsonFlatten +public class FlattenedProductInner extends ResourceInner { + /** + * The pname property. + */ + @JsonProperty(value = "properties.pname") + private String pname; + + /** + * The lsize property. + */ + @JsonProperty(value = "properties.lsize") + private Integer lsize; + + /** + * The provisioningState property. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the pname value. + * + * @return the pname value + */ + public String pname() { + return this.pname; + } + + /** + * Set the pname value. + * + * @param pname the pname value to set + * @return the FlattenedProductInner object itself. + */ + public FlattenedProductInner withPname(String pname) { + this.pname = pname; + return this; + } + + /** + * Get the lsize value. + * + * @return the lsize value + */ + public Integer lsize() { + return this.lsize; + } + + /** + * Set the lsize value. + * + * @param lsize the lsize value to set + * @return the FlattenedProductInner object itself. + */ + public FlattenedProductInner withLsize(Integer lsize) { + this.lsize = lsize; + return this; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState value. + * + * @param provisioningState the provisioningState value to set + * @return the FlattenedProductInner object itself. + */ + public FlattenedProductInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/ResourceCollectionInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/ResourceCollectionInner.java new file mode 100644 index 0000000000000..47bf344317c6d --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/ResourceCollectionInner.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureresource.implementation; + +import java.util.List; +import java.util.Map; + +/** + * The ResourceCollectionInner model. + */ +public class ResourceCollectionInner { + /** + * The productresource property. + */ + private FlattenedProductInner productresource; + + /** + * The arrayofresources property. + */ + private List arrayofresources; + + /** + * The dictionaryofresources property. + */ + private Map dictionaryofresources; + + /** + * Get the productresource value. + * + * @return the productresource value + */ + public FlattenedProductInner productresource() { + return this.productresource; + } + + /** + * Set the productresource value. + * + * @param productresource the productresource value to set + * @return the ResourceCollectionInner object itself. + */ + public ResourceCollectionInner withProductresource(FlattenedProductInner productresource) { + this.productresource = productresource; + return this; + } + + /** + * Get the arrayofresources value. + * + * @return the arrayofresources value + */ + public List arrayofresources() { + return this.arrayofresources; + } + + /** + * Set the arrayofresources value. + * + * @param arrayofresources the arrayofresources value to set + * @return the ResourceCollectionInner object itself. + */ + public ResourceCollectionInner withArrayofresources(List arrayofresources) { + this.arrayofresources = arrayofresources; + return this; + } + + /** + * Get the dictionaryofresources value. + * + * @return the dictionaryofresources value + */ + public Map dictionaryofresources() { + return this.dictionaryofresources; + } + + /** + * Set the dictionaryofresources value. + * + * @param dictionaryofresources the dictionaryofresources value to set + * @return the ResourceCollectionInner object itself. + */ + public ResourceCollectionInner withDictionaryofresources(Map dictionaryofresources) { + this.dictionaryofresources = dictionaryofresources; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/ResourceInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/ResourceInner.java new file mode 100644 index 0000000000000..6892bbb2aa79f --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/ResourceInner.java @@ -0,0 +1,115 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azureresource.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Some resource. + */ +public class ResourceInner { + /** + * Resource Id. + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Resource Type. + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The tags property. + */ + private Map tags; + + /** + * Resource Location. + */ + private String location; + + /** + * Resource Name. + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ResourceInner object itself. + */ + public ResourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the ResourceInner object itself. + */ + public ResourceInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/package-info.java new file mode 100644 index 0000000000000..941141e066cd5 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestResourceFlatteningTestService. + * Resource Flattening for AutoRest. + */ +package fixtures.azureresource.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/package-info.java new file mode 100644 index 0000000000000..177aec70ce8a8 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azureresource/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for AutoRestResourceFlatteningTestService. + * Resource Flattening for AutoRest. + */ +package fixtures.azureresource; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/Error.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/Error.java new file mode 100644 index 0000000000000..64a4193abf574 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/Error.java @@ -0,0 +1,93 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials; + + +/** + * The Error model. + */ +public class Error { + /** + * The status property. + */ + private Integer status; + + /** + * The constantId property. + */ + private Integer constantId; + + /** + * The message property. + */ + private String message; + + /** + * Get the status value. + * + * @return the status value + */ + public Integer status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the Error object itself. + */ + public Error withStatus(Integer status) { + this.status = status; + return this; + } + + /** + * Get the constantId value. + * + * @return the constantId value + */ + public Integer constantId() { + return this.constantId; + } + + /** + * Set the constantId value. + * + * @param constantId the constantId value to set + * @return the Error object itself. + */ + public Error withConstantId(Integer constantId) { + this.constantId = constantId; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/ErrorException.java new file mode 100644 index 0000000000000..2afd4659b7def --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/ErrorException.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials; + +import com.microsoft.rest.RestException; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with Error information. + */ +public class ErrorException extends RestException { + /** + * Information about the associated HTTP response. + */ + private Response response; + /** + * The actual response body. + */ + private Error body; + /** + * Initializes a new instance of the ErrorException class. + */ + public ErrorException() { } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message The exception message. + */ + public ErrorException(final String message) { + super(message); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message + * @param cause exception that caused this exception to occur + */ + public ErrorException(final String message, final Throwable cause) { + super(message, cause); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param cause exception that caused this exception to occur + */ + public ErrorException(final Throwable cause) { + super(cause); + } + /** + * Gets information about the associated HTTP response. + * + * @return the HTTP response + */ + public Response getResponse() { + return response; + } + /** + * Gets the HTTP response body. + * + * @return the response body + */ + public Error getBody() { + return body; + } + /** + * Sets the HTTP response. + * + * @param response the HTTP response + */ + public void setResponse(Response response) { + this.response = response; + } + /** + * Sets the HTTP response body. + * + * @param body the response body + */ + public void setBody(Error body) { + this.body = body; + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/OdataFilter.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/OdataFilter.java new file mode 100644 index 0000000000000..6a88adad91578 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/OdataFilter.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials; + + +/** + * The OdataFilter model. + */ +public class OdataFilter { + /** + * The id property. + */ + private Integer id; + + /** + * The name property. + */ + private String name; + + /** + * Get the id value. + * + * @return the id value + */ + public Integer id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the OdataFilter object itself. + */ + public OdataFilter withId(Integer id) { + this.id = id; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the OdataFilter object itself. + */ + public OdataFilter withName(String name) { + this.name = name; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionDefaultOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionDefaultsInner.java similarity index 82% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionDefaultOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionDefaultsInner.java index 2c52351055c65..520cf7e253bfb 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionDefaultOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionDefaultsInner.java @@ -8,15 +8,16 @@ * regenerated. */ -package fixtures.azurespecials; +package fixtures.azurespecials.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; -import fixtures.azurespecials.models.ErrorException; +import fixtures.azurespecials.ErrorException; import java.io.IOException; import okhttp3.ResponseBody; import retrofit2.Call; @@ -25,49 +26,48 @@ import retrofit2.http.Headers; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in ApiVersionDefaultOperations. + * in ApiVersionDefaults. */ -public final class ApiVersionDefaultOperationsImpl implements ApiVersionDefaultOperations { +public final class ApiVersionDefaultsInner { /** The Retrofit service to perform REST calls. */ - private ApiVersionDefaultService service; + private ApiVersionDefaultsService service; /** The service client containing this operation class. */ - private AutoRestAzureSpecialParametersTestClient client; + private AutoRestAzureSpecialParametersTestClientImpl client; /** - * Initializes an instance of ApiVersionDefaultOperations. + * Initializes an instance of ApiVersionDefaultsInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ApiVersionDefaultOperationsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClient client) { - this.service = retrofit.create(ApiVersionDefaultService.class); + public ApiVersionDefaultsInner(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(ApiVersionDefaultsService.class); this.client = client; } /** - * The interface defining all the services for ApiVersionDefaultOperations to be + * The interface defining all the services for ApiVersionDefaults to be * used by Retrofit to perform actually REST calls. */ - interface ApiVersionDefaultService { + interface ApiVersionDefaultsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview") - Call getMethodGlobalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call getMethodGlobalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview") - Call getMethodGlobalNotProvidedValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call getMethodGlobalNotProvidedValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview") - Call getPathGlobalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call getPathGlobalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview") - Call getSwaggerGlobalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call getSwaggerGlobalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -80,10 +80,10 @@ interface ApiVersionDefaultService { * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse getMethodGlobalValid() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getApiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Call call = service.getMethodGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getMethodGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return getMethodGlobalValidDelegate(call.execute()); } @@ -98,11 +98,11 @@ public ServiceCall getMethodGlobalValidAsync(final ServiceCallback service if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getApiVersion() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); return null; } - Call call = service.getMethodGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getMethodGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -118,7 +118,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMethodGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -133,10 +133,10 @@ private ServiceResponse getMethodGlobalValidDelegate(Response getMethodGlobalNotProvidedValid() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getApiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Call call = service.getMethodGlobalNotProvidedValid(this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getMethodGlobalNotProvidedValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return getMethodGlobalNotProvidedValidDelegate(call.execute()); } @@ -151,11 +151,11 @@ public ServiceCall getMethodGlobalNotProvidedValidAsync(final ServiceCallback call = service.getMethodGlobalNotProvidedValid(this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getMethodGlobalNotProvidedValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -171,7 +171,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMethodGlobalNotProvidedValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -186,10 +186,10 @@ private ServiceResponse getMethodGlobalNotProvidedValidDelegate(Response getPathGlobalValid() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getApiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Call call = service.getPathGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getPathGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return getPathGlobalValidDelegate(call.execute()); } @@ -204,11 +204,11 @@ public ServiceCall getPathGlobalValidAsync(final ServiceCallback serviceCa if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getApiVersion() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); return null; } - Call call = service.getPathGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getPathGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -224,7 +224,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getPathGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -239,10 +239,10 @@ private ServiceResponse getPathGlobalValidDelegate(Response * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse getSwaggerGlobalValid() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getApiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Call call = service.getSwaggerGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getSwaggerGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return getSwaggerGlobalValidDelegate(call.execute()); } @@ -257,11 +257,11 @@ public ServiceCall getSwaggerGlobalValidAsync(final ServiceCallback servic if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getApiVersion() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); return null; } - Call call = service.getSwaggerGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getSwaggerGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -277,7 +277,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getSwaggerGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocalOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionLocalsInner.java similarity index 89% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocalOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionLocalsInner.java index fd1bad46b33d2..830dff4967b0e 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocalOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionLocalsInner.java @@ -8,15 +8,16 @@ * regenerated. */ -package fixtures.azurespecials; +package fixtures.azurespecials.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; -import fixtures.azurespecials.models.ErrorException; +import fixtures.azurespecials.ErrorException; import java.io.IOException; import okhttp3.ResponseBody; import retrofit2.Call; @@ -25,49 +26,48 @@ import retrofit2.http.Headers; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in ApiVersionLocalOperations. + * in ApiVersionLocals. */ -public final class ApiVersionLocalOperationsImpl implements ApiVersionLocalOperations { +public final class ApiVersionLocalsInner { /** The Retrofit service to perform REST calls. */ - private ApiVersionLocalService service; + private ApiVersionLocalsService service; /** The service client containing this operation class. */ - private AutoRestAzureSpecialParametersTestClient client; + private AutoRestAzureSpecialParametersTestClientImpl client; /** - * Initializes an instance of ApiVersionLocalOperations. + * Initializes an instance of ApiVersionLocalsInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ApiVersionLocalOperationsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClient client) { - this.service = retrofit.create(ApiVersionLocalService.class); + public ApiVersionLocalsInner(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(ApiVersionLocalsService.class); this.client = client; } /** - * The interface defining all the services for ApiVersionLocalOperations to be + * The interface defining all the services for ApiVersionLocals to be * used by Retrofit to perform actually REST calls. */ - interface ApiVersionLocalService { + interface ApiVersionLocalsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/apiVersion/method/string/none/query/local/2.0") - Call getMethodLocalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call getMethodLocalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/apiVersion/method/string/none/query/local/null") - Call getMethodLocalNull(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call getMethodLocalNull(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/apiVersion/path/string/none/query/local/2.0") - Call getPathLocalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call getPathLocalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/apiVersion/swagger/string/none/query/local/2.0") - Call getSwaggerLocalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call getSwaggerLocalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -80,7 +80,7 @@ interface ApiVersionLocalService { */ public ServiceResponse getMethodLocalValid() throws ErrorException, IOException { final String apiVersion = "2.0"; - Call call = service.getMethodLocalValid(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getMethodLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return getMethodLocalValidDelegate(call.execute()); } @@ -96,7 +96,7 @@ public ServiceCall getMethodLocalValidAsync(final ServiceCallback serviceC throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final String apiVersion = "2.0"; - Call call = service.getMethodLocalValid(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getMethodLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -112,7 +112,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMethodLocalValidDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -127,7 +127,7 @@ private ServiceResponse getMethodLocalValidDelegate(Response */ public ServiceResponse getMethodLocalNull() throws ErrorException, IOException { final String apiVersion = null; - Call call = service.getMethodLocalNull(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getMethodLocalNull(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return getMethodLocalNullDelegate(call.execute()); } @@ -143,7 +143,7 @@ public ServiceCall getMethodLocalNullAsync(final ServiceCallback serviceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final String apiVersion = null; - Call call = service.getMethodLocalNull(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getMethodLocalNull(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -167,7 +167,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse getMethodLocalNull(String apiVersion) throws ErrorException, IOException { - Call call = service.getMethodLocalNull(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getMethodLocalNull(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return getMethodLocalNullDelegate(call.execute()); } @@ -183,7 +183,7 @@ public ServiceCall getMethodLocalNullAsync(String apiVersion, final ServiceCallb if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.getMethodLocalNull(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getMethodLocalNull(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -199,7 +199,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMethodLocalNullDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -214,7 +214,7 @@ private ServiceResponse getMethodLocalNullDelegate(Response */ public ServiceResponse getPathLocalValid() throws ErrorException, IOException { final String apiVersion = "2.0"; - Call call = service.getPathLocalValid(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getPathLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return getPathLocalValidDelegate(call.execute()); } @@ -230,7 +230,7 @@ public ServiceCall getPathLocalValidAsync(final ServiceCallback serviceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final String apiVersion = "2.0"; - Call call = service.getPathLocalValid(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getPathLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -246,7 +246,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getPathLocalValidDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -261,7 +261,7 @@ private ServiceResponse getPathLocalValidDelegate(Response r */ public ServiceResponse getSwaggerLocalValid() throws ErrorException, IOException { final String apiVersion = "2.0"; - Call call = service.getSwaggerLocalValid(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getSwaggerLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return getSwaggerLocalValidDelegate(call.execute()); } @@ -277,7 +277,7 @@ public ServiceCall getSwaggerLocalValidAsync(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final String apiVersion = "2.0"; - Call call = service.getSwaggerLocalValid(apiVersion, this.client.getAcceptLanguage()); + Call call = service.getSwaggerLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -293,7 +293,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getSwaggerLocalValidDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/AutoRestAzureSpecialParametersTestClientImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/AutoRestAzureSpecialParametersTestClientImpl.java new file mode 100644 index 0000000000000..6113ea2e8d870 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/AutoRestAzureSpecialParametersTestClientImpl.java @@ -0,0 +1,300 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Initializes a new instance of the AutoRestAzureSpecialParametersTestClientImpl class. + */ +public final class AutoRestAzureSpecialParametersTestClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. */ + private String subscriptionId; + + /** + * Gets The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AutoRestAzureSpecialParametersTestClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The api version, which appears in the query, the value is always '2015-07-01-preview'. */ + private String apiVersion; + + /** + * Gets The api version, which appears in the query, the value is always '2015-07-01-preview'. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestAzureSpecialParametersTestClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestAzureSpecialParametersTestClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestAzureSpecialParametersTestClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The XMsClientRequestIdsInner object to access its operations. + */ + private XMsClientRequestIdsInner xMsClientRequestIds; + + /** + * Gets the XMsClientRequestIdsInner object to access its operations. + * @return the XMsClientRequestIdsInner object. + */ + public XMsClientRequestIdsInner xMsClientRequestIds() { + return this.xMsClientRequestIds; + } + + /** + * The SubscriptionInCredentialsInner object to access its operations. + */ + private SubscriptionInCredentialsInner subscriptionInCredentials; + + /** + * Gets the SubscriptionInCredentialsInner object to access its operations. + * @return the SubscriptionInCredentialsInner object. + */ + public SubscriptionInCredentialsInner subscriptionInCredentials() { + return this.subscriptionInCredentials; + } + + /** + * The SubscriptionInMethodsInner object to access its operations. + */ + private SubscriptionInMethodsInner subscriptionInMethods; + + /** + * Gets the SubscriptionInMethodsInner object to access its operations. + * @return the SubscriptionInMethodsInner object. + */ + public SubscriptionInMethodsInner subscriptionInMethods() { + return this.subscriptionInMethods; + } + + /** + * The ApiVersionDefaultsInner object to access its operations. + */ + private ApiVersionDefaultsInner apiVersionDefaults; + + /** + * Gets the ApiVersionDefaultsInner object to access its operations. + * @return the ApiVersionDefaultsInner object. + */ + public ApiVersionDefaultsInner apiVersionDefaults() { + return this.apiVersionDefaults; + } + + /** + * The ApiVersionLocalsInner object to access its operations. + */ + private ApiVersionLocalsInner apiVersionLocals; + + /** + * Gets the ApiVersionLocalsInner object to access its operations. + * @return the ApiVersionLocalsInner object. + */ + public ApiVersionLocalsInner apiVersionLocals() { + return this.apiVersionLocals; + } + + /** + * The SkipUrlEncodingsInner object to access its operations. + */ + private SkipUrlEncodingsInner skipUrlEncodings; + + /** + * Gets the SkipUrlEncodingsInner object to access its operations. + * @return the SkipUrlEncodingsInner object. + */ + public SkipUrlEncodingsInner skipUrlEncodings() { + return this.skipUrlEncodings; + } + + /** + * The OdatasInner object to access its operations. + */ + private OdatasInner odatas; + + /** + * Gets the OdatasInner object to access its operations. + * @return the OdatasInner object. + */ + public OdatasInner odatas() { + return this.odatas; + } + + /** + * The HeadersInner object to access its operations. + */ + private HeadersInner headers; + + /** + * Gets the HeadersInner object to access its operations. + * @return the HeadersInner object. + */ + public HeadersInner headers() { + return this.headers; + } + + /** + * Initializes an instance of AutoRestAzureSpecialParametersTestClient client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestAzureSpecialParametersTestClientImpl(ServiceClientCredentials credentials) { + this("http://localhost", credentials); + } + + /** + * Initializes an instance of AutoRestAzureSpecialParametersTestClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AutoRestAzureSpecialParametersTestClientImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestAzureSpecialParametersTestClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestAzureSpecialParametersTestClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-07-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.xMsClientRequestIds = new XMsClientRequestIdsInner(restClient().retrofit(), this); + this.subscriptionInCredentials = new SubscriptionInCredentialsInner(restClient().retrofit(), this); + this.subscriptionInMethods = new SubscriptionInMethodsInner(restClient().retrofit(), this); + this.apiVersionDefaults = new ApiVersionDefaultsInner(restClient().retrofit(), this); + this.apiVersionLocals = new ApiVersionLocalsInner(restClient().retrofit(), this); + this.skipUrlEncodings = new SkipUrlEncodingsInner(restClient().retrofit(), this); + this.odatas = new OdatasInner(restClient().retrofit(), this); + this.headers = new HeadersInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestAzureSpecialParametersTestClient, 2015-07-01-preview"); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeaderCustomNamedRequestIdHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeaderCustomNamedRequestIdHeadersInner.java new file mode 100644 index 0000000000000..80843b294f79e --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeaderCustomNamedRequestIdHeadersInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for customNamedRequestId operation. + */ +public class HeaderCustomNamedRequestIdHeadersInner { + /** + * Gets the foo-request-id. + */ + @JsonProperty(value = "foo-request-id") + private String fooRequestId; + + /** + * Get the fooRequestId value. + * + * @return the fooRequestId value + */ + public String fooRequestId() { + return this.fooRequestId; + } + + /** + * Set the fooRequestId value. + * + * @param fooRequestId the fooRequestId value to set + * @return the HeaderCustomNamedRequestIdHeadersInner object itself. + */ + public HeaderCustomNamedRequestIdHeadersInner withFooRequestId(String fooRequestId) { + this.fooRequestId = fooRequestId; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeaderCustomNamedRequestIdParamGroupingHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeaderCustomNamedRequestIdParamGroupingHeadersInner.java new file mode 100644 index 0000000000000..53b2834d5a445 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeaderCustomNamedRequestIdParamGroupingHeadersInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for customNamedRequestIdParamGrouping operation. + */ +public class HeaderCustomNamedRequestIdParamGroupingHeadersInner { + /** + * Gets the foo-request-id. + */ + @JsonProperty(value = "foo-request-id") + private String fooRequestId; + + /** + * Get the fooRequestId value. + * + * @return the fooRequestId value + */ + public String fooRequestId() { + return this.fooRequestId; + } + + /** + * Set the fooRequestId value. + * + * @param fooRequestId the fooRequestId value to set + * @return the HeaderCustomNamedRequestIdParamGroupingHeadersInner object itself. + */ + public HeaderCustomNamedRequestIdParamGroupingHeadersInner withFooRequestId(String fooRequestId) { + this.fooRequestId = fooRequestId; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeaderCustomNamedRequestIdParamGroupingParametersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeaderCustomNamedRequestIdParamGroupingParametersInner.java new file mode 100644 index 0000000000000..3dadc359eeddd --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeaderCustomNamedRequestIdParamGroupingParametersInner.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for the header_customNamedRequestIdParamGrouping + * operation. + */ +public class HeaderCustomNamedRequestIdParamGroupingParametersInner { + /** + * The fooRequestId. + */ + @JsonProperty(value = "", required = true) + private String fooClientRequestId; + + /** + * Get the fooClientRequestId value. + * + * @return the fooClientRequestId value + */ + public String fooClientRequestId() { + return this.fooClientRequestId; + } + + /** + * Set the fooClientRequestId value. + * + * @param fooClientRequestId the fooClientRequestId value to set + * @return the HeaderCustomNamedRequestIdParamGroupingParametersInner object itself. + */ + public HeaderCustomNamedRequestIdParamGroupingParametersInner withFooClientRequestId(String fooClientRequestId) { + this.fooClientRequestId = fooClientRequestId; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeadersInner.java new file mode 100644 index 0000000000000..80c0199999ef5 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/HeadersInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import fixtures.azurespecials.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in Headers. + */ +public final class HeadersInner { + /** The Retrofit service to perform REST calls. */ + private HeadersService service; + /** The service client containing this operation class. */ + private AutoRestAzureSpecialParametersTestClientImpl client; + + /** + * Initializes an instance of HeadersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public HeadersInner(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(HeadersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Headers to be + * used by Retrofit to perform actually REST calls. + */ + interface HeadersService { + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/customNamedRequestId") + Call customNamedRequestId(@Header("foo-client-request-id") String fooClientRequestId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/customNamedRequestIdParamGrouping") + Call customNamedRequestIdParamGrouping(@Header("accept-language") String acceptLanguage, @Header("foo-client-request-id") String fooClientRequestId, @Header("User-Agent") String userAgent); + + } + + /** + * Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. + * + * @param fooClientRequestId The fooRequestId + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders customNamedRequestId(String fooClientRequestId) throws ErrorException, IOException, IllegalArgumentException { + if (fooClientRequestId == null) { + throw new IllegalArgumentException("Parameter fooClientRequestId is required and cannot be null."); + } + Call call = service.customNamedRequestId(fooClientRequestId, this.client.acceptLanguage(), this.client.userAgent()); + return customNamedRequestIdDelegate(call.execute()); + } + + /** + * Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. + * + * @param fooClientRequestId The fooRequestId + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall customNamedRequestIdAsync(String fooClientRequestId, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (fooClientRequestId == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter fooClientRequestId is required and cannot be null.")); + return null; + } + Call call = service.customNamedRequestId(fooClientRequestId, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(customNamedRequestIdDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders customNamedRequestIdDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .buildWithHeaders(response, HeaderCustomNamedRequestIdHeadersInner.class); + } + + /** + * Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, via a parameter group. + * + * @param headerCustomNamedRequestIdParamGroupingParameters Additional parameters for the operation + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders customNamedRequestIdParamGrouping(HeaderCustomNamedRequestIdParamGroupingParametersInner headerCustomNamedRequestIdParamGroupingParameters) throws ErrorException, IOException, IllegalArgumentException { + if (headerCustomNamedRequestIdParamGroupingParameters == null) { + throw new IllegalArgumentException("Parameter headerCustomNamedRequestIdParamGroupingParameters is required and cannot be null."); + } + Validator.validate(headerCustomNamedRequestIdParamGroupingParameters); + String fooClientRequestId = headerCustomNamedRequestIdParamGroupingParameters.fooClientRequestId(); + Call call = service.customNamedRequestIdParamGrouping(this.client.acceptLanguage(), fooClientRequestId, this.client.userAgent()); + return customNamedRequestIdParamGroupingDelegate(call.execute()); + } + + /** + * Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, via a parameter group. + * + * @param headerCustomNamedRequestIdParamGroupingParameters Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall customNamedRequestIdParamGroupingAsync(HeaderCustomNamedRequestIdParamGroupingParametersInner headerCustomNamedRequestIdParamGroupingParameters, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (headerCustomNamedRequestIdParamGroupingParameters == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter headerCustomNamedRequestIdParamGroupingParameters is required and cannot be null.")); + return null; + } + Validator.validate(headerCustomNamedRequestIdParamGroupingParameters, serviceCallback); + String fooClientRequestId = headerCustomNamedRequestIdParamGroupingParameters.fooClientRequestId(); + Call call = service.customNamedRequestIdParamGrouping(this.client.acceptLanguage(), fooClientRequestId, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(customNamedRequestIdParamGroupingDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders customNamedRequestIdParamGroupingDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .buildWithHeaders(response, HeaderCustomNamedRequestIdParamGroupingHeadersInner.class); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/OdatasInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/OdatasInner.java new file mode 100644 index 0000000000000..a3929c6c9c404 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/OdatasInner.java @@ -0,0 +1,157 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.azurespecials.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in Odatas. + */ +public final class OdatasInner { + /** The Retrofit service to perform REST calls. */ + private OdatasService service; + /** The service client containing this operation class. */ + private AutoRestAzureSpecialParametersTestClientImpl client; + + /** + * Initializes an instance of OdatasInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OdatasInner(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(OdatasService.class); + this.client = client; + } + + /** + * The interface defining all the services for Odatas to be + * used by Retrofit to perform actually REST calls. + */ + interface OdatasService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/odata/filter") + Call getWithFilter(@Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderby") String orderby, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getWithFilter() throws ErrorException, IOException { + final String filter = null; + final Integer top = null; + final String orderby = null; + Call call = service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent()); + return getWithFilterDelegate(call.execute()); + } + + /** + * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getWithFilterAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String filter = null; + final Integer top = null; + final String orderby = null; + Call call = service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getWithFilterDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. + * + * @param filter The filter parameter with value '$filter=id gt 5 and name eq 'foo''. + * @param top The top parameter with value 10. + * @param orderby The orderby parameter with value id. + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getWithFilter(String filter, Integer top, String orderby) throws ErrorException, IOException { + Call call = service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent()); + return getWithFilterDelegate(call.execute()); + } + + /** + * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. + * + * @param filter The filter parameter with value '$filter=id gt 5 and name eq 'foo''. + * @param top The top parameter with value 10. + * @param orderby The orderby parameter with value id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getWithFilterAsync(String filter, Integer top, String orderby, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getWithFilterDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getWithFilterDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SkipUrlEncodingOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SkipUrlEncodingsInner.java similarity index 90% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SkipUrlEncodingOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SkipUrlEncodingsInner.java index 20d997c5006be..cd1068307779e 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SkipUrlEncodingOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SkipUrlEncodingsInner.java @@ -8,15 +8,16 @@ * regenerated. */ -package fixtures.azurespecials; +package fixtures.azurespecials.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; -import fixtures.azurespecials.models.ErrorException; +import fixtures.azurespecials.ErrorException; import java.io.IOException; import okhttp3.ResponseBody; import retrofit2.Call; @@ -26,61 +27,60 @@ import retrofit2.http.Path; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in SkipUrlEncodingOperations. + * in SkipUrlEncodings. */ -public final class SkipUrlEncodingOperationsImpl implements SkipUrlEncodingOperations { +public final class SkipUrlEncodingsInner { /** The Retrofit service to perform REST calls. */ - private SkipUrlEncodingService service; + private SkipUrlEncodingsService service; /** The service client containing this operation class. */ - private AutoRestAzureSpecialParametersTestClient client; + private AutoRestAzureSpecialParametersTestClientImpl client; /** - * Initializes an instance of SkipUrlEncodingOperations. + * Initializes an instance of SkipUrlEncodingsInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public SkipUrlEncodingOperationsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClient client) { - this.service = retrofit.create(SkipUrlEncodingService.class); + public SkipUrlEncodingsInner(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(SkipUrlEncodingsService.class); this.client = client; } /** - * The interface defining all the services for SkipUrlEncodingOperations to be + * The interface defining all the services for SkipUrlEncodings to be * used by Retrofit to perform actually REST calls. */ - interface SkipUrlEncodingService { + interface SkipUrlEncodingsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}") - Call getMethodPathValid(@Path("unencodedPathParam") String unencodedPathParam, @Header("accept-language") String acceptLanguage); + Call getMethodPathValid(@Path("unencodedPathParam") String unencodedPathParam, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}") - Call getPathPathValid(@Path("unencodedPathParam") String unencodedPathParam, @Header("accept-language") String acceptLanguage); + Call getPathPathValid(@Path("unencodedPathParam") String unencodedPathParam, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}") - Call getSwaggerPathValid(@Path("unencodedPathParam") String unencodedPathParam, @Header("accept-language") String acceptLanguage); + Call getSwaggerPathValid(@Path("unencodedPathParam") String unencodedPathParam, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/skipUrlEncoding/method/query/valid") - Call getMethodQueryValid(@Query("q1") String q1, @Header("accept-language") String acceptLanguage); + Call getMethodQueryValid(@Query("q1") String q1, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/skipUrlEncoding/method/query/null") - Call getMethodQueryNull(@Query("q1") String q1, @Header("accept-language") String acceptLanguage); + Call getMethodQueryNull(@Query("q1") String q1, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/skipUrlEncoding/path/query/valid") - Call getPathQueryValid(@Query("q1") String q1, @Header("accept-language") String acceptLanguage); + Call getPathQueryValid(@Query("q1") String q1, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/skipUrlEncoding/swagger/query/valid") - Call getSwaggerQueryValid(@Query("q1") String q1, @Header("accept-language") String acceptLanguage); + Call getSwaggerQueryValid(@Query("q1") String q1, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -97,7 +97,7 @@ public ServiceResponse getMethodPathValid(String unencodedPathParam) throw if (unencodedPathParam == null) { throw new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null."); } - Call call = service.getMethodPathValid(unencodedPathParam, this.client.getAcceptLanguage()); + Call call = service.getMethodPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); return getMethodPathValidDelegate(call.execute()); } @@ -117,7 +117,7 @@ public ServiceCall getMethodPathValidAsync(String unencodedPathParam, final Serv serviceCallback.failure(new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null.")); return null; } - Call call = service.getMethodPathValid(unencodedPathParam, this.client.getAcceptLanguage()); + Call call = service.getMethodPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -133,7 +133,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMethodPathValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -152,7 +152,7 @@ public ServiceResponse getPathPathValid(String unencodedPathParam) throws if (unencodedPathParam == null) { throw new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null."); } - Call call = service.getPathPathValid(unencodedPathParam, this.client.getAcceptLanguage()); + Call call = service.getPathPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); return getPathPathValidDelegate(call.execute()); } @@ -172,7 +172,7 @@ public ServiceCall getPathPathValidAsync(String unencodedPathParam, final Servic serviceCallback.failure(new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null.")); return null; } - Call call = service.getPathPathValid(unencodedPathParam, this.client.getAcceptLanguage()); + Call call = service.getPathPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -188,7 +188,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getPathPathValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -203,7 +203,7 @@ private ServiceResponse getPathPathValidDelegate(Response re */ public ServiceResponse getSwaggerPathValid() throws ErrorException, IOException { final String unencodedPathParam = "path1/path2/path3"; - Call call = service.getSwaggerPathValid(unencodedPathParam, this.client.getAcceptLanguage()); + Call call = service.getSwaggerPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); return getSwaggerPathValidDelegate(call.execute()); } @@ -219,7 +219,7 @@ public ServiceCall getSwaggerPathValidAsync(final ServiceCallback serviceC throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final String unencodedPathParam = "path1/path2/path3"; - Call call = service.getSwaggerPathValid(unencodedPathParam, this.client.getAcceptLanguage()); + Call call = service.getSwaggerPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -235,7 +235,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getSwaggerPathValidDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -254,7 +254,7 @@ public ServiceResponse getMethodQueryValid(String q1) throws ErrorExceptio if (q1 == null) { throw new IllegalArgumentException("Parameter q1 is required and cannot be null."); } - Call call = service.getMethodQueryValid(q1, this.client.getAcceptLanguage()); + Call call = service.getMethodQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); return getMethodQueryValidDelegate(call.execute()); } @@ -274,7 +274,7 @@ public ServiceCall getMethodQueryValidAsync(String q1, final ServiceCallback call = service.getMethodQueryValid(q1, this.client.getAcceptLanguage()); + Call call = service.getMethodQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -290,7 +290,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMethodQueryValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -305,7 +305,7 @@ private ServiceResponse getMethodQueryValidDelegate(Response */ public ServiceResponse getMethodQueryNull() throws ErrorException, IOException { final String q1 = null; - Call call = service.getMethodQueryNull(q1, this.client.getAcceptLanguage()); + Call call = service.getMethodQueryNull(q1, this.client.acceptLanguage(), this.client.userAgent()); return getMethodQueryNullDelegate(call.execute()); } @@ -321,7 +321,7 @@ public ServiceCall getMethodQueryNullAsync(final ServiceCallback serviceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final String q1 = null; - Call call = service.getMethodQueryNull(q1, this.client.getAcceptLanguage()); + Call call = service.getMethodQueryNull(q1, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -345,7 +345,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse getMethodQueryNull(String q1) throws ErrorException, IOException { - Call call = service.getMethodQueryNull(q1, this.client.getAcceptLanguage()); + Call call = service.getMethodQueryNull(q1, this.client.acceptLanguage(), this.client.userAgent()); return getMethodQueryNullDelegate(call.execute()); } @@ -361,7 +361,7 @@ public ServiceCall getMethodQueryNullAsync(String q1, final ServiceCallback call = service.getMethodQueryNull(q1, this.client.getAcceptLanguage()); + Call call = service.getMethodQueryNull(q1, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -377,7 +377,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMethodQueryNullDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -396,7 +396,7 @@ public ServiceResponse getPathQueryValid(String q1) throws ErrorException, if (q1 == null) { throw new IllegalArgumentException("Parameter q1 is required and cannot be null."); } - Call call = service.getPathQueryValid(q1, this.client.getAcceptLanguage()); + Call call = service.getPathQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); return getPathQueryValidDelegate(call.execute()); } @@ -416,7 +416,7 @@ public ServiceCall getPathQueryValidAsync(String q1, final ServiceCallback serviceCallback.failure(new IllegalArgumentException("Parameter q1 is required and cannot be null.")); return null; } - Call call = service.getPathQueryValid(q1, this.client.getAcceptLanguage()); + Call call = service.getPathQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -432,7 +432,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getPathQueryValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -447,7 +447,7 @@ private ServiceResponse getPathQueryValidDelegate(Response r */ public ServiceResponse getSwaggerQueryValid() throws ErrorException, IOException { final String q1 = "value1&q2=value2&q3=value3"; - Call call = service.getSwaggerQueryValid(q1, this.client.getAcceptLanguage()); + Call call = service.getSwaggerQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); return getSwaggerQueryValidDelegate(call.execute()); } @@ -463,7 +463,7 @@ public ServiceCall getSwaggerQueryValidAsync(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final String q1 = "value1&q2=value2&q3=value3"; - Call call = service.getSwaggerQueryValid(q1, this.client.getAcceptLanguage()); + Call call = service.getSwaggerQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -479,7 +479,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getSwaggerQueryValidDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentialsOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInCredentialsInner.java similarity index 83% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentialsOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInCredentialsInner.java index 64d7c03ac3117..5c4587b40bf8a 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentialsOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInCredentialsInner.java @@ -8,15 +8,16 @@ * regenerated. */ -package fixtures.azurespecials; +package fixtures.azurespecials.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; -import fixtures.azurespecials.models.ErrorException; +import fixtures.azurespecials.ErrorException; import java.io.IOException; import okhttp3.ResponseBody; import retrofit2.Call; @@ -26,53 +27,52 @@ import retrofit2.http.POST; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in SubscriptionInCredentialsOperations. + * in SubscriptionInCredentials. */ -public final class SubscriptionInCredentialsOperationsImpl implements SubscriptionInCredentialsOperations { +public final class SubscriptionInCredentialsInner { /** The Retrofit service to perform REST calls. */ private SubscriptionInCredentialsService service; /** The service client containing this operation class. */ - private AutoRestAzureSpecialParametersTestClient client; + private AutoRestAzureSpecialParametersTestClientImpl client; /** - * Initializes an instance of SubscriptionInCredentialsOperations. + * Initializes an instance of SubscriptionInCredentialsInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public SubscriptionInCredentialsOperationsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClient client) { + public SubscriptionInCredentialsInner(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { this.service = retrofit.create(SubscriptionInCredentialsService.class); this.client = client; } /** - * The interface defining all the services for SubscriptionInCredentialsOperations to be + * The interface defining all the services for SubscriptionInCredentials to be * used by Retrofit to perform actually REST calls. */ interface SubscriptionInCredentialsService { @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}") - Call postMethodGlobalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage); + Call postMethodGlobalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}") - Call postMethodGlobalNull(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage); + Call postMethodGlobalNull(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}") - Call postMethodGlobalNotProvidedValid(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call postMethodGlobalNotProvidedValid(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}") - Call postPathGlobalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage); + Call postPathGlobalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}") - Call postSwaggerGlobalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage); + Call postSwaggerGlobalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -85,10 +85,10 @@ interface SubscriptionInCredentialsService { * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse postMethodGlobalValid() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - Call call = service.postMethodGlobalValid(this.client.getSubscriptionId(), this.client.getAcceptLanguage()); + Call call = service.postMethodGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); return postMethodGlobalValidDelegate(call.execute()); } @@ -103,11 +103,11 @@ public ServiceCall postMethodGlobalValidAsync(final ServiceCallback servic if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); return null; } - Call call = service.postMethodGlobalValid(this.client.getSubscriptionId(), this.client.getAcceptLanguage()); + Call call = service.postMethodGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -123,7 +123,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postMethodGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -138,10 +138,10 @@ private ServiceResponse postMethodGlobalValidDelegate(Response postMethodGlobalNull() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - Call call = service.postMethodGlobalNull(this.client.getSubscriptionId(), this.client.getAcceptLanguage()); + Call call = service.postMethodGlobalNull(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); return postMethodGlobalNullDelegate(call.execute()); } @@ -156,11 +156,11 @@ public ServiceCall postMethodGlobalNullAsync(final ServiceCallback service if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); return null; } - Call call = service.postMethodGlobalNull(this.client.getSubscriptionId(), this.client.getAcceptLanguage()); + Call call = service.postMethodGlobalNull(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -176,7 +176,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postMethodGlobalNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -191,13 +191,13 @@ private ServiceResponse postMethodGlobalNullDelegate(Response postMethodGlobalNotProvidedValid() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.getApiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Call call = service.postMethodGlobalNotProvidedValid(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.postMethodGlobalNotProvidedValid(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return postMethodGlobalNotProvidedValidDelegate(call.execute()); } @@ -212,15 +212,15 @@ public ServiceCall postMethodGlobalNotProvidedValidAsync(final ServiceCallback call = service.postMethodGlobalNotProvidedValid(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.postMethodGlobalNotProvidedValid(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -236,7 +236,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postMethodGlobalNotProvidedValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -251,10 +251,10 @@ private ServiceResponse postMethodGlobalNotProvidedValidDelegate(Response< * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse postPathGlobalValid() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - Call call = service.postPathGlobalValid(this.client.getSubscriptionId(), this.client.getAcceptLanguage()); + Call call = service.postPathGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); return postPathGlobalValidDelegate(call.execute()); } @@ -269,11 +269,11 @@ public ServiceCall postPathGlobalValidAsync(final ServiceCallback serviceC if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); return null; } - Call call = service.postPathGlobalValid(this.client.getSubscriptionId(), this.client.getAcceptLanguage()); + Call call = service.postPathGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -289,7 +289,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postPathGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -304,10 +304,10 @@ private ServiceResponse postPathGlobalValidDelegate(Response * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse postSwaggerGlobalValid() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - Call call = service.postSwaggerGlobalValid(this.client.getSubscriptionId(), this.client.getAcceptLanguage()); + Call call = service.postSwaggerGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); return postSwaggerGlobalValidDelegate(call.execute()); } @@ -322,11 +322,11 @@ public ServiceCall postSwaggerGlobalValidAsync(final ServiceCallback servi if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); return null; } - Call call = service.postSwaggerGlobalValid(this.client.getSubscriptionId(), this.client.getAcceptLanguage()); + Call call = service.postSwaggerGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -342,7 +342,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postSwaggerGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInMethodOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInMethodsInner.java similarity index 90% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInMethodOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInMethodsInner.java index a50c142e8d364..da7437733d9a1 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInMethodOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInMethodsInner.java @@ -8,15 +8,16 @@ * regenerated. */ -package fixtures.azurespecials; +package fixtures.azurespecials.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; -import fixtures.azurespecials.models.ErrorException; +import fixtures.azurespecials.ErrorException; import java.io.IOException; import okhttp3.ResponseBody; import retrofit2.Call; @@ -25,49 +26,48 @@ import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in SubscriptionInMethodOperations. + * in SubscriptionInMethods. */ -public final class SubscriptionInMethodOperationsImpl implements SubscriptionInMethodOperations { +public final class SubscriptionInMethodsInner { /** The Retrofit service to perform REST calls. */ - private SubscriptionInMethodService service; + private SubscriptionInMethodsService service; /** The service client containing this operation class. */ - private AutoRestAzureSpecialParametersTestClient client; + private AutoRestAzureSpecialParametersTestClientImpl client; /** - * Initializes an instance of SubscriptionInMethodOperations. + * Initializes an instance of SubscriptionInMethodsInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public SubscriptionInMethodOperationsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClient client) { - this.service = retrofit.create(SubscriptionInMethodService.class); + public SubscriptionInMethodsInner(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(SubscriptionInMethodsService.class); this.client = client; } /** - * The interface defining all the services for SubscriptionInMethodOperations to be + * The interface defining all the services for SubscriptionInMethods to be * used by Retrofit to perform actually REST calls. */ - interface SubscriptionInMethodService { + interface SubscriptionInMethodsService { @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}") - Call postMethodLocalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage); + Call postMethodLocalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}") - Call postMethodLocalNull(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage); + Call postMethodLocalNull(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}") - Call postPathLocalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage); + Call postPathLocalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}") - Call postSwaggerLocalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage); + Call postSwaggerLocalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -84,7 +84,7 @@ public ServiceResponse postMethodLocalValid(String subscriptionId) throws if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } - Call call = service.postMethodLocalValid(subscriptionId, this.client.getAcceptLanguage()); + Call call = service.postMethodLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); return postMethodLocalValidDelegate(call.execute()); } @@ -104,7 +104,7 @@ public ServiceCall postMethodLocalValidAsync(String subscriptionId, final Servic serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); return null; } - Call call = service.postMethodLocalValid(subscriptionId, this.client.getAcceptLanguage()); + Call call = service.postMethodLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -120,7 +120,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postMethodLocalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -139,7 +139,7 @@ public ServiceResponse postMethodLocalNull(String subscriptionId) throws E if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } - Call call = service.postMethodLocalNull(subscriptionId, this.client.getAcceptLanguage()); + Call call = service.postMethodLocalNull(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); return postMethodLocalNullDelegate(call.execute()); } @@ -159,7 +159,7 @@ public ServiceCall postMethodLocalNullAsync(String subscriptionId, final Service serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); return null; } - Call call = service.postMethodLocalNull(subscriptionId, this.client.getAcceptLanguage()); + Call call = service.postMethodLocalNull(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -175,7 +175,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postMethodLocalNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -194,7 +194,7 @@ public ServiceResponse postPathLocalValid(String subscriptionId) throws Er if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } - Call call = service.postPathLocalValid(subscriptionId, this.client.getAcceptLanguage()); + Call call = service.postPathLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); return postPathLocalValidDelegate(call.execute()); } @@ -214,7 +214,7 @@ public ServiceCall postPathLocalValidAsync(String subscriptionId, final ServiceC serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); return null; } - Call call = service.postPathLocalValid(subscriptionId, this.client.getAcceptLanguage()); + Call call = service.postPathLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -230,7 +230,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postPathLocalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -249,7 +249,7 @@ public ServiceResponse postSwaggerLocalValid(String subscriptionId) throws if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } - Call call = service.postSwaggerLocalValid(subscriptionId, this.client.getAcceptLanguage()); + Call call = service.postSwaggerLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); return postSwaggerLocalValidDelegate(call.execute()); } @@ -269,7 +269,7 @@ public ServiceCall postSwaggerLocalValidAsync(String subscriptionId, final Servi serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); return null; } - Call call = service.postSwaggerLocalValid(subscriptionId, this.client.getAcceptLanguage()); + Call call = service.postSwaggerLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -285,7 +285,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postSwaggerLocalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/XMsClientRequestIdOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/XMsClientRequestIdsInner.java similarity index 85% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/XMsClientRequestIdOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/XMsClientRequestIdsInner.java index 36452df889407..24968753fa74a 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/XMsClientRequestIdOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/XMsClientRequestIdsInner.java @@ -8,8 +8,9 @@ * regenerated. */ -package fixtures.azurespecials; +package fixtures.azurespecials.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; @@ -17,7 +18,7 @@ import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; -import fixtures.azurespecials.models.ErrorException; +import fixtures.azurespecials.ErrorException; import java.io.IOException; import okhttp3.ResponseBody; import retrofit2.Call; @@ -25,41 +26,40 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in XMsClientRequestIdOperations. + * in XMsClientRequestIds. */ -public final class XMsClientRequestIdOperationsImpl implements XMsClientRequestIdOperations { +public final class XMsClientRequestIdsInner { /** The Retrofit service to perform REST calls. */ - private XMsClientRequestIdService service; + private XMsClientRequestIdsService service; /** The service client containing this operation class. */ - private AutoRestAzureSpecialParametersTestClient client; + private AutoRestAzureSpecialParametersTestClientImpl client; /** - * Initializes an instance of XMsClientRequestIdOperations. + * Initializes an instance of XMsClientRequestIdsInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public XMsClientRequestIdOperationsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClient client) { - this.service = retrofit.create(XMsClientRequestIdService.class); + public XMsClientRequestIdsInner(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(XMsClientRequestIdsService.class); this.client = client; } /** - * The interface defining all the services for XMsClientRequestIdOperations to be + * The interface defining all the services for XMsClientRequestIds to be * used by Retrofit to perform actually REST calls. */ - interface XMsClientRequestIdService { + interface XMsClientRequestIdsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/overwrite/x-ms-client-request-id/method/") - Call get(@Header("accept-language") String acceptLanguage); + Call get(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/overwrite/x-ms-client-request-id/via-param/method/") - Call paramGet(@Header("x-ms-client-request-id") String xMsClientRequestId, @Header("accept-language") String acceptLanguage); + Call paramGet(@Header("x-ms-client-request-id") String xMsClientRequestId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -71,7 +71,7 @@ interface XMsClientRequestIdService { * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse get() throws CloudException, IOException { - Call call = service.get(this.client.getAcceptLanguage()); + Call call = service.get(this.client.acceptLanguage(), this.client.userAgent()); return getDelegate(call.execute()); } @@ -86,7 +86,7 @@ public ServiceCall getAsync(final ServiceCallback serviceCallback) throws if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.get(this.client.getAcceptLanguage()); + Call call = service.get(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -102,7 +102,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } @@ -120,7 +120,7 @@ public ServiceResponse paramGet(String xMsClientRequestId) throws ErrorExc if (xMsClientRequestId == null) { throw new IllegalArgumentException("Parameter xMsClientRequestId is required and cannot be null."); } - Call call = service.paramGet(xMsClientRequestId, this.client.getAcceptLanguage()); + Call call = service.paramGet(xMsClientRequestId, this.client.acceptLanguage(), this.client.userAgent()); return paramGetDelegate(call.execute()); } @@ -140,7 +140,7 @@ public ServiceCall paramGetAsync(String xMsClientRequestId, final ServiceCallbac serviceCallback.failure(new IllegalArgumentException("Parameter xMsClientRequestId is required and cannot be null.")); return null; } - Call call = service.paramGet(xMsClientRequestId, this.client.getAcceptLanguage()); + Call call = service.paramGet(xMsClientRequestId, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -156,7 +156,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramGetDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/package-info.java new file mode 100644 index 0000000000000..141f0e35d66db --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestAzureSpecialParametersTestClient. + * Test Infrastructure for AutoRest. + */ +package fixtures.azurespecials.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/package-info.java new file mode 100644 index 0000000000000..414b194aaeded --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/azurespecials/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for AutoRestAzureSpecialParametersTestClient. + * Test Infrastructure for AutoRest. + */ +package fixtures.azurespecials; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/Error.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/Error.java new file mode 100644 index 0000000000000..3e3afc6c67bff --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/Error.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.custombaseuri; + + +/** + * The Error model. + */ +public class Error { + /** + * The status property. + */ + private Integer status; + + /** + * The message property. + */ + private String message; + + /** + * Get the status value. + * + * @return the status value + */ + public Integer status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the Error object itself. + */ + public Error withStatus(Integer status) { + this.status = status; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/ErrorException.java new file mode 100644 index 0000000000000..31890d27ca39c --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/ErrorException.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.custombaseuri; + +import com.microsoft.rest.RestException; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with Error information. + */ +public class ErrorException extends RestException { + /** + * Information about the associated HTTP response. + */ + private Response response; + /** + * The actual response body. + */ + private Error body; + /** + * Initializes a new instance of the ErrorException class. + */ + public ErrorException() { } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message The exception message. + */ + public ErrorException(final String message) { + super(message); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message + * @param cause exception that caused this exception to occur + */ + public ErrorException(final String message, final Throwable cause) { + super(message, cause); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param cause exception that caused this exception to occur + */ + public ErrorException(final Throwable cause) { + super(cause); + } + /** + * Gets information about the associated HTTP response. + * + * @return the HTTP response + */ + public Response getResponse() { + return response; + } + /** + * Gets the HTTP response body. + * + * @return the response body + */ + public Error getBody() { + return body; + } + /** + * Sets the HTTP response. + * + * @param response the HTTP response + */ + public void setResponse(Response response) { + this.response = response; + } + /** + * Sets the HTTP response body. + * + * @param body the response body + */ + public void setBody(Error body) { + this.body = body; + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/implementation/AutoRestParameterizedHostTestClientImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/implementation/AutoRestParameterizedHostTestClientImpl.java new file mode 100644 index 0000000000000..82e97e1bbfb07 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/implementation/AutoRestParameterizedHostTestClientImpl.java @@ -0,0 +1,190 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.custombaseuri.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Initializes a new instance of the AutoRestParameterizedHostTestClientImpl class. + */ +public final class AutoRestParameterizedHostTestClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** A string value that is used as a global part of the parameterized host. */ + private String host; + + /** + * Gets A string value that is used as a global part of the parameterized host. + * + * @return the host value. + */ + public String host() { + return this.host; + } + + /** + * Sets A string value that is used as a global part of the parameterized host. + * + * @param host the host value. + * @return the service client itself + */ + public AutoRestParameterizedHostTestClientImpl withHost(String host) { + this.host = host; + return this; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestParameterizedHostTestClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestParameterizedHostTestClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestParameterizedHostTestClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The PathsInner object to access its operations. + */ + private PathsInner paths; + + /** + * Gets the PathsInner object to access its operations. + * @return the PathsInner object. + */ + public PathsInner paths() { + return this.paths; + } + + /** + * Initializes an instance of AutoRestParameterizedHostTestClient client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestParameterizedHostTestClientImpl(ServiceClientCredentials credentials) { + this("http://{accountName}{host}", credentials); + } + + /** + * Initializes an instance of AutoRestParameterizedHostTestClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + private AutoRestParameterizedHostTestClientImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestParameterizedHostTestClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestParameterizedHostTestClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.host = "host"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.paths = new PathsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestParameterizedHostTestClient, 1.0.0"); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsInner.java new file mode 100644 index 0000000000000..98edab1562f44 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsInner.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.custombaseuri.implementation; + +import retrofit2.Retrofit; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.custombaseuri.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in Paths. + */ +public final class PathsInner { + /** The Retrofit service to perform REST calls. */ + private PathsService service; + /** The service client containing this operation class. */ + private AutoRestParameterizedHostTestClientImpl client; + + /** + * Initializes an instance of PathsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PathsInner(Retrofit retrofit, AutoRestParameterizedHostTestClientImpl client) { + this.service = retrofit.create(PathsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Paths to be + * used by Retrofit to perform actually REST calls. + */ + interface PathsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("customuri") + Call getEmpty(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Get a 200 to test a valid base uri. + * + * @param accountName Account Name + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getEmpty(String accountName) throws ErrorException, IOException, IllegalArgumentException { + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.host() == null) { + throw new IllegalArgumentException("Parameter this.client.host() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{accountName}", accountName, "{host}", this.client.host()); + Call call = service.getEmpty(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()); + return getEmptyDelegate(call.execute()); + } + + /** + * Get a 200 to test a valid base uri. + * + * @param accountName Account Name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getEmptyAsync(String accountName, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (accountName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + return null; + } + if (this.client.host() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.host() is required and cannot be null.")); + return null; + } + String parameterizedHost = Joiner.on(", ").join("{accountName}", accountName, "{host}", this.client.host()); + Call call = service.getEmpty(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getEmptyDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/implementation/package-info.java new file mode 100644 index 0000000000000..9449c1aeeb63c --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestParameterizedHostTestClient. + * Test Infrastructure for AutoRest. + */ +package fixtures.custombaseuri.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/package-info.java new file mode 100644 index 0000000000000..b604c7cd9fc04 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/custombaseuri/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for AutoRestParameterizedHostTestClient. + * Test Infrastructure for AutoRest. + */ +package fixtures.custombaseuri; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/implementation/AutoRestHeadTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/implementation/AutoRestHeadTestServiceImpl.java new file mode 100644 index 0000000000000..746e561b12df3 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/implementation/AutoRestHeadTestServiceImpl.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.head.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Initializes a new instance of the AutoRestHeadTestServiceImpl class. + */ +public final class AutoRestHeadTestServiceImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestHeadTestServiceImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestHeadTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestHeadTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The HttpSuccessInner object to access its operations. + */ + private HttpSuccessInner httpSuccess; + + /** + * Gets the HttpSuccessInner object to access its operations. + * @return the HttpSuccessInner object. + */ + public HttpSuccessInner httpSuccess() { + return this.httpSuccess; + } + + /** + * Initializes an instance of AutoRestHeadTestService client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestHeadTestServiceImpl(ServiceClientCredentials credentials) { + this("http://localhost", credentials); + } + + /** + * Initializes an instance of AutoRestHeadTestService client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AutoRestHeadTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestHeadTestService client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestHeadTestServiceImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.httpSuccess = new HttpSuccessInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestHeadTestService, 1.0.0"); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/HttpSuccessOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/implementation/HttpSuccessInner.java similarity index 86% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/HttpSuccessOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/implementation/HttpSuccessInner.java index b3f31dbd8a2c2..47b2ebfe68ac5 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/HttpSuccessOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/implementation/HttpSuccessInner.java @@ -8,8 +8,9 @@ * regenerated. */ -package fixtures.head; +package fixtures.head.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; @@ -23,45 +24,44 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HttpSuccessOperations. + * in HttpSuccess. */ -public final class HttpSuccessOperationsImpl implements HttpSuccessOperations { +public final class HttpSuccessInner { /** The Retrofit service to perform REST calls. */ private HttpSuccessService service; /** The service client containing this operation class. */ - private AutoRestHeadTestService client; + private AutoRestHeadTestServiceImpl client; /** - * Initializes an instance of HttpSuccessOperations. + * Initializes an instance of HttpSuccessInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HttpSuccessOperationsImpl(Retrofit retrofit, AutoRestHeadTestService client) { + public HttpSuccessInner(Retrofit retrofit, AutoRestHeadTestServiceImpl client) { this.service = retrofit.create(HttpSuccessService.class); this.client = client; } /** - * The interface defining all the services for HttpSuccessOperations to be + * The interface defining all the services for HttpSuccess to be * used by Retrofit to perform actually REST calls. */ interface HttpSuccessService { @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/success/200") - Call head200(@Header("accept-language") String acceptLanguage); + Call head200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/success/204") - Call head204(@Header("accept-language") String acceptLanguage); + Call head204(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/success/404") - Call head404(@Header("accept-language") String acceptLanguage); + Call head404(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -73,7 +73,7 @@ interface HttpSuccessService { * @return the boolean object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse head200() throws CloudException, IOException { - Call call = service.head200(this.client.getAcceptLanguage()); + Call call = service.head200(this.client.acceptLanguage(), this.client.userAgent()); return head200Delegate(call.execute()); } @@ -88,7 +88,7 @@ public ServiceCall head200Async(final ServiceCallback serviceCallback) if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.head200(this.client.getAcceptLanguage()); + Call call = service.head200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { @Override @@ -104,7 +104,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(404, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -119,7 +119,7 @@ private ServiceResponse head200Delegate(Response response) throws * @return the boolean object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse head204() throws CloudException, IOException { - Call call = service.head204(this.client.getAcceptLanguage()); + Call call = service.head204(this.client.acceptLanguage(), this.client.userAgent()); return head204Delegate(call.execute()); } @@ -134,7 +134,7 @@ public ServiceCall head204Async(final ServiceCallback serviceCallback) if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.head204(this.client.getAcceptLanguage()); + Call call = service.head204(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { @Override @@ -150,7 +150,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head204Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .register(404, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -165,7 +165,7 @@ private ServiceResponse head204Delegate(Response response) throws * @return the boolean object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse head404() throws CloudException, IOException { - Call call = service.head404(this.client.getAcceptLanguage()); + Call call = service.head404(this.client.acceptLanguage(), this.client.userAgent()); return head404Delegate(call.execute()); } @@ -180,7 +180,7 @@ public ServiceCall head404Async(final ServiceCallback serviceCallback) if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.head404(this.client.getAcceptLanguage()); + Call call = service.head404(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { @Override @@ -196,7 +196,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head404Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .register(404, new TypeToken() { }.getType()) .registerError(CloudException.class) diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/implementation/package-info.java new file mode 100644 index 0000000000000..d058ca5a28ab1 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestHeadTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.head.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/package-info.java new file mode 100644 index 0000000000000..0569c9396133b --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/head/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for AutoRestHeadTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.head; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/implementation/AutoRestHeadExceptionTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/implementation/AutoRestHeadExceptionTestServiceImpl.java new file mode 100644 index 0000000000000..2d2fca127d356 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/implementation/AutoRestHeadExceptionTestServiceImpl.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.headexceptions.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Initializes a new instance of the AutoRestHeadExceptionTestServiceImpl class. + */ +public final class AutoRestHeadExceptionTestServiceImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestHeadExceptionTestServiceImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestHeadExceptionTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestHeadExceptionTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The HeadExceptionsInner object to access its operations. + */ + private HeadExceptionsInner headExceptions; + + /** + * Gets the HeadExceptionsInner object to access its operations. + * @return the HeadExceptionsInner object. + */ + public HeadExceptionsInner headExceptions() { + return this.headExceptions; + } + + /** + * Initializes an instance of AutoRestHeadExceptionTestService client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestHeadExceptionTestServiceImpl(ServiceClientCredentials credentials) { + this("http://localhost", credentials); + } + + /** + * Initializes an instance of AutoRestHeadExceptionTestService client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AutoRestHeadExceptionTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestHeadExceptionTestService client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestHeadExceptionTestServiceImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.headExceptions = new HeadExceptionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestHeadExceptionTestService, 1.0.0"); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/HeadExceptionOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/implementation/HeadExceptionsInner.java similarity index 84% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/HeadExceptionOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/implementation/HeadExceptionsInner.java index a895c32545c3c..702ebe8913165 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/HeadExceptionOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/implementation/HeadExceptionsInner.java @@ -8,8 +8,9 @@ * regenerated. */ -package fixtures.headexceptions; +package fixtures.headexceptions.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; @@ -23,45 +24,44 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HeadExceptionOperations. + * in HeadExceptions. */ -public final class HeadExceptionOperationsImpl implements HeadExceptionOperations { +public final class HeadExceptionsInner { /** The Retrofit service to perform REST calls. */ - private HeadExceptionService service; + private HeadExceptionsService service; /** The service client containing this operation class. */ - private AutoRestHeadExceptionTestService client; + private AutoRestHeadExceptionTestServiceImpl client; /** - * Initializes an instance of HeadExceptionOperations. + * Initializes an instance of HeadExceptionsInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HeadExceptionOperationsImpl(Retrofit retrofit, AutoRestHeadExceptionTestService client) { - this.service = retrofit.create(HeadExceptionService.class); + public HeadExceptionsInner(Retrofit retrofit, AutoRestHeadExceptionTestServiceImpl client) { + this.service = retrofit.create(HeadExceptionsService.class); this.client = client; } /** - * The interface defining all the services for HeadExceptionOperations to be + * The interface defining all the services for HeadExceptions to be * used by Retrofit to perform actually REST calls. */ - interface HeadExceptionService { + interface HeadExceptionsService { @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/success/200") - Call head200(@Header("accept-language") String acceptLanguage); + Call head200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/success/204") - Call head204(@Header("accept-language") String acceptLanguage); + Call head204(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/success/404") - Call head404(@Header("accept-language") String acceptLanguage); + Call head404(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -73,7 +73,7 @@ interface HeadExceptionService { * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse head200() throws CloudException, IOException { - Call call = service.head200(this.client.getAcceptLanguage()); + Call call = service.head200(this.client.acceptLanguage(), this.client.userAgent()); return head200Delegate(call.execute()); } @@ -88,7 +88,7 @@ public ServiceCall head200Async(final ServiceCallback serviceCallback) thr if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.head200(this.client.getAcceptLanguage()); + Call call = service.head200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { @Override @@ -104,7 +104,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .buildEmpty(response); } @@ -117,7 +117,7 @@ private ServiceResponse head200Delegate(Response response) throws Cl * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse head204() throws CloudException, IOException { - Call call = service.head204(this.client.getAcceptLanguage()); + Call call = service.head204(this.client.acceptLanguage(), this.client.userAgent()); return head204Delegate(call.execute()); } @@ -132,7 +132,7 @@ public ServiceCall head204Async(final ServiceCallback serviceCallback) thr if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.head204(this.client.getAcceptLanguage()); + Call call = service.head204(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { @Override @@ -148,7 +148,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head204Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .buildEmpty(response); } @@ -161,7 +161,7 @@ private ServiceResponse head204Delegate(Response response) throws Cl * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse head404() throws CloudException, IOException { - Call call = service.head404(this.client.getAcceptLanguage()); + Call call = service.head404(this.client.acceptLanguage(), this.client.userAgent()); return head404Delegate(call.execute()); } @@ -176,7 +176,7 @@ public ServiceCall head404Async(final ServiceCallback serviceCallback) thr if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.head404(this.client.getAcceptLanguage()); + Call call = service.head404(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { @Override @@ -192,7 +192,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head404Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .buildEmpty(response); } diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/implementation/package-info.java new file mode 100644 index 0000000000000..db31cf72cfbe7 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestHeadExceptionTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.headexceptions.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/package-info.java new file mode 100644 index 0000000000000..3847d55918888 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/headexceptions/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for AutoRestHeadExceptionTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.headexceptions; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/OperationResult.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/OperationResult.java new file mode 100644 index 0000000000000..a5af703aa4376 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/OperationResult.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro; + + +/** + * The OperationResult model. + */ +public class OperationResult { + /** + * The status of the request. Possible values include: 'Succeeded', + * 'Failed', 'canceled', 'Accepted', 'Creating', 'Created', 'Updating', + * 'Updated', 'Deleting', 'Deleted', 'OK'. + */ + private String status; + + /** + * The error property. + */ + private OperationResultError error; + + /** + * Get the status value. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the OperationResult object itself. + */ + public OperationResult withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error value. + * + * @return the error value + */ + public OperationResultError error() { + return this.error; + } + + /** + * Set the error value. + * + * @param error the error value to set + * @return the OperationResult object itself. + */ + public OperationResult withError(OperationResultError error) { + this.error = error; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/OperationResultError.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/OperationResultError.java new file mode 100644 index 0000000000000..9247843d7c739 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/OperationResultError.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro; + + +/** + * The OperationResultError model. + */ +public class OperationResultError { + /** + * The error code for an operation failure. + */ + private Integer code; + + /** + * The detailed arror message. + */ + private String message; + + /** + * Get the code value. + * + * @return the code value + */ + public Integer code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the OperationResultError object itself. + */ + public OperationResultError withCode(Integer code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the OperationResultError object itself. + */ + public OperationResultError withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/AutoRestLongRunningOperationTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/AutoRestLongRunningOperationTestServiceImpl.java new file mode 100644 index 0000000000000..e9f56e57dbf22 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/AutoRestLongRunningOperationTestServiceImpl.java @@ -0,0 +1,208 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Initializes a new instance of the AutoRestLongRunningOperationTestServiceImpl class. + */ +public final class AutoRestLongRunningOperationTestServiceImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestLongRunningOperationTestServiceImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestLongRunningOperationTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestLongRunningOperationTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The LROsInner object to access its operations. + */ + private LROsInner lROs; + + /** + * Gets the LROsInner object to access its operations. + * @return the LROsInner object. + */ + public LROsInner lROs() { + return this.lROs; + } + + /** + * The LRORetrysInner object to access its operations. + */ + private LRORetrysInner lRORetrys; + + /** + * Gets the LRORetrysInner object to access its operations. + * @return the LRORetrysInner object. + */ + public LRORetrysInner lRORetrys() { + return this.lRORetrys; + } + + /** + * The LROSADsInner object to access its operations. + */ + private LROSADsInner lROSADs; + + /** + * Gets the LROSADsInner object to access its operations. + * @return the LROSADsInner object. + */ + public LROSADsInner lROSADs() { + return this.lROSADs; + } + + /** + * The LROsCustomHeadersInner object to access its operations. + */ + private LROsCustomHeadersInner lROsCustomHeaders; + + /** + * Gets the LROsCustomHeadersInner object to access its operations. + * @return the LROsCustomHeadersInner object. + */ + public LROsCustomHeadersInner lROsCustomHeaders() { + return this.lROsCustomHeaders; + } + + /** + * Initializes an instance of AutoRestLongRunningOperationTestService client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestLongRunningOperationTestServiceImpl(ServiceClientCredentials credentials) { + this("http://localhost", credentials); + } + + /** + * Initializes an instance of AutoRestLongRunningOperationTestService client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AutoRestLongRunningOperationTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestLongRunningOperationTestService client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestLongRunningOperationTestServiceImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.lROs = new LROsInner(restClient().retrofit(), this); + this.lRORetrys = new LRORetrysInner(restClient().retrofit(), this); + this.lROSADs = new LROSADsInner(restClient().retrofit(), this); + this.lROsCustomHeaders = new LROsCustomHeadersInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestLongRunningOperationTestService, 1.0.0"); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysDelete202Retry200HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysDelete202Retry200HeadersInner.java new file mode 100644 index 0000000000000..b8b79afbd9c76 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysDelete202Retry200HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for delete202Retry200 operation. + */ +public class LRORetrysDelete202Retry200HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/delete/202/retry/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LRORetrysDelete202Retry200HeadersInner object itself. + */ + public LRORetrysDelete202Retry200HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LRORetrysDelete202Retry200HeadersInner object itself. + */ + public LRORetrysDelete202Retry200HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..9c99ec40364bc --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncRelativeRetrySucceeded operation. + */ +public class LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/deleteasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/retryerror/deleteasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner object itself. + */ + public LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner object itself. + */ + public LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner object itself. + */ + public LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner.java new file mode 100644 index 0000000000000..2037d4d565ab2 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteProvisioning202Accepted200Succeeded operation. + */ +public class LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/delete/provisioning/202/accepted/200/succeeded. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner object itself. + */ + public LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner object itself. + */ + public LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysInner.java new file mode 100644 index 0000000000000..b0e8d5fe6316c --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysInner.java @@ -0,0 +1,1061 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in LRORetrys. + */ +public final class LRORetrysInner { + /** The Retrofit service to perform REST calls. */ + private LRORetrysService service; + /** The service client containing this operation class. */ + private AutoRestLongRunningOperationTestServiceImpl client; + + /** + * Initializes an instance of LRORetrysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LRORetrysInner(Retrofit retrofit, AutoRestLongRunningOperationTestServiceImpl client) { + this.service = retrofit.create(LRORetrysService.class); + this.client = client; + } + + /** + * The interface defining all the services for LRORetrys to be + * used by Retrofit to perform actually REST calls. + */ + interface LRORetrysService { + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/retryerror/put/201/creating/succeeded/200") + Call put201CreatingSucceeded200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/retryerror/put/201/creating/succeeded/200") + Call beginPut201CreatingSucceeded200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/retryerror/putasync/retry/succeeded") + Call putAsyncRelativeRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/retryerror/putasync/retry/succeeded") + Call beginPutAsyncRelativeRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/retryerror/delete/provisioning/202/accepted/200/succeeded", method = "DELETE", hasBody = true) + Call deleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/retryerror/delete/provisioning/202/accepted/200/succeeded", method = "DELETE", hasBody = true) + Call beginDeleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/retryerror/delete/202/retry/200", method = "DELETE", hasBody = true) + Call delete202Retry200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/retryerror/delete/202/retry/200", method = "DELETE", hasBody = true) + Call beginDelete202Retry200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/retryerror/deleteasync/retry/succeeded", method = "DELETE", hasBody = true) + Call deleteAsyncRelativeRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/retryerror/deleteasync/retry/succeeded", method = "DELETE", hasBody = true) + Call beginDeleteAsyncRelativeRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/retryerror/post/202/retry/200") + Call post202Retry200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/retryerror/post/202/retry/200") + Call beginPost202Retry200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/retryerror/postasync/retry/succeeded") + Call postAsyncRelativeRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/retryerror/postasync/retry/succeeded") + Call beginPostAsyncRelativeRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put201CreatingSucceeded200() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put201CreatingSucceeded200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put201CreatingSucceeded200(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put201CreatingSucceeded200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut201CreatingSucceeded200() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut201CreatingSucceeded200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut201CreatingSucceeded200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut201CreatingSucceeded200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut201CreatingSucceeded200(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut201CreatingSucceeded200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut201CreatingSucceeded200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut201CreatingSucceeded200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut201CreatingSucceeded200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetrySucceeded() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPutAsyncRelativeRetrySucceededHeadersInner.class); + } + + /** + * Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LRORetrysPutAsyncRelativeRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetrySucceeded(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPutAsyncRelativeRetrySucceededHeadersInner.class); + } + + /** + * Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LRORetrysPutAsyncRelativeRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetrySucceeded() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetrySucceededDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetrySucceeded(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetrySucceededDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncRelativeRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LRORetrysPutAsyncRelativeRetrySucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders deleteProvisioning202Accepted200Succeeded() throws CloudException, IOException, InterruptedException { + Response result = service.deleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteProvisioning202Accepted200SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginDeleteProvisioning202Accepted200Succeeded() throws CloudException, IOException { + Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteProvisioning202Accepted200SucceededDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteProvisioning202Accepted200SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteProvisioning202Accepted200SucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteProvisioning202Accepted200SucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LRORetrysDeleteProvisioning202Accepted200SucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders delete202Retry200() throws CloudException, IOException, InterruptedException { + Response result = service.delete202Retry200(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysDelete202Retry200HeadersInner.class); + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall delete202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.delete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LRORetrysDelete202Retry200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDelete202Retry200() throws CloudException, IOException { + Call call = service.beginDelete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); + return beginDelete202Retry200Delegate(call.execute()); + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDelete202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDelete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDelete202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDelete202Retry200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LRORetrysDelete202Retry200HeadersInner.class); + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncRelativeRetrySucceeded() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncRelativeRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncRelativeRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncRelativeRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetrySucceeded() throws CloudException, IOException { + Call call = service.beginDeleteAsyncRelativeRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncRelativeRetrySucceededDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncRelativeRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncRelativeRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncRelativeRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LRORetrysDeleteAsyncRelativeRetrySucceededHeadersInner.class); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202Retry200() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPost202Retry200HeadersInner.class); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LRORetrysPost202Retry200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202Retry200(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPost202Retry200HeadersInner.class); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202Retry200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LRORetrysPost202Retry200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202Retry200() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202Retry200Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202Retry200(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202Retry200Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202Retry200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPost202Retry200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LRORetrysPost202Retry200HeadersInner.class); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetrySucceeded() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPostAsyncRelativeRetrySucceededHeadersInner.class); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LRORetrysPostAsyncRelativeRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetrySucceeded(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPostAsyncRelativeRetrySucceededHeadersInner.class); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LRORetrysPostAsyncRelativeRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetrySucceeded() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetrySucceededDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetrySucceeded(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetrySucceededDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncRelativeRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LRORetrysPostAsyncRelativeRetrySucceededHeadersInner.class); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysPost202Retry200HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysPost202Retry200HeadersInner.java new file mode 100644 index 0000000000000..f015d92b78366 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysPost202Retry200HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for post202Retry200 operation. + */ +public class LRORetrysPost202Retry200HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/post/202/retry/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LRORetrysPost202Retry200HeadersInner object itself. + */ + public LRORetrysPost202Retry200HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LRORetrysPost202Retry200HeadersInner object itself. + */ + public LRORetrysPost202Retry200HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysPostAsyncRelativeRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysPostAsyncRelativeRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..5f64f62bf34e9 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysPostAsyncRelativeRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncRelativeRetrySucceeded operation. + */ +public class LRORetrysPostAsyncRelativeRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/retryerror/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LRORetrysPostAsyncRelativeRetrySucceededHeadersInner object itself. + */ + public LRORetrysPostAsyncRelativeRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LRORetrysPostAsyncRelativeRetrySucceededHeadersInner object itself. + */ + public LRORetrysPostAsyncRelativeRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LRORetrysPostAsyncRelativeRetrySucceededHeadersInner object itself. + */ + public LRORetrysPostAsyncRelativeRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysPutAsyncRelativeRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysPutAsyncRelativeRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..837277dfcbc66 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LRORetrysPutAsyncRelativeRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncRelativeRetrySucceeded operation. + */ +public class LRORetrysPutAsyncRelativeRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/retryerror/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LRORetrysPutAsyncRelativeRetrySucceededHeadersInner object itself. + */ + public LRORetrysPutAsyncRelativeRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LRORetrysPutAsyncRelativeRetrySucceededHeadersInner object itself. + */ + public LRORetrysPutAsyncRelativeRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LRORetrysPutAsyncRelativeRetrySucceededHeadersInner object itself. + */ + public LRORetrysPutAsyncRelativeRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDelete202NonRetry400HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDelete202NonRetry400HeadersInner.java new file mode 100644 index 0000000000000..50467c45e1518 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDelete202NonRetry400HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for delete202NonRetry400 operation. + */ +public class LROSADsDelete202NonRetry400HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/delete/202/retry/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsDelete202NonRetry400HeadersInner object itself. + */ + public LROSADsDelete202NonRetry400HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsDelete202NonRetry400HeadersInner object itself. + */ + public LROSADsDelete202NonRetry400HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDelete202RetryInvalidHeaderHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDelete202RetryInvalidHeaderHeadersInner.java new file mode 100644 index 0000000000000..0d5f447771671 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDelete202RetryInvalidHeaderHeadersInner.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for delete202RetryInvalidHeader operation. + */ +public class LROSADsDelete202RetryInvalidHeaderHeadersInner { + /** + * Location to poll for result status: will be set to /foo. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to /bar. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsDelete202RetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsDelete202RetryInvalidHeaderHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsDelete202RetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsDelete202RetryInvalidHeaderHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetry400HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetry400HeadersInner.java new file mode 100644 index 0000000000000..55fdf8bdc0264 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetry400HeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncRelativeRetry400 operation. + */ +public class LROSADsDeleteAsyncRelativeRetry400HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/nonretryerror/deleteasync/retry/operationResults/400. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/nonretryerror/deleteasync/retry/operationResults/400. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsDeleteAsyncRelativeRetry400HeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetry400HeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsDeleteAsyncRelativeRetry400HeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetry400HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteAsyncRelativeRetry400HeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetry400HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner.java new file mode 100644 index 0000000000000..802d88b21cd3e --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncRelativeRetryInvalidHeader operation. + */ +public class LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner { + /** + * Location to poll for result status: will be set to /foo. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to /foo. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to /bar. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner.java new file mode 100644 index 0000000000000..d4e91e84d9aa2 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncRelativeRetryInvalidJsonPolling operation. + */ +public class LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/error/deleteasync/retry/failed/operationResults/invalidjsonpolling. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/error/deleteasync/retry/failed/operationResults/invalidjsonpolling. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner.java new file mode 100644 index 0000000000000..a898edd02d0a6 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncRelativeRetryNoStatus operation. + */ +public class LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner object itself. + */ + public LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteNonRetry400HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteNonRetry400HeadersInner.java new file mode 100644 index 0000000000000..033b14d54064f --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsDeleteNonRetry400HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteNonRetry400 operation. + */ +public class LROSADsDeleteNonRetry400HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/delete/202/retry/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsDeleteNonRetry400HeadersInner object itself. + */ + public LROSADsDeleteNonRetry400HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteNonRetry400HeadersInner object itself. + */ + public LROSADsDeleteNonRetry400HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsInner.java new file mode 100644 index 0000000000000..eaf4921de36c7 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsInner.java @@ -0,0 +1,4044 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in LROSADs. + */ +public final class LROSADsInner { + /** The Retrofit service to perform REST calls. */ + private LROSADsService service; + /** The service client containing this operation class. */ + private AutoRestLongRunningOperationTestServiceImpl client; + + /** + * Initializes an instance of LROSADsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LROSADsInner(Retrofit retrofit, AutoRestLongRunningOperationTestServiceImpl client) { + this.service = retrofit.create(LROSADsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LROSADs to be + * used by Retrofit to perform actually REST calls. + */ + interface LROSADsService { + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/nonretryerror/put/400") + Call putNonRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/nonretryerror/put/400") + Call beginPutNonRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/nonretryerror/put/201/creating/400") + Call putNonRetry201Creating400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/nonretryerror/put/201/creating/400") + Call beginPutNonRetry201Creating400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/nonretryerror/put/201/creating/400/invalidjson") + Call putNonRetry201Creating400InvalidJson(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/nonretryerror/put/201/creating/400/invalidjson") + Call beginPutNonRetry201Creating400InvalidJson(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/nonretryerror/putasync/retry/400") + Call putAsyncRelativeRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/nonretryerror/putasync/retry/400") + Call beginPutAsyncRelativeRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/nonretryerror/delete/400", method = "DELETE", hasBody = true) + Call deleteNonRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/nonretryerror/delete/400", method = "DELETE", hasBody = true) + Call beginDeleteNonRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/nonretryerror/delete/202/retry/400", method = "DELETE", hasBody = true) + Call delete202NonRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/nonretryerror/delete/202/retry/400", method = "DELETE", hasBody = true) + Call beginDelete202NonRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/nonretryerror/deleteasync/retry/400", method = "DELETE", hasBody = true) + Call deleteAsyncRelativeRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/nonretryerror/deleteasync/retry/400", method = "DELETE", hasBody = true) + Call beginDeleteAsyncRelativeRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/nonretryerror/post/400") + Call postNonRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/nonretryerror/post/400") + Call beginPostNonRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/nonretryerror/post/202/retry/400") + Call post202NonRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/nonretryerror/post/202/retry/400") + Call beginPost202NonRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/nonretryerror/postasync/retry/400") + Call postAsyncRelativeRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/nonretryerror/postasync/retry/400") + Call beginPostAsyncRelativeRetry400(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/put/201/noprovisioningstatepayload") + Call putError201NoProvisioningStatePayload(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/put/201/noprovisioningstatepayload") + Call beginPutError201NoProvisioningStatePayload(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/putasync/retry/nostatus") + Call putAsyncRelativeRetryNoStatus(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/putasync/retry/nostatus") + Call beginPutAsyncRelativeRetryNoStatus(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/putasync/retry/nostatuspayload") + Call putAsyncRelativeRetryNoStatusPayload(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/putasync/retry/nostatuspayload") + Call beginPutAsyncRelativeRetryNoStatusPayload(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/delete/204/nolocation", method = "DELETE", hasBody = true) + Call delete204Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/delete/204/nolocation", method = "DELETE", hasBody = true) + Call beginDelete204Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/deleteasync/retry/nostatus", method = "DELETE", hasBody = true) + Call deleteAsyncRelativeRetryNoStatus(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/deleteasync/retry/nostatus", method = "DELETE", hasBody = true) + Call beginDeleteAsyncRelativeRetryNoStatus(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/post/202/nolocation") + Call post202NoLocation(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/post/202/nolocation") + Call beginPost202NoLocation(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/postasync/retry/nopayload") + Call postAsyncRelativeRetryNoPayload(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/postasync/retry/nopayload") + Call beginPostAsyncRelativeRetryNoPayload(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/put/200/invalidjson") + Call put200InvalidJson(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/put/200/invalidjson") + Call beginPut200InvalidJson(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/putasync/retry/invalidheader") + Call putAsyncRelativeRetryInvalidHeader(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/putasync/retry/invalidheader") + Call beginPutAsyncRelativeRetryInvalidHeader(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/putasync/retry/invalidjsonpolling") + Call putAsyncRelativeRetryInvalidJsonPolling(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/error/putasync/retry/invalidjsonpolling") + Call beginPutAsyncRelativeRetryInvalidJsonPolling(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/delete/202/retry/invalidheader", method = "DELETE", hasBody = true) + Call delete202RetryInvalidHeader(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/delete/202/retry/invalidheader", method = "DELETE", hasBody = true) + Call beginDelete202RetryInvalidHeader(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/deleteasync/retry/invalidheader", method = "DELETE", hasBody = true) + Call deleteAsyncRelativeRetryInvalidHeader(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/deleteasync/retry/invalidheader", method = "DELETE", hasBody = true) + Call beginDeleteAsyncRelativeRetryInvalidHeader(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/deleteasync/retry/invalidjsonpolling", method = "DELETE", hasBody = true) + Call deleteAsyncRelativeRetryInvalidJsonPolling(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/error/deleteasync/retry/invalidjsonpolling", method = "DELETE", hasBody = true) + Call beginDeleteAsyncRelativeRetryInvalidJsonPolling(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/post/202/retry/invalidheader") + Call post202RetryInvalidHeader(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/post/202/retry/invalidheader") + Call beginPost202RetryInvalidHeader(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/postasync/retry/invalidheader") + Call postAsyncRelativeRetryInvalidHeader(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/postasync/retry/invalidheader") + Call beginPostAsyncRelativeRetryInvalidHeader(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/postasync/retry/invalidjsonpolling") + Call postAsyncRelativeRetryInvalidJsonPolling(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/error/postasync/retry/invalidjsonpolling") + Call beginPostAsyncRelativeRetryInvalidJsonPolling(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Long running put request, service returns a 400 to the initial request. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putNonRetry400() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 400 to the initial request. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 400 to the initial request. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putNonRetry400(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 400 to the initial request. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNonRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 400 to the initial request. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutNonRetry400() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNonRetry400Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 400 to the initial request. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNonRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 400 to the initial request. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutNonRetry400(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNonRetry400Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 400 to the initial request. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNonRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNonRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPutNonRetry400Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putNonRetry201Creating400() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNonRetry201Creating400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putNonRetry201Creating400(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNonRetry201Creating400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutNonRetry201Creating400() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNonRetry201Creating400Delegate(call.execute()); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNonRetry201Creating400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNonRetry201Creating400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutNonRetry201Creating400(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNonRetry201Creating400Delegate(call.execute()); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNonRetry201Creating400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNonRetry201Creating400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPutNonRetry201Creating400Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putNonRetry201Creating400InvalidJson() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNonRetry201Creating400InvalidJsonAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putNonRetry201Creating400InvalidJson(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNonRetry201Creating400InvalidJsonAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutNonRetry201Creating400InvalidJson() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNonRetry201Creating400InvalidJsonDelegate(call.execute()); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNonRetry201Creating400InvalidJsonAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNonRetry201Creating400InvalidJsonDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutNonRetry201Creating400InvalidJson(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNonRetry201Creating400InvalidJsonDelegate(call.execute()); + } + + /** + * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNonRetry201Creating400InvalidJsonAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNonRetry201Creating400InvalidJsonDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPutNonRetry201Creating400InvalidJsonDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetry400() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetry400HeadersInner.class); + } + + /** + * Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetry400(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetry400HeadersInner.class); + } + + /** + * Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetry400() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetry400Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetry400(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetry400Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncRelativeRetry400Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPutAsyncRelativeRetry400HeadersInner.class); + } + + /** + * Long running delete request, service returns a 400 with an error body. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteNonRetry400() throws CloudException, IOException, InterruptedException { + Response result = service.deleteNonRetry400(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteNonRetry400HeadersInner.class); + } + + /** + * Long running delete request, service returns a 400 with an error body. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteNonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteNonRetry400(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsDeleteNonRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 400 with an error body. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteNonRetry400() throws CloudException, IOException { + Call call = service.beginDeleteNonRetry400(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteNonRetry400Delegate(call.execute()); + } + + /** + * Long running delete request, service returns a 400 with an error body. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteNonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteNonRetry400(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteNonRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteNonRetry400Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsDeleteNonRetry400HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 with a location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders delete202NonRetry400() throws CloudException, IOException, InterruptedException { + Response result = service.delete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDelete202NonRetry400HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 with a location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall delete202NonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.delete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsDelete202NonRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 with a location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDelete202NonRetry400() throws CloudException, IOException { + Call call = service.beginDelete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()); + return beginDelete202NonRetry400Delegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 with a location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDelete202NonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDelete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDelete202NonRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDelete202NonRetry400Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsDelete202NonRetry400HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncRelativeRetry400() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncRelativeRetry400(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetry400HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncRelativeRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncRelativeRetry400(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetry400() throws CloudException, IOException { + Call call = service.beginDeleteAsyncRelativeRetry400(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncRelativeRetry400Delegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncRelativeRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncRelativeRetry400(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncRelativeRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetry400Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsDeleteAsyncRelativeRetry400HeadersInner.class); + } + + /** + * Long running post request, service returns a 400 with no error body. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postNonRetry400() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostNonRetry400HeadersInner.class); + } + + /** + * Long running post request, service returns a 400 with no error body. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postNonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostNonRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 400 with no error body. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postNonRetry400(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostNonRetry400HeadersInner.class); + } + + /** + * Long running post request, service returns a 400 with no error body. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postNonRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostNonRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 400 with no error body. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostNonRetry400() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostNonRetry400Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 400 with no error body. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostNonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostNonRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 400 with no error body. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostNonRetry400(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostNonRetry400Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 400 with no error body. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostNonRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostNonRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostNonRetry400Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPostNonRetry400HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 with a location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202NonRetry400() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.post202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202NonRetry400HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 with a location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202NonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.post202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPost202NonRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 with a location header. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202NonRetry400(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.post202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202NonRetry400HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 with a location header. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202NonRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.post202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPost202NonRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 with a location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202NonRetry400() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPost202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202NonRetry400Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 with a location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202NonRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPost202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202NonRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 with a location header. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202NonRetry400(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPost202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202NonRetry400Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 with a location header. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202NonRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPost202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202NonRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPost202NonRetry400Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPost202NonRetry400HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetry400() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetry400HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetry400(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetry400HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetry400HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetry400() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetry400Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetry400Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetry400(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetry400Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetry400Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetry400Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncRelativeRetry400Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPostAsyncRelativeRetry400HeadersInner.class); + } + + /** + * Long running put request, service returns a 201 to the initial request with no payload. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putError201NoProvisioningStatePayload() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request with no payload. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putError201NoProvisioningStatePayloadAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 201 to the initial request with no payload. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putError201NoProvisioningStatePayload(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request with no payload. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putError201NoProvisioningStatePayloadAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request with no payload. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutError201NoProvisioningStatePayload() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutError201NoProvisioningStatePayloadDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request with no payload. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutError201NoProvisioningStatePayloadAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutError201NoProvisioningStatePayloadDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request with no payload. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutError201NoProvisioningStatePayload(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutError201NoProvisioningStatePayloadDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request with no payload. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutError201NoProvisioningStatePayloadAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutError201NoProvisioningStatePayloadDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPutError201NoProvisioningStatePayloadDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetryNoStatus() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetryNoStatusAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetryNoStatus(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetryNoStatusAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatus() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetryNoStatusDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetryNoStatusAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetryNoStatusDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatus(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetryNoStatusDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetryNoStatusAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetryNoStatusDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatusDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPutAsyncRelativeRetryNoStatusHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetryNoStatusPayload() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetryNoStatusPayloadAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetryNoStatusPayload(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetryNoStatusPayloadAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatusPayload() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetryNoStatusPayloadDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetryNoStatusPayloadAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetryNoStatusPayloadDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatusPayload(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetryNoStatusPayloadDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetryNoStatusPayloadAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetryNoStatusPayloadDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatusPayloadDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner.class); + } + + /** + * Long running delete request, service returns a 204 to the initial request, indicating success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponse object if successful. + */ + public ServiceResponse delete204Succeeded() throws CloudException, IOException, InterruptedException { + Response result = service.delete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running delete request, service returns a 204 to the initial request, indicating success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall delete204SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.delete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 204 to the initial request, indicating success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse beginDelete204Succeeded() throws CloudException, IOException { + Call call = service.beginDelete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + return beginDelete204SucceededDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 204 to the initial request, indicating success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDelete204SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDelete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDelete204SucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginDelete204SucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncRelativeRetryNoStatus() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncRelativeRetryNoStatus(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncRelativeRetryNoStatusAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncRelativeRetryNoStatus(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryNoStatus() throws CloudException, IOException { + Call call = service.beginDeleteAsyncRelativeRetryNoStatus(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncRelativeRetryNoStatusDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncRelativeRetryNoStatusAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncRelativeRetryNoStatus(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncRelativeRetryNoStatusDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryNoStatusDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsDeleteAsyncRelativeRetryNoStatusHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, without a location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202NoLocation() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.post202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202NoLocationHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, without a location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202NoLocationAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.post202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPost202NoLocationHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, without a location header. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202NoLocation(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.post202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202NoLocationHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, without a location header. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202NoLocationAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.post202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPost202NoLocationHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, without a location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202NoLocation() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPost202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202NoLocationDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, without a location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202NoLocationAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPost202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202NoLocationDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, without a location header. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202NoLocation(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPost202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202NoLocationDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, without a location header. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202NoLocationAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPost202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202NoLocationDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPost202NoLocationDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPost202NoLocationHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetryNoPayload() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetryNoPayloadAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetryNoPayload(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetryNoPayloadAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetryNoPayload() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetryNoPayloadDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetryNoPayloadAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetryNoPayloadDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetryNoPayload(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetryNoPayloadDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetryNoPayloadAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetryNoPayloadDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncRelativeRetryNoPayloadDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200InvalidJson() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200InvalidJsonAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200InvalidJson(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200InvalidJsonAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200InvalidJson() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200InvalidJsonDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200InvalidJsonAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200InvalidJsonDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200InvalidJson(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200InvalidJsonDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200InvalidJsonAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200InvalidJsonDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut200InvalidJsonDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetryInvalidHeader() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetryInvalidHeader(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetryInvalidHeaderAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidHeader() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetryInvalidHeaderDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidHeader(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetryInvalidHeaderAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetryInvalidHeaderDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetryInvalidJsonPollingAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRelativeRetryInvalidJsonPolling(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRelativeRetryInvalidJsonPollingAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetryInvalidJsonPollingAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetryInvalidJsonPollingDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidJsonPolling(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRelativeRetryInvalidJsonPollingAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRelativeRetryInvalidJsonPollingDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidJsonPollingDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders delete202RetryInvalidHeader() throws CloudException, IOException, InterruptedException { + Response result = service.delete202RetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDelete202RetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall delete202RetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.delete202RetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsDelete202RetryInvalidHeaderHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDelete202RetryInvalidHeader() throws CloudException, IOException { + Call call = service.beginDelete202RetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); + return beginDelete202RetryInvalidHeaderDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDelete202RetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDelete202RetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDelete202RetryInvalidHeaderDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDelete202RetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsDelete202RetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncRelativeRetryInvalidHeader() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncRelativeRetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncRelativeRetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncRelativeRetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryInvalidHeader() throws CloudException, IOException { + Call call = service.beginDeleteAsyncRelativeRetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncRelativeRetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncRelativeRetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncRelativeRetryInvalidHeaderDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncRelativeRetryInvalidJsonPolling(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncRelativeRetryInvalidJsonPollingAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncRelativeRetryInvalidJsonPolling(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException { + Call call = service.beginDeleteAsyncRelativeRetryInvalidJsonPolling(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncRelativeRetryInvalidJsonPollingAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncRelativeRetryInvalidJsonPolling(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncRelativeRetryInvalidJsonPollingDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryInvalidJsonPollingDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202RetryInvalidHeader() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202RetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202RetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPost202RetryInvalidHeaderHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202RetryInvalidHeader(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202RetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202RetryInvalidHeaderAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPost202RetryInvalidHeaderHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202RetryInvalidHeader() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPost202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202RetryInvalidHeaderDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202RetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPost202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202RetryInvalidHeaderDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202RetryInvalidHeader(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPost202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202RetryInvalidHeaderDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202RetryInvalidHeaderAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPost202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202RetryInvalidHeaderDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPost202RetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPost202RetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetryInvalidHeader() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetryInvalidHeader(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetryInvalidHeaderAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidHeader() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetryInvalidHeaderAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetryInvalidHeaderDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidHeader(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetryInvalidHeaderAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetryInvalidHeaderDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetryInvalidJsonPollingAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRelativeRetryInvalidJsonPolling(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRelativeRetryInvalidJsonPollingAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetryInvalidJsonPollingAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetryInvalidJsonPollingDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidJsonPolling(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRelativeRetryInvalidJsonPollingAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRelativeRetryInvalidJsonPollingDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidJsonPollingDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner.class); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPost202NoLocationHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPost202NoLocationHeadersInner.java new file mode 100644 index 0000000000000..63ea4f8c66b29 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPost202NoLocationHeadersInner.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for post202NoLocation operation. + */ +public class LROSADsPost202NoLocationHeadersInner { + /** + * Location to poll for result status: will not be set. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPost202NoLocationHeadersInner object itself. + */ + public LROSADsPost202NoLocationHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPost202NoLocationHeadersInner object itself. + */ + public LROSADsPost202NoLocationHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPost202NonRetry400HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPost202NonRetry400HeadersInner.java new file mode 100644 index 0000000000000..00b5a99055a43 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPost202NonRetry400HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for post202NonRetry400 operation. + */ +public class LROSADsPost202NonRetry400HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/post/202/retry/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPost202NonRetry400HeadersInner object itself. + */ + public LROSADsPost202NonRetry400HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPost202NonRetry400HeadersInner object itself. + */ + public LROSADsPost202NonRetry400HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPost202RetryInvalidHeaderHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPost202RetryInvalidHeaderHeadersInner.java new file mode 100644 index 0000000000000..a2d4cc3820456 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPost202RetryInvalidHeaderHeadersInner.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for post202RetryInvalidHeader operation. + */ +public class LROSADsPost202RetryInvalidHeaderHeadersInner { + /** + * Location to poll for result status: will be set to /foo. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to /bar. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPost202RetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsPost202RetryInvalidHeaderHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPost202RetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsPost202RetryInvalidHeaderHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetry400HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetry400HeadersInner.java new file mode 100644 index 0000000000000..739f403deb296 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetry400HeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncRelativeRetry400 operation. + */ +public class LROSADsPostAsyncRelativeRetry400HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/nonretryerror/putasync/retry/operationResults/400. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/nonretryerror/putasync/retry/operationResults/400. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPostAsyncRelativeRetry400HeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetry400HeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPostAsyncRelativeRetry400HeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetry400HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPostAsyncRelativeRetry400HeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetry400HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner.java new file mode 100644 index 0000000000000..2a143fba6f492 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncRelativeRetryInvalidHeader operation. + */ +public class LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner { + /** + * Location to poll for result status: will be set to foo. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to foo. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to /bar. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetryInvalidHeaderHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner.java new file mode 100644 index 0000000000000..f954815639dde --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncRelativeRetryInvalidJsonPolling operation. + */ +public class LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/error/postasync/retry/failed/operationResults/invalidjsonpolling. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/error/postasync/retry/failed/operationResults/invalidjsonpolling. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner.java new file mode 100644 index 0000000000000..19d45868edcaa --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncRelativeRetryNoPayload operation. + */ +public class LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/error/putasync/retry/failed/operationResults/nopayload. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/error/putasync/retry/failed/operationResults/nopayload. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner object itself. + */ + public LROSADsPostAsyncRelativeRetryNoPayloadHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostNonRetry400HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostNonRetry400HeadersInner.java new file mode 100644 index 0000000000000..26bed7c0919f2 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPostNonRetry400HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postNonRetry400 operation. + */ +public class LROSADsPostNonRetry400HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/retryerror/post/202/retry/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPostNonRetry400HeadersInner object itself. + */ + public LROSADsPostNonRetry400HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPostNonRetry400HeadersInner object itself. + */ + public LROSADsPostNonRetry400HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetry400HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetry400HeadersInner.java new file mode 100644 index 0000000000000..32d73dc37e864 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetry400HeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncRelativeRetry400 operation. + */ +public class LROSADsPutAsyncRelativeRetry400HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/nonretryerror/putasync/retry/operationResults/400. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/nonretryerror/putasync/retry/operationResults/400. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetry400HeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetry400HeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetry400HeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetry400HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetry400HeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetry400HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner.java new file mode 100644 index 0000000000000..38ffc0a1f3fc5 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncRelativeRetryInvalidHeader operation. + */ +public class LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryInvalidHeaderHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner.java new file mode 100644 index 0000000000000..080d046cbcfcc --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncRelativeRetryInvalidJsonPolling operation. + */ +public class LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/failed/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/failed/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryNoStatusHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryNoStatusHeadersInner.java new file mode 100644 index 0000000000000..f4676d5f0c609 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryNoStatusHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncRelativeRetryNoStatus operation. + */ +public class LROSADsPutAsyncRelativeRetryNoStatusHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryNoStatusHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryNoStatusHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryNoStatusHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner.java new file mode 100644 index 0000000000000..73ad82259e4cd --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncRelativeRetryNoStatusPayload operation. + */ +public class LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner object itself. + */ + public LROSADsPutAsyncRelativeRetryNoStatusPayloadHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeaderPost202Retry200HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeaderPost202Retry200HeadersInner.java new file mode 100644 index 0000000000000..0992df5911093 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeaderPost202Retry200HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for post202Retry200 operation. + */ +public class LROsCustomHeaderPost202Retry200HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/customheader/post/202/retry/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsCustomHeaderPost202Retry200HeadersInner object itself. + */ + public LROsCustomHeaderPost202Retry200HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsCustomHeaderPost202Retry200HeadersInner object itself. + */ + public LROsCustomHeaderPost202Retry200HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeaderPostAsyncRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeaderPostAsyncRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..f8fa7f3d44afb --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeaderPostAsyncRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncRetrySucceeded operation. + */ +public class LROsCustomHeaderPostAsyncRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/customheader/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/customheader/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsCustomHeaderPostAsyncRetrySucceededHeadersInner object itself. + */ + public LROsCustomHeaderPostAsyncRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsCustomHeaderPostAsyncRetrySucceededHeadersInner object itself. + */ + public LROsCustomHeaderPostAsyncRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsCustomHeaderPostAsyncRetrySucceededHeadersInner object itself. + */ + public LROsCustomHeaderPostAsyncRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeaderPutAsyncRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeaderPutAsyncRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..1959029854c11 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeaderPutAsyncRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncRetrySucceeded operation. + */ +public class LROsCustomHeaderPutAsyncRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/customheader/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/customheader/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsCustomHeaderPutAsyncRetrySucceededHeadersInner object itself. + */ + public LROsCustomHeaderPutAsyncRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsCustomHeaderPutAsyncRetrySucceededHeadersInner object itself. + */ + public LROsCustomHeaderPutAsyncRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsCustomHeaderPutAsyncRetrySucceededHeadersInner object itself. + */ + public LROsCustomHeaderPutAsyncRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeadersInner.java new file mode 100644 index 0000000000000..5445b0cf1d0f1 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeadersInner.java @@ -0,0 +1,783 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in LROsCustomHeaders. + */ +public final class LROsCustomHeadersInner { + /** The Retrofit service to perform REST calls. */ + private LROsCustomHeadersService service; + /** The service client containing this operation class. */ + private AutoRestLongRunningOperationTestServiceImpl client; + + /** + * Initializes an instance of LROsCustomHeadersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LROsCustomHeadersInner(Retrofit retrofit, AutoRestLongRunningOperationTestServiceImpl client) { + this.service = retrofit.create(LROsCustomHeadersService.class); + this.client = client; + } + + /** + * The interface defining all the services for LROsCustomHeaders to be + * used by Retrofit to perform actually REST calls. + */ + interface LROsCustomHeadersService { + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/customheader/putasync/retry/succeeded") + Call putAsyncRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/customheader/putasync/retry/succeeded") + Call beginPutAsyncRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/customheader/put/201/creating/succeeded/200") + Call put201CreatingSucceeded200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/customheader/put/201/creating/succeeded/200") + Call beginPut201CreatingSucceeded200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/customheader/post/202/retry/200") + Call post202Retry200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/customheader/post/202/retry/200") + Call beginPost202Retry200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/customheader/postasync/retry/succeeded") + Call postAsyncRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/customheader/postasync/retry/succeeded") + Call beginPostAsyncRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPutAsyncRetrySucceededHeadersInner.class); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsCustomHeaderPutAsyncRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRetrySucceeded(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPutAsyncRetrySucceededHeadersInner.class); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsCustomHeaderPutAsyncRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRetrySucceeded() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRetrySucceededDelegate(call.execute()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRetrySucceeded(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRetrySucceededDelegate(call.execute()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsCustomHeaderPutAsyncRetrySucceededHeadersInner.class); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put201CreatingSucceeded200() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put201CreatingSucceeded200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put201CreatingSucceeded200(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put201CreatingSucceeded200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut201CreatingSucceeded200() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut201CreatingSucceeded200Delegate(call.execute()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut201CreatingSucceeded200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut201CreatingSucceeded200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut201CreatingSucceeded200(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut201CreatingSucceeded200Delegate(call.execute()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut201CreatingSucceeded200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut201CreatingSucceeded200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut201CreatingSucceeded200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202Retry200() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPost202Retry200HeadersInner.class); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsCustomHeaderPost202Retry200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202Retry200(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPost202Retry200HeadersInner.class); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202Retry200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsCustomHeaderPost202Retry200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202Retry200() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202Retry200Delegate(call.execute()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202Retry200(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202Retry200Delegate(call.execute()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202Retry200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPost202Retry200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsCustomHeaderPost202Retry200HeadersInner.class); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPostAsyncRetrySucceededHeadersInner.class); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsCustomHeaderPostAsyncRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRetrySucceeded(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPostAsyncRetrySucceededHeadersInner.class); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsCustomHeaderPostAsyncRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRetrySucceeded() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRetrySucceededDelegate(call.execute()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRetrySucceeded(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRetrySucceededDelegate(call.execute()); + } + + /** + * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsCustomHeaderPostAsyncRetrySucceededHeadersInner.class); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDelete202NoRetry204HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDelete202NoRetry204HeadersInner.java new file mode 100644 index 0000000000000..b5f8598031100 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDelete202NoRetry204HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for delete202NoRetry204 operation. + */ +public class LROsDelete202NoRetry204HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/delete/202/noretry/204. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDelete202NoRetry204HeadersInner object itself. + */ + public LROsDelete202NoRetry204HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsDelete202NoRetry204HeadersInner object itself. + */ + public LROsDelete202NoRetry204HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDelete202Retry200HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDelete202Retry200HeadersInner.java new file mode 100644 index 0000000000000..67db41a095412 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDelete202Retry200HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for delete202Retry200 operation. + */ +public class LROsDelete202Retry200HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/delete/202/retry/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDelete202Retry200HeadersInner object itself. + */ + public LROsDelete202Retry200HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsDelete202Retry200HeadersInner object itself. + */ + public LROsDelete202Retry200HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncNoHeaderInRetryHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncNoHeaderInRetryHeadersInner.java new file mode 100644 index 0000000000000..c7f2005b5ca4b --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncNoHeaderInRetryHeadersInner.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncNoHeaderInRetry operation. + */ +public class LROsDeleteAsyncNoHeaderInRetryHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/put/noheader/202/204/operationresults. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDeleteAsyncNoHeaderInRetryHeadersInner object itself. + */ + public LROsDeleteAsyncNoHeaderInRetryHeadersInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncNoRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncNoRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..831ed7e363f10 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncNoRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncNoRetrySucceeded operation. + */ +public class LROsDeleteAsyncNoRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/noretry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/noretry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsDeleteAsyncNoRetrySucceededHeadersInner object itself. + */ + public LROsDeleteAsyncNoRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDeleteAsyncNoRetrySucceededHeadersInner object itself. + */ + public LROsDeleteAsyncNoRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsDeleteAsyncNoRetrySucceededHeadersInner object itself. + */ + public LROsDeleteAsyncNoRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncRetryFailedHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncRetryFailedHeadersInner.java new file mode 100644 index 0000000000000..182a146620e2d --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncRetryFailedHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncRetryFailed operation. + */ +public class LROsDeleteAsyncRetryFailedHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/retry/failed/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/retry/failed/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsDeleteAsyncRetryFailedHeadersInner object itself. + */ + public LROsDeleteAsyncRetryFailedHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDeleteAsyncRetryFailedHeadersInner object itself. + */ + public LROsDeleteAsyncRetryFailedHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsDeleteAsyncRetryFailedHeadersInner object itself. + */ + public LROsDeleteAsyncRetryFailedHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..a07ff4d1cbe37 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncRetrySucceeded operation. + */ +public class LROsDeleteAsyncRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsDeleteAsyncRetrySucceededHeadersInner object itself. + */ + public LROsDeleteAsyncRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDeleteAsyncRetrySucceededHeadersInner object itself. + */ + public LROsDeleteAsyncRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsDeleteAsyncRetrySucceededHeadersInner object itself. + */ + public LROsDeleteAsyncRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncRetrycanceledHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncRetrycanceledHeadersInner.java new file mode 100644 index 0000000000000..fe46621b83b1a --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteAsyncRetrycanceledHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteAsyncRetrycanceled operation. + */ +public class LROsDeleteAsyncRetrycanceledHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/retry/canceled/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/deleteasync/retry/canceled/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsDeleteAsyncRetrycanceledHeadersInner object itself. + */ + public LROsDeleteAsyncRetrycanceledHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDeleteAsyncRetrycanceledHeadersInner object itself. + */ + public LROsDeleteAsyncRetrycanceledHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsDeleteAsyncRetrycanceledHeadersInner object itself. + */ + public LROsDeleteAsyncRetrycanceledHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteNoHeaderInRetryHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteNoHeaderInRetryHeadersInner.java new file mode 100644 index 0000000000000..25221164d4dd9 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteNoHeaderInRetryHeadersInner.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteNoHeaderInRetry operation. + */ +public class LROsDeleteNoHeaderInRetryHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/put/noheader/202/204/operationresults. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDeleteNoHeaderInRetryHeadersInner object itself. + */ + public LROsDeleteNoHeaderInRetryHeadersInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteProvisioning202Accepted200SucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteProvisioning202Accepted200SucceededHeadersInner.java new file mode 100644 index 0000000000000..2c26262fae5eb --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteProvisioning202Accepted200SucceededHeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteProvisioning202Accepted200Succeeded operation. + */ +public class LROsDeleteProvisioning202Accepted200SucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/delete/provisioning/202/accepted/200/succeeded. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDeleteProvisioning202Accepted200SucceededHeadersInner object itself. + */ + public LROsDeleteProvisioning202Accepted200SucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsDeleteProvisioning202Accepted200SucceededHeadersInner object itself. + */ + public LROsDeleteProvisioning202Accepted200SucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteProvisioning202DeletingFailed200HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteProvisioning202DeletingFailed200HeadersInner.java new file mode 100644 index 0000000000000..531151df7769e --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteProvisioning202DeletingFailed200HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteProvisioning202DeletingFailed200 operation. + */ +public class LROsDeleteProvisioning202DeletingFailed200HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/delete/provisioning/202/deleting/200/failed. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDeleteProvisioning202DeletingFailed200HeadersInner object itself. + */ + public LROsDeleteProvisioning202DeletingFailed200HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsDeleteProvisioning202DeletingFailed200HeadersInner object itself. + */ + public LROsDeleteProvisioning202DeletingFailed200HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteProvisioning202Deletingcanceled200HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteProvisioning202Deletingcanceled200HeadersInner.java new file mode 100644 index 0000000000000..ac972d20a1069 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsDeleteProvisioning202Deletingcanceled200HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for deleteProvisioning202Deletingcanceled200 operation. + */ +public class LROsDeleteProvisioning202Deletingcanceled200HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/delete/provisioning/202/deleting/200/canceled. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsDeleteProvisioning202Deletingcanceled200HeadersInner object itself. + */ + public LROsDeleteProvisioning202Deletingcanceled200HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsDeleteProvisioning202Deletingcanceled200HeadersInner object itself. + */ + public LROsDeleteProvisioning202Deletingcanceled200HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsInner.java new file mode 100644 index 0000000000000..205fb29c21238 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsInner.java @@ -0,0 +1,5412 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in LROs. + */ +public final class LROsInner { + /** The Retrofit service to perform REST calls. */ + private LROsService service; + /** The service client containing this operation class. */ + private AutoRestLongRunningOperationTestServiceImpl client; + + /** + * Initializes an instance of LROsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LROsInner(Retrofit retrofit, AutoRestLongRunningOperationTestServiceImpl client) { + this.service = retrofit.create(LROsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LROs to be + * used by Retrofit to perform actually REST calls. + */ + interface LROsService { + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/200/succeeded") + Call put200Succeeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/200/succeeded") + Call beginPut200Succeeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/200/succeeded/nostate") + Call put200SucceededNoState(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/200/succeeded/nostate") + Call beginPut200SucceededNoState(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/202/retry/200") + Call put202Retry200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/202/retry/200") + Call beginPut202Retry200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/201/creating/succeeded/200") + Call put201CreatingSucceeded200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/201/creating/succeeded/200") + Call beginPut201CreatingSucceeded200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/200/updating/succeeded/200") + Call put200UpdatingSucceeded204(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/200/updating/succeeded/200") + Call beginPut200UpdatingSucceeded204(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/201/created/failed/200") + Call put201CreatingFailed200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/201/created/failed/200") + Call beginPut201CreatingFailed200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/200/accepted/canceled/200") + Call put200Acceptedcanceled200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/200/accepted/canceled/200") + Call beginPut200Acceptedcanceled200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/noheader/202/200") + Call putNoHeaderInRetry(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/put/noheader/202/200") + Call beginPutNoHeaderInRetry(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/retry/succeeded") + Call putAsyncRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/retry/succeeded") + Call beginPutAsyncRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/noretry/succeeded") + Call putAsyncNoRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/noretry/succeeded") + Call beginPutAsyncNoRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/retry/failed") + Call putAsyncRetryFailed(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/retry/failed") + Call beginPutAsyncRetryFailed(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/noretry/canceled") + Call putAsyncNoRetrycanceled(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/noretry/canceled") + Call beginPutAsyncNoRetrycanceled(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/noheader/201/200") + Call putAsyncNoHeaderInRetry(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putasync/noheader/201/200") + Call beginPutAsyncNoHeaderInRetry(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putnonresource/202/200") + Call putNonResource(@Body SkuInner sku, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putnonresource/202/200") + Call beginPutNonResource(@Body SkuInner sku, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putnonresourceasync/202/200") + Call putAsyncNonResource(@Body SkuInner sku, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putnonresourceasync/202/200") + Call beginPutAsyncNonResource(@Body SkuInner sku, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putsubresource/202/200") + Call putSubResource(@Body SubProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putsubresource/202/200") + Call beginPutSubResource(@Body SubProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putsubresourceasync/202/200") + Call putAsyncSubResource(@Body SubProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("lro/putsubresourceasync/202/200") + Call beginPutAsyncSubResource(@Body SubProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/provisioning/202/accepted/200/succeeded", method = "DELETE", hasBody = true) + Call deleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/provisioning/202/accepted/200/succeeded", method = "DELETE", hasBody = true) + Call beginDeleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/provisioning/202/deleting/200/failed", method = "DELETE", hasBody = true) + Call deleteProvisioning202DeletingFailed200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/provisioning/202/deleting/200/failed", method = "DELETE", hasBody = true) + Call beginDeleteProvisioning202DeletingFailed200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/provisioning/202/deleting/200/canceled", method = "DELETE", hasBody = true) + Call deleteProvisioning202Deletingcanceled200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/provisioning/202/deleting/200/canceled", method = "DELETE", hasBody = true) + Call beginDeleteProvisioning202Deletingcanceled200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/204/succeeded", method = "DELETE", hasBody = true) + Call delete204Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/204/succeeded", method = "DELETE", hasBody = true) + Call beginDelete204Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/202/retry/200", method = "DELETE", hasBody = true) + Call delete202Retry200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/202/retry/200", method = "DELETE", hasBody = true) + Call beginDelete202Retry200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/202/noretry/204", method = "DELETE", hasBody = true) + Call delete202NoRetry204(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/202/noretry/204", method = "DELETE", hasBody = true) + Call beginDelete202NoRetry204(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/noheader", method = "DELETE", hasBody = true) + Call deleteNoHeaderInRetry(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/delete/noheader", method = "DELETE", hasBody = true) + Call beginDeleteNoHeaderInRetry(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/noheader/202/204", method = "DELETE", hasBody = true) + Call deleteAsyncNoHeaderInRetry(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/noheader/202/204", method = "DELETE", hasBody = true) + Call beginDeleteAsyncNoHeaderInRetry(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/retry/succeeded", method = "DELETE", hasBody = true) + Call deleteAsyncRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/retry/succeeded", method = "DELETE", hasBody = true) + Call beginDeleteAsyncRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/noretry/succeeded", method = "DELETE", hasBody = true) + Call deleteAsyncNoRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/noretry/succeeded", method = "DELETE", hasBody = true) + Call beginDeleteAsyncNoRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/retry/failed", method = "DELETE", hasBody = true) + Call deleteAsyncRetryFailed(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/retry/failed", method = "DELETE", hasBody = true) + Call beginDeleteAsyncRetryFailed(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/retry/canceled", method = "DELETE", hasBody = true) + Call deleteAsyncRetrycanceled(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "lro/deleteasync/retry/canceled", method = "DELETE", hasBody = true) + Call beginDeleteAsyncRetrycanceled(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/post/payload/200") + Call post200WithPayload(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/post/payload/200") + Call beginPost200WithPayload(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/post/202/retry/200") + Call post202Retry200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/post/202/retry/200") + Call beginPost202Retry200(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/post/202/noretry/204") + Call post202NoRetry204(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/post/202/noretry/204") + Call beginPost202NoRetry204(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/postasync/retry/succeeded") + Call postAsyncRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/postasync/retry/succeeded") + Call beginPostAsyncRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/postasync/noretry/succeeded") + Call postAsyncNoRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/postasync/noretry/succeeded") + Call beginPostAsyncNoRetrySucceeded(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/postasync/retry/failed") + Call postAsyncRetryFailed(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/postasync/retry/failed") + Call beginPostAsyncRetryFailed(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/postasync/retry/canceled") + Call postAsyncRetrycanceled(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("lro/postasync/retry/canceled") + Call beginPostAsyncRetrycanceled(@Body ProductInner product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200Succeeded() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200Succeeded(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200SucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200Succeeded() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200SucceededDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200SucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200Succeeded(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200SucceededDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200SucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200SucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut200SucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200SucceededNoState() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200SucceededNoStateAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200SucceededNoState(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200SucceededNoStateAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200SucceededNoState() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200SucceededNoStateDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200SucceededNoStateAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200SucceededNoStateDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200SucceededNoState(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200SucceededNoStateDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200SucceededNoStateAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200SucceededNoStateDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut200SucceededNoStateDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put202Retry200() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put202Retry200(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put202Retry200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut202Retry200() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut202Retry200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut202Retry200(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut202Retry200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut202Retry200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut202Retry200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put201CreatingSucceeded200() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put201CreatingSucceeded200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put201CreatingSucceeded200(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put201CreatingSucceeded200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut201CreatingSucceeded200() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut201CreatingSucceeded200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut201CreatingSucceeded200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut201CreatingSucceeded200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut201CreatingSucceeded200(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut201CreatingSucceeded200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut201CreatingSucceeded200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut201CreatingSucceeded200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut201CreatingSucceeded200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200UpdatingSucceeded204() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200UpdatingSucceeded204Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200UpdatingSucceeded204(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200UpdatingSucceeded204Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200UpdatingSucceeded204() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200UpdatingSucceeded204Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200UpdatingSucceeded204Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200UpdatingSucceeded204Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200UpdatingSucceeded204(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200UpdatingSucceeded204Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200UpdatingSucceeded204Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200UpdatingSucceeded204Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut200UpdatingSucceeded204Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put201CreatingFailed200() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put201CreatingFailed200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put201CreatingFailed200(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put201CreatingFailed200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut201CreatingFailed200() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut201CreatingFailed200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut201CreatingFailed200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut201CreatingFailed200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut201CreatingFailed200(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut201CreatingFailed200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut201CreatingFailed200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut201CreatingFailed200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut201CreatingFailed200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200Acceptedcanceled200() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.put200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200Acceptedcanceled200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.put200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse put200Acceptedcanceled200(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.put200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall put200Acceptedcanceled200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.put200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200Acceptedcanceled200() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPut200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200Acceptedcanceled200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200Acceptedcanceled200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPut200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200Acceptedcanceled200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPut200Acceptedcanceled200(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPut200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPut200Acceptedcanceled200Delegate(call.execute()); + } + + /** + * Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPut200Acceptedcanceled200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPut200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPut200Acceptedcanceled200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPut200Acceptedcanceled200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putNoHeaderInRetry() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNoHeaderInRetryAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutNoHeaderInRetryHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putNoHeaderInRetry(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNoHeaderInRetryAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutNoHeaderInRetryHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutNoHeaderInRetry() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNoHeaderInRetryDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNoHeaderInRetryAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNoHeaderInRetryDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutNoHeaderInRetry(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNoHeaderInRetryDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNoHeaderInRetryAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNoHeaderInRetryDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutNoHeaderInRetryDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPutNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncRetrySucceededHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRetrySucceeded(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncRetrySucceededHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRetrySucceeded() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRetrySucceededDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRetrySucceeded(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRetrySucceededDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPutAsyncRetrySucceededHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncNoRetrySucceeded() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoRetrySucceededHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncNoRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncNoRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncNoRetrySucceeded(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoRetrySucceededHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncNoRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncNoRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncNoRetrySucceeded() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncNoRetrySucceededDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncNoRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncNoRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncNoRetrySucceeded(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncNoRetrySucceededDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncNoRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncNoRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncNoRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPutAsyncNoRetrySucceededHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRetryFailed() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncRetryFailedHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRetryFailedAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncRetryFailedHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncRetryFailed(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncRetryFailedHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncRetryFailedAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncRetryFailedHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRetryFailed() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRetryFailedDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRetryFailedAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRetryFailedDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncRetryFailed(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncRetryFailedDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncRetryFailedAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncRetryFailedDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncRetryFailedDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPutAsyncRetryFailedHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncNoRetrycanceled() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoRetrycanceledHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncNoRetrycanceledAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncNoRetrycanceledHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncNoRetrycanceled(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoRetrycanceledHeadersInner.class); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncNoRetrycanceledAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncNoRetrycanceledHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncNoRetrycanceled() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncNoRetrycanceledDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncNoRetrycanceledAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncNoRetrycanceledDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncNoRetrycanceled(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncNoRetrycanceledDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncNoRetrycanceledAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncNoRetrycanceledDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncNoRetrycanceledDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPutAsyncNoRetrycanceledHeadersInner.class); + } + + /** + * Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncNoHeaderInRetry() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncNoHeaderInRetryAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncNoHeaderInRetryHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders putAsyncNoHeaderInRetry(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncNoHeaderInRetryAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPutAsyncNoHeaderInRetryHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncNoHeaderInRetry() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncNoHeaderInRetryDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncNoHeaderInRetryAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncNoHeaderInRetryDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPutAsyncNoHeaderInRetry(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncNoHeaderInRetryDelegate(call.execute()); + } + + /** + * Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncNoHeaderInRetryAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncNoHeaderInRetryDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPutAsyncNoHeaderInRetryDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPutAsyncNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running put request with non resource. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the SkuInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putNonResource() throws CloudException, IOException, InterruptedException { + final SkuInner sku = null; + Response result = service.putNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request with non resource. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNonResourceAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final SkuInner sku = null; + Call call = service.putNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request with non resource. + * + * @param sku sku to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the SkuInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putNonResource(SkuInner sku) throws CloudException, IOException, InterruptedException { + Validator.validate(sku); + Response result = service.putNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request with non resource. + * + * @param sku sku to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putNonResourceAsync(SkuInner sku, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(sku, serviceCallback); + Call call = service.putNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request with non resource. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the SkuInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutNonResource() throws CloudException, IOException { + final SkuInner sku = null; + Call call = service.beginPutNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNonResourceDelegate(call.execute()); + } + + /** + * Long running put request with non resource. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNonResourceAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final SkuInner sku = null; + Call call = service.beginPutNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNonResourceDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request with non resource. + * + * @param sku sku to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the SkuInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutNonResource(SkuInner sku) throws CloudException, IOException { + Validator.validate(sku); + Call call = service.beginPutNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutNonResourceDelegate(call.execute()); + } + + /** + * Long running put request with non resource. + * + * @param sku sku to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutNonResourceAsync(SkuInner sku, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(sku, serviceCallback); + Call call = service.beginPutNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutNonResourceDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPutNonResourceDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request with non resource. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the SkuInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putAsyncNonResource() throws CloudException, IOException, InterruptedException { + final SkuInner sku = null; + Response result = service.putAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request with non resource. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncNonResourceAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final SkuInner sku = null; + Call call = service.putAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request with non resource. + * + * @param sku Sku to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the SkuInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putAsyncNonResource(SkuInner sku) throws CloudException, IOException, InterruptedException { + Validator.validate(sku); + Response result = service.putAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request with non resource. + * + * @param sku Sku to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncNonResourceAsync(SkuInner sku, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(sku, serviceCallback); + Call call = service.putAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request with non resource. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the SkuInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutAsyncNonResource() throws CloudException, IOException { + final SkuInner sku = null; + Call call = service.beginPutAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncNonResourceDelegate(call.execute()); + } + + /** + * Long running put request with non resource. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncNonResourceAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final SkuInner sku = null; + Call call = service.beginPutAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncNonResourceDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request with non resource. + * + * @param sku Sku to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the SkuInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutAsyncNonResource(SkuInner sku) throws CloudException, IOException { + Validator.validate(sku); + Call call = service.beginPutAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncNonResourceDelegate(call.execute()); + } + + /** + * Long running put request with non resource. + * + * @param sku Sku to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncNonResourceAsync(SkuInner sku, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(sku, serviceCallback); + Call call = service.beginPutAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncNonResourceDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPutAsyncNonResourceDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request with sub resource. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the SubProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putSubResource() throws CloudException, IOException, InterruptedException { + final SubProductInner product = null; + Response result = service.putSubResource(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request with sub resource. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putSubResourceAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final SubProductInner product = null; + Call call = service.putSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request with sub resource. + * + * @param product Sub Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the SubProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putSubResource(SubProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putSubResource(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request with sub resource. + * + * @param product Sub Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putSubResourceAsync(SubProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request with sub resource. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the SubProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutSubResource() throws CloudException, IOException { + final SubProductInner product = null; + Call call = service.beginPutSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutSubResourceDelegate(call.execute()); + } + + /** + * Long running put request with sub resource. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutSubResourceAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final SubProductInner product = null; + Call call = service.beginPutSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutSubResourceDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request with sub resource. + * + * @param product Sub Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the SubProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutSubResource(SubProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutSubResourceDelegate(call.execute()); + } + + /** + * Long running put request with sub resource. + * + * @param product Sub Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutSubResourceAsync(SubProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutSubResourceDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPutSubResourceDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running put request with sub resource. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the SubProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putAsyncSubResource() throws CloudException, IOException, InterruptedException { + final SubProductInner product = null; + Response result = service.putAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request with sub resource. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncSubResourceAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final SubProductInner product = null; + Call call = service.putAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running put request with sub resource. + * + * @param product Sub Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the SubProductInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse putAsyncSubResource(SubProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.putAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running put request with sub resource. + * + * @param product Sub Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall putAsyncSubResourceAsync(SubProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.putAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running put request with sub resource. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the SubProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutAsyncSubResource() throws CloudException, IOException { + final SubProductInner product = null; + Call call = service.beginPutAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncSubResourceDelegate(call.execute()); + } + + /** + * Long running put request with sub resource. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncSubResourceAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final SubProductInner product = null; + Call call = service.beginPutAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncSubResourceDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running put request with sub resource. + * + * @param product Sub Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the SubProductInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPutAsyncSubResource(SubProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPutAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPutAsyncSubResourceDelegate(call.execute()); + } + + /** + * Long running put request with sub resource. + * + * @param product Sub Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPutAsyncSubResourceAsync(SubProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPutAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPutAsyncSubResourceDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPutAsyncSubResourceDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders deleteProvisioning202Accepted200Succeeded() throws CloudException, IOException, InterruptedException { + Response result = service.deleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteProvisioning202Accepted200SucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteProvisioning202Accepted200SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDeleteProvisioning202Accepted200SucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginDeleteProvisioning202Accepted200Succeeded() throws CloudException, IOException { + Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteProvisioning202Accepted200SucceededDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteProvisioning202Accepted200SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteProvisioning202Accepted200SucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteProvisioning202Accepted200SucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDeleteProvisioning202Accepted200SucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders deleteProvisioning202DeletingFailed200() throws CloudException, IOException, InterruptedException { + Response result = service.deleteProvisioning202DeletingFailed200(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteProvisioning202DeletingFailed200HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteProvisioning202DeletingFailed200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteProvisioning202DeletingFailed200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDeleteProvisioning202DeletingFailed200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginDeleteProvisioning202DeletingFailed200() throws CloudException, IOException { + Call call = service.beginDeleteProvisioning202DeletingFailed200(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteProvisioning202DeletingFailed200Delegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteProvisioning202DeletingFailed200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteProvisioning202DeletingFailed200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteProvisioning202DeletingFailed200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteProvisioning202DeletingFailed200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDeleteProvisioning202DeletingFailed200HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders deleteProvisioning202Deletingcanceled200() throws CloudException, IOException, InterruptedException { + Response result = service.deleteProvisioning202Deletingcanceled200(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteProvisioning202Deletingcanceled200HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteProvisioning202Deletingcanceled200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteProvisioning202Deletingcanceled200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDeleteProvisioning202Deletingcanceled200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginDeleteProvisioning202Deletingcanceled200() throws CloudException, IOException { + Call call = service.beginDeleteProvisioning202Deletingcanceled200(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteProvisioning202Deletingcanceled200Delegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteProvisioning202Deletingcanceled200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteProvisioning202Deletingcanceled200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteProvisioning202Deletingcanceled200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteProvisioning202Deletingcanceled200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDeleteProvisioning202Deletingcanceled200HeadersInner.class); + } + + /** + * Long running delete succeeds and returns right away. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponse object if successful. + */ + public ServiceResponse delete204Succeeded() throws CloudException, IOException, InterruptedException { + Response result = service.delete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running delete succeeds and returns right away. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall delete204SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.delete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete succeeds and returns right away. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse beginDelete204Succeeded() throws CloudException, IOException { + Call call = service.beginDelete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + return beginDelete204SucceededDelegate(call.execute()); + } + + /** + * Long running delete succeeds and returns right away. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDelete204SucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDelete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDelete204SucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginDelete204SucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders delete202Retry200() throws CloudException, IOException, InterruptedException { + Response result = service.delete202Retry200(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDelete202Retry200HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall delete202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.delete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDelete202Retry200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginDelete202Retry200() throws CloudException, IOException { + Call call = service.beginDelete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); + return beginDelete202Retry200Delegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDelete202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDelete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDelete202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDelete202Retry200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDelete202Retry200HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders delete202NoRetry204() throws CloudException, IOException, InterruptedException { + Response result = service.delete202NoRetry204(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDelete202NoRetry204HeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall delete202NoRetry204Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.delete202NoRetry204(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDelete202NoRetry204HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginDelete202NoRetry204() throws CloudException, IOException { + Call call = service.beginDelete202NoRetry204(this.client.acceptLanguage(), this.client.userAgent()); + return beginDelete202NoRetry204Delegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDelete202NoRetry204Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDelete202NoRetry204(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDelete202NoRetry204Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDelete202NoRetry204Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDelete202NoRetry204HeadersInner.class); + } + + /** + * Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteNoHeaderInRetry() throws CloudException, IOException, InterruptedException { + Response result = service.deleteNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteNoHeaderInRetryAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDeleteNoHeaderInRetryHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteNoHeaderInRetry() throws CloudException, IOException { + Call call = service.beginDeleteNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteNoHeaderInRetryDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteNoHeaderInRetryAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteNoHeaderInRetryDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteNoHeaderInRetryDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDeleteNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncNoHeaderInRetry() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncNoHeaderInRetryAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDeleteAsyncNoHeaderInRetryHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncNoHeaderInRetry() throws CloudException, IOException { + Call call = service.beginDeleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncNoHeaderInRetryDelegate(call.execute()); + } + + /** + * Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncNoHeaderInRetryAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncNoHeaderInRetryDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncNoHeaderInRetryDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDeleteAsyncNoHeaderInRetryHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncRetrySucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDeleteAsyncRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncRetrySucceeded() throws CloudException, IOException { + Call call = service.beginDeleteAsyncRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncRetrySucceededDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDeleteAsyncRetrySucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncNoRetrySucceeded() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncNoRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncNoRetrySucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncNoRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncNoRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDeleteAsyncNoRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncNoRetrySucceeded() throws CloudException, IOException { + Call call = service.beginDeleteAsyncNoRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncNoRetrySucceededDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncNoRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncNoRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncNoRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncNoRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDeleteAsyncNoRetrySucceededHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncRetryFailed() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncRetryFailed(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncRetryFailedHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncRetryFailedAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncRetryFailed(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDeleteAsyncRetryFailedHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncRetryFailed() throws CloudException, IOException { + Call call = service.beginDeleteAsyncRetryFailed(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncRetryFailedDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncRetryFailedAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncRetryFailed(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncRetryFailedDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncRetryFailedDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDeleteAsyncRetryFailedHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders deleteAsyncRetrycanceled() throws CloudException, IOException, InterruptedException { + Response result = service.deleteAsyncRetrycanceled(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncRetrycanceledHeadersInner.class); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsyncRetrycanceledAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.deleteAsyncRetrycanceled(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsDeleteAsyncRetrycanceledHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginDeleteAsyncRetrycanceled() throws CloudException, IOException { + Call call = service.beginDeleteAsyncRetrycanceled(this.client.acceptLanguage(), this.client.userAgent()); + return beginDeleteAsyncRetrycanceledDelegate(call.execute()); + } + + /** + * Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginDeleteAsyncRetrycanceledAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginDeleteAsyncRetrycanceled(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginDeleteAsyncRetrycanceledDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginDeleteAsyncRetrycanceledDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsDeleteAsyncRetrycanceledHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the SkuInner object wrapped in ServiceResponse if successful. + */ + public ServiceResponse post200WithPayload() throws CloudException, IOException, InterruptedException { + Response result = service.post200WithPayload(this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() { }.getType()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post200WithPayloadAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.post200WithPayload(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the SkuInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginPost200WithPayload() throws CloudException, IOException { + Call call = service.beginPost200WithPayload(this.client.acceptLanguage(), this.client.userAgent()); + return beginPost200WithPayloadDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost200WithPayloadAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.beginPost200WithPayload(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost200WithPayloadDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginPost200WithPayloadDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202Retry200() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPost202Retry200HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPost202Retry200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders post202Retry200(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPost202Retry200HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202Retry200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPost202Retry200HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202Retry200() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202Retry200Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202Retry200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPost202Retry200(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202Retry200Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202Retry200Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202Retry200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPost202Retry200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPost202Retry200HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders post202NoRetry204() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.post202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPost202NoRetry204HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202NoRetry204Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.post202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPost202NoRetry204HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders post202NoRetry204(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.post202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPost202NoRetry204HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall post202NoRetry204Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.post202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPost202NoRetry204HeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPost202NoRetry204() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPost202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202NoRetry204Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202NoRetry204Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPost202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202NoRetry204Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPost202NoRetry204(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPost202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPost202NoRetry204Delegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPost202NoRetry204Async(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPost202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPost202NoRetry204Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPost202NoRetry204Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPost202NoRetry204HeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders postAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetrySucceededHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPostAsyncRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders postAsyncRetrySucceeded(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetrySucceededHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPostAsyncRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRetrySucceeded() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRetrySucceededDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRetrySucceeded(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRetrySucceededDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPostAsyncRetrySucceededHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders postAsyncNoRetrySucceeded() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncNoRetrySucceededHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncNoRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPostAsyncNoRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ProductInner object wrapped in ServiceResponseWithHeaders if successful. + */ + public ServiceResponseWithHeaders postAsyncNoRetrySucceeded(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncNoRetrySucceededHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncNoRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPostAsyncNoRetrySucceededHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncNoRetrySucceeded() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncNoRetrySucceededDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncNoRetrySucceededAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncNoRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the ProductInner object wrapped in {@link ServiceResponseWithHeaders} if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncNoRetrySucceeded(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncNoRetrySucceededDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncNoRetrySucceededAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncNoRetrySucceededDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncNoRetrySucceededDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPostAsyncNoRetrySucceededHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRetryFailed() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetryFailedHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRetryFailedAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPostAsyncRetryFailedHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRetryFailed(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetryFailedHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRetryFailedAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPostAsyncRetryFailedHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRetryFailed() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRetryFailedDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRetryFailedAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRetryFailedDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRetryFailed(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRetryFailedDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRetryFailedAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRetryFailedDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncRetryFailedDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPostAsyncRetryFailedHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRetrycanceled() throws CloudException, IOException, InterruptedException { + final ProductInner product = null; + Response result = service.postAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetrycanceledHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRetrycanceledAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.postAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPostAsyncRetrycanceledHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the ServiceResponseWithHeaders object if successful. + */ + public ServiceResponseWithHeaders postAsyncRetrycanceled(ProductInner product) throws CloudException, IOException, InterruptedException { + Validator.validate(product); + Response result = service.postAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); + return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetrycanceledHeadersInner.class); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall postAsyncRetrycanceledAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.postAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(response, new TypeToken() { }.getType(), LROsPostAsyncRetrycanceledHeadersInner.class, serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRetrycanceled() throws CloudException, IOException { + final ProductInner product = null; + Call call = service.beginPostAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRetrycanceledDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRetrycanceledAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final ProductInner product = null; + Call call = service.beginPostAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRetrycanceledDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public ServiceResponseWithHeaders beginPostAsyncRetrycanceled(ProductInner product) throws CloudException, IOException { + Validator.validate(product); + Call call = service.beginPostAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + return beginPostAsyncRetrycanceledDelegate(call.execute()); + } + + /** + * Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. + * + * @param product Product to put + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginPostAsyncRetrycanceledAsync(ProductInner product, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(product, serviceCallback); + Call call = service.beginPostAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginPostAsyncRetrycanceledDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponseWithHeaders beginPostAsyncRetrycanceledDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, LROsPostAsyncRetrycanceledHeadersInner.class); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPost202NoRetry204HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPost202NoRetry204HeadersInner.java new file mode 100644 index 0000000000000..c439b81f1df3a --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPost202NoRetry204HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for post202NoRetry204 operation. + */ +public class LROsPost202NoRetry204HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/post/202/noretry/204. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPost202NoRetry204HeadersInner object itself. + */ + public LROsPost202NoRetry204HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsPost202NoRetry204HeadersInner object itself. + */ + public LROsPost202NoRetry204HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPost202Retry200HeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPost202Retry200HeadersInner.java new file mode 100644 index 0000000000000..5bfddf12279fb --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPost202Retry200HeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for post202Retry200 operation. + */ +public class LROsPost202Retry200HeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/post/202/retry/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPost202Retry200HeadersInner object itself. + */ + public LROsPost202Retry200HeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsPost202Retry200HeadersInner object itself. + */ + public LROsPost202Retry200HeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncNoRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncNoRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..2d86906ec5222 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncNoRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncNoRetrySucceeded operation. + */ +public class LROsPostAsyncNoRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPostAsyncNoRetrySucceededHeadersInner object itself. + */ + public LROsPostAsyncNoRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPostAsyncNoRetrySucceededHeadersInner object itself. + */ + public LROsPostAsyncNoRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsPostAsyncNoRetrySucceededHeadersInner object itself. + */ + public LROsPostAsyncNoRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncRetryFailedHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncRetryFailedHeadersInner.java new file mode 100644 index 0000000000000..a756960c7a725 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncRetryFailedHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncRetryFailed operation. + */ +public class LROsPostAsyncRetryFailedHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/failed/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/failed/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPostAsyncRetryFailedHeadersInner object itself. + */ + public LROsPostAsyncRetryFailedHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPostAsyncRetryFailedHeadersInner object itself. + */ + public LROsPostAsyncRetryFailedHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsPostAsyncRetryFailedHeadersInner object itself. + */ + public LROsPostAsyncRetryFailedHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..a4e3747ff1a4a --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncRetrySucceeded operation. + */ +public class LROsPostAsyncRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPostAsyncRetrySucceededHeadersInner object itself. + */ + public LROsPostAsyncRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPostAsyncRetrySucceededHeadersInner object itself. + */ + public LROsPostAsyncRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsPostAsyncRetrySucceededHeadersInner object itself. + */ + public LROsPostAsyncRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncRetrycanceledHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncRetrycanceledHeadersInner.java new file mode 100644 index 0000000000000..77b5e30a7b0e4 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPostAsyncRetrycanceledHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for postAsyncRetrycanceled operation. + */ +public class LROsPostAsyncRetrycanceledHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/canceled/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/canceled/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPostAsyncRetrycanceledHeadersInner object itself. + */ + public LROsPostAsyncRetrycanceledHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPostAsyncRetrycanceledHeadersInner object itself. + */ + public LROsPostAsyncRetrycanceledHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsPostAsyncRetrycanceledHeadersInner object itself. + */ + public LROsPostAsyncRetrycanceledHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncNoHeaderInRetryHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncNoHeaderInRetryHeadersInner.java new file mode 100644 index 0000000000000..a00079ae6aab5 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncNoHeaderInRetryHeadersInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncNoHeaderInRetry operation. + */ +public class LROsPutAsyncNoHeaderInRetryHeadersInner { + /** + * The azureAsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncNoHeaderInRetryHeadersInner object itself. + */ + public LROsPutAsyncNoHeaderInRetryHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncNoRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncNoRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..b8ae414534ec5 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncNoRetrySucceededHeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncNoRetrySucceeded operation. + */ +public class LROsPutAsyncNoRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/noretry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/noretry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncNoRetrySucceededHeadersInner object itself. + */ + public LROsPutAsyncNoRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPutAsyncNoRetrySucceededHeadersInner object itself. + */ + public LROsPutAsyncNoRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncNoRetrycanceledHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncNoRetrycanceledHeadersInner.java new file mode 100644 index 0000000000000..11ee2a42fa36a --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncNoRetrycanceledHeadersInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncNoRetrycanceled operation. + */ +public class LROsPutAsyncNoRetrycanceledHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/noretry/canceled/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/noretry/canceled/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncNoRetrycanceledHeadersInner object itself. + */ + public LROsPutAsyncNoRetrycanceledHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPutAsyncNoRetrycanceledHeadersInner object itself. + */ + public LROsPutAsyncNoRetrycanceledHeadersInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncRetryFailedHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncRetryFailedHeadersInner.java new file mode 100644 index 0000000000000..b7a473bd4257e --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncRetryFailedHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncRetryFailed operation. + */ +public class LROsPutAsyncRetryFailedHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/failed/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/failed/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncRetryFailedHeadersInner object itself. + */ + public LROsPutAsyncRetryFailedHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPutAsyncRetryFailedHeadersInner object itself. + */ + public LROsPutAsyncRetryFailedHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsPutAsyncRetryFailedHeadersInner object itself. + */ + public LROsPutAsyncRetryFailedHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncRetrySucceededHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncRetrySucceededHeadersInner.java new file mode 100644 index 0000000000000..c08896e6aa898 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutAsyncRetrySucceededHeadersInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for putAsyncRetrySucceeded operation. + */ +public class LROsPutAsyncRetrySucceededHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Location to poll for result status: will be set to + * /lro/putasync/retry/succeeded/operationResults/200. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Number of milliseconds until the next poll should be sent, will be set + * to zero. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the azureAsyncOperation value. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation value. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncRetrySucceededHeadersInner object itself. + */ + public LROsPutAsyncRetrySucceededHeadersInner withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPutAsyncRetrySucceededHeadersInner object itself. + */ + public LROsPutAsyncRetrySucceededHeadersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the retryAfter value. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter value. + * + * @param retryAfter the retryAfter value to set + * @return the LROsPutAsyncRetrySucceededHeadersInner object itself. + */ + public LROsPutAsyncRetrySucceededHeadersInner withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutNoHeaderInRetryHeadersInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutNoHeaderInRetryHeadersInner.java new file mode 100644 index 0000000000000..2b40f13b28dc2 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsPutNoHeaderInRetryHeadersInner.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + + +/** + * Defines headers for putNoHeaderInRetry operation. + */ +public class LROsPutNoHeaderInRetryHeadersInner { + /** + * Location to poll for result status: will be set to + * /lro/putasync/noheader/202/200/operationResults. + */ + private String location; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the LROsPutNoHeaderInRetryHeadersInner object itself. + */ + public LROsPutNoHeaderInRetryHeadersInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/ProductInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/ProductInner.java new file mode 100644 index 0000000000000..f529bbd6ec3d7 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/ProductInner.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The ProductInner model. + */ +@JsonFlatten +public class ProductInner extends Resource { + /** + * The provisioningState property. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Possible values include: 'Succeeded', 'Failed', 'canceled', 'Accepted', + * 'Creating', 'Created', 'Updating', 'Updated', 'Deleting', 'Deleted', + * 'OK'. + */ + @JsonProperty(value = "properties.provisioningStateValues", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningStateValues; + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState value. + * + * @param provisioningState the provisioningState value to set + * @return the ProductInner object itself. + */ + public ProductInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the provisioningStateValues value. + * + * @return the provisioningStateValues value + */ + public String provisioningStateValues() { + return this.provisioningStateValues; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/SkuInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/SkuInner.java new file mode 100644 index 0000000000000..0ec74655a0f43 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/SkuInner.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + + +/** + * The SkuInner model. + */ +public class SkuInner { + /** + * The name property. + */ + private String name; + + /** + * The id property. + */ + private String id; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the SkuInner object itself. + */ + public SkuInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the SkuInner object itself. + */ + public SkuInner withId(String id) { + this.id = id; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/SubProductInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/SubProductInner.java new file mode 100644 index 0000000000000..aa6a1bab037cd --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/SubProductInner.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.lro.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; + +/** + * The SubProductInner model. + */ +@JsonFlatten +public class SubProductInner extends SubResource { + /** + * The provisioningState property. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Possible values include: 'Succeeded', 'Failed', 'canceled', 'Accepted', + * 'Creating', 'Created', 'Updating', 'Updated', 'Deleting', 'Deleted', + * 'OK'. + */ + @JsonProperty(value = "properties.provisioningStateValues", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningStateValues; + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState value. + * + * @param provisioningState the provisioningState value to set + * @return the SubProductInner object itself. + */ + public SubProductInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the provisioningStateValues value. + * + * @return the provisioningStateValues value + */ + public String provisioningStateValues() { + return this.provisioningStateValues; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/package-info.java new file mode 100644 index 0000000000000..8f0b083f871d1 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestLongRunningOperationTestService. + * Long-running Operation for AutoRest. + */ +package fixtures.lro.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/package-info.java new file mode 100644 index 0000000000000..4d8c8286a0eb4 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/lro/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for AutoRestLongRunningOperationTestService. + * Long-running Operation for AutoRest. + */ +package fixtures.lro; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/OperationResult.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/OperationResult.java new file mode 100644 index 0000000000000..1c6c51a4ff8f2 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/OperationResult.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging; + + +/** + * The OperationResult model. + */ +public class OperationResult { + /** + * The status of the request. Possible values include: 'Succeeded', + * 'Failed', 'canceled', 'Accepted', 'Creating', 'Created', 'Updating', + * 'Updated', 'Deleting', 'Deleted', 'OK'. + */ + private String status; + + /** + * Get the status value. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the OperationResult object itself. + */ + public OperationResult withStatus(String status) { + this.status = status; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/ProductProperties.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/ProductProperties.java new file mode 100644 index 0000000000000..3cbd9f9ce3db6 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/ProductProperties.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging; + + +/** + * The ProductProperties model. + */ +public class ProductProperties { + /** + * The id property. + */ + private Integer id; + + /** + * The name property. + */ + private String name; + + /** + * Get the id value. + * + * @return the id value + */ + public Integer id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the ProductProperties object itself. + */ + public ProductProperties withId(Integer id) { + this.id = id; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the ProductProperties object itself. + */ + public ProductProperties withName(String name) { + this.name = name; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java new file mode 100644 index 0000000000000..6267e92a58e53 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Initializes a new instance of the AutoRestPagingTestServiceImpl class. + */ +public final class AutoRestPagingTestServiceImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestPagingTestServiceImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestPagingTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestPagingTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The PagingsInner object to access its operations. + */ + private PagingsInner pagings; + + /** + * Gets the PagingsInner object to access its operations. + * @return the PagingsInner object. + */ + public PagingsInner pagings() { + return this.pagings; + } + + /** + * Initializes an instance of AutoRestPagingTestService client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestPagingTestServiceImpl(ServiceClientCredentials credentials) { + this("http://localhost", credentials); + } + + /** + * Initializes an instance of AutoRestPagingTestService client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AutoRestPagingTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestPagingTestService client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestPagingTestServiceImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.pagings = new PagingsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestPagingTestService, 1.0.0"); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PageImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PageImpl.java new file mode 100644 index 0000000000000..4a1c2975b0c85 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PageImpl.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("values") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String getNextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List getItems() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PageImpl1.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PageImpl1.java new file mode 100644 index 0000000000000..b59b0cdc5e5c9 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PageImpl1.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("odata.nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("values") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String getNextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List getItems() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetMultiplePagesOptionsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetMultiplePagesOptionsInner.java new file mode 100644 index 0000000000000..a93a6ce734f79 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetMultiplePagesOptionsInner.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for the Paging_getMultiplePages operation. + */ +public class PagingGetMultiplePagesOptionsInner { + /** + * Sets the maximum number of items to return in the response. + */ + @JsonProperty(value = "") + private Integer maxresults; + + /** + * Sets the maximum time that the server can spend processing the request, + * in seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * Get the maxresults value. + * + * @return the maxresults value + */ + public Integer maxresults() { + return this.maxresults; + } + + /** + * Set the maxresults value. + * + * @param maxresults the maxresults value to set + * @return the PagingGetMultiplePagesOptionsInner object itself. + */ + public PagingGetMultiplePagesOptionsInner withMaxresults(Integer maxresults) { + this.maxresults = maxresults; + return this; + } + + /** + * Get the timeout value. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout value. + * + * @param timeout the timeout value to set + * @return the PagingGetMultiplePagesOptionsInner object itself. + */ + public PagingGetMultiplePagesOptionsInner withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetMultiplePagesWithOffsetNextOptionsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetMultiplePagesWithOffsetNextOptionsInner.java new file mode 100644 index 0000000000000..1f809610c5393 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetMultiplePagesWithOffsetNextOptionsInner.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for the getMultiplePagesWithOffsetNext operation. + */ +public class PagingGetMultiplePagesWithOffsetNextOptionsInner { + /** + * Sets the maximum number of items to return in the response. + */ + @JsonProperty(value = "") + private Integer maxresults; + + /** + * Sets the maximum time that the server can spend processing the request, + * in seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * Get the maxresults value. + * + * @return the maxresults value + */ + public Integer maxresults() { + return this.maxresults; + } + + /** + * Set the maxresults value. + * + * @param maxresults the maxresults value to set + * @return the PagingGetMultiplePagesWithOffsetNextOptionsInner object itself. + */ + public PagingGetMultiplePagesWithOffsetNextOptionsInner withMaxresults(Integer maxresults) { + this.maxresults = maxresults; + return this; + } + + /** + * Get the timeout value. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout value. + * + * @param timeout the timeout value to set + * @return the PagingGetMultiplePagesWithOffsetNextOptionsInner object itself. + */ + public PagingGetMultiplePagesWithOffsetNextOptionsInner withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetMultiplePagesWithOffsetOptionsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetMultiplePagesWithOffsetOptionsInner.java new file mode 100644 index 0000000000000..bbf5e3a040787 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetMultiplePagesWithOffsetOptionsInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for the Paging_getMultiplePagesWithOffset operation. + */ +public class PagingGetMultiplePagesWithOffsetOptionsInner { + /** + * Sets the maximum number of items to return in the response. + */ + @JsonProperty(value = "") + private Integer maxresults; + + /** + * Offset of return value. + */ + @JsonProperty(value = "", required = true) + private int offset; + + /** + * Sets the maximum time that the server can spend processing the request, + * in seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * Get the maxresults value. + * + * @return the maxresults value + */ + public Integer maxresults() { + return this.maxresults; + } + + /** + * Set the maxresults value. + * + * @param maxresults the maxresults value to set + * @return the PagingGetMultiplePagesWithOffsetOptionsInner object itself. + */ + public PagingGetMultiplePagesWithOffsetOptionsInner withMaxresults(Integer maxresults) { + this.maxresults = maxresults; + return this; + } + + /** + * Get the offset value. + * + * @return the offset value + */ + public int offset() { + return this.offset; + } + + /** + * Set the offset value. + * + * @param offset the offset value to set + * @return the PagingGetMultiplePagesWithOffsetOptionsInner object itself. + */ + public PagingGetMultiplePagesWithOffsetOptionsInner withOffset(int offset) { + this.offset = offset; + return this; + } + + /** + * Get the timeout value. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout value. + * + * @param timeout the timeout value to set + * @return the PagingGetMultiplePagesWithOffsetOptionsInner object itself. + */ + public PagingGetMultiplePagesWithOffsetOptionsInner withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetOdataMultiplePagesOptionsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetOdataMultiplePagesOptionsInner.java new file mode 100644 index 0000000000000..e4be21f969fb2 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingGetOdataMultiplePagesOptionsInner.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for the Paging_getOdataMultiplePages operation. + */ +public class PagingGetOdataMultiplePagesOptionsInner { + /** + * Sets the maximum number of items to return in the response. + */ + @JsonProperty(value = "") + private Integer maxresults; + + /** + * Sets the maximum time that the server can spend processing the request, + * in seconds. The default is 30 seconds. + */ + @JsonProperty(value = "") + private Integer timeout; + + /** + * Get the maxresults value. + * + * @return the maxresults value + */ + public Integer maxresults() { + return this.maxresults; + } + + /** + * Set the maxresults value. + * + * @param maxresults the maxresults value to set + * @return the PagingGetOdataMultiplePagesOptionsInner object itself. + */ + public PagingGetOdataMultiplePagesOptionsInner withMaxresults(Integer maxresults) { + this.maxresults = maxresults; + return this; + } + + /** + * Get the timeout value. + * + * @return the timeout value + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout value. + * + * @param timeout the timeout value to set + * @return the PagingGetOdataMultiplePagesOptionsInner object itself. + */ + public PagingGetOdataMultiplePagesOptionsInner withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingsInner.java new file mode 100644 index 0000000000000..2c6c71dda0534 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/PagingsInner.java @@ -0,0 +1,1747 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Url; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in Pagings. + */ +public final class PagingsInner { + /** The Retrofit service to perform REST calls. */ + private PagingsService service; + /** The service client containing this operation class. */ + private AutoRestPagingTestServiceImpl client; + + /** + * Initializes an instance of PagingsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PagingsInner(Retrofit retrofit, AutoRestPagingTestServiceImpl client) { + this.service = retrofit.create(PagingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Pagings to be + * used by Retrofit to perform actually REST calls. + */ + interface PagingsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("paging/single") + Call getSinglePages(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("paging/multiple") + Call getMultiplePages(@Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("paging/multiple/odata") + Call getOdataMultiplePages(@Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("paging/multiple/withpath/{offset}") + Call getMultiplePagesWithOffset(@Path("offset") int offset, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("paging/multiple/retryfirst") + Call getMultiplePagesRetryFirst(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("paging/multiple/retrysecond") + Call getMultiplePagesRetrySecond(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("paging/single/failure") + Call getSinglePagesFailure(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("paging/multiple/failure") + Call getMultiplePagesFailure(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("paging/multiple/failureuri") + Call getMultiplePagesFailureUri(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET + Call getSinglePagesNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET + Call getMultiplePagesNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET + Call getOdataMultiplePagesNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET + Call getMultiplePagesWithOffsetNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET + Call getMultiplePagesRetryFirstNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET + Call getMultiplePagesRetrySecondNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET + Call getSinglePagesFailureNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET + Call getMultiplePagesFailureNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET + Call getMultiplePagesFailureUriNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getSinglePages() throws CloudException, IOException { + Call call = service.getSinglePages(this.client.acceptLanguage(), this.client.userAgent()); + ServiceResponse> response = getSinglePagesDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getSinglePagesNext(nextPageLink).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getSinglePagesAsync(final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getSinglePages(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getSinglePagesDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getSinglePagesNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getSinglePagesDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePages() throws CloudException, IOException { + final String clientRequestId = null; + final PagingGetMultiplePagesOptionsInner pagingGetMultiplePagesOptions = null; + Integer maxresults = null; + Integer timeout = null; + Call call = service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + ServiceResponse> response = getMultiplePagesDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getMultiplePagesNext(nextPageLink, null, null).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesAsync(final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String clientRequestId = null; + final PagingGetMultiplePagesOptionsInner pagingGetMultiplePagesOptions = null; + Integer maxresults = null; + Integer timeout = null; + Call call = service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesNextAsync(result.getBody().getNextPageLink(), null, null, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param clientRequestId the String value + * @param pagingGetMultiplePagesOptions Additional parameters for the operation + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePages(final String clientRequestId, final PagingGetMultiplePagesOptionsInner pagingGetMultiplePagesOptions) throws CloudException, IOException { + Validator.validate(pagingGetMultiplePagesOptions); + Integer maxresults = null; + if (pagingGetMultiplePagesOptions != null) { + maxresults = pagingGetMultiplePagesOptions.maxresults(); + } + Integer timeout = null; + if (pagingGetMultiplePagesOptions != null) { + timeout = pagingGetMultiplePagesOptions.timeout(); + } + Call call = service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + ServiceResponse> response = getMultiplePagesDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getMultiplePagesNext(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param clientRequestId the String value + * @param pagingGetMultiplePagesOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesAsync(final String clientRequestId, final PagingGetMultiplePagesOptionsInner pagingGetMultiplePagesOptions, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(pagingGetMultiplePagesOptions, serviceCallback); + Integer maxresults = null; + if (pagingGetMultiplePagesOptions != null) { + maxresults = pagingGetMultiplePagesOptions.maxresults(); + } + Integer timeout = null; + if (pagingGetMultiplePagesOptions != null) { + timeout = pagingGetMultiplePagesOptions.timeout(); + } + Call call = service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesNextAsync(result.getBody().getNextPageLink(), clientRequestId, pagingGetMultiplePagesOptions, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getOdataMultiplePages() throws CloudException, IOException { + final String clientRequestId = null; + final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions = null; + Integer maxresults = null; + Integer timeout = null; + Call call = service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + ServiceResponse> response = getOdataMultiplePagesDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getOdataMultiplePagesNext(nextPageLink, null, null).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getOdataMultiplePagesAsync(final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String clientRequestId = null; + final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions = null; + Integer maxresults = null; + Integer timeout = null; + Call call = service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getOdataMultiplePagesDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getOdataMultiplePagesNextAsync(result.getBody().getNextPageLink(), null, null, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param clientRequestId the String value + * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getOdataMultiplePages(final String clientRequestId, final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions) throws CloudException, IOException { + Validator.validate(pagingGetOdataMultiplePagesOptions); + Integer maxresults = null; + if (pagingGetOdataMultiplePagesOptions != null) { + maxresults = pagingGetOdataMultiplePagesOptions.maxresults(); + } + Integer timeout = null; + if (pagingGetOdataMultiplePagesOptions != null) { + timeout = pagingGetOdataMultiplePagesOptions.timeout(); + } + Call call = service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + ServiceResponse> response = getOdataMultiplePagesDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getOdataMultiplePagesNext(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param clientRequestId the String value + * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getOdataMultiplePagesAsync(final String clientRequestId, final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Validator.validate(pagingGetOdataMultiplePagesOptions, serviceCallback); + Integer maxresults = null; + if (pagingGetOdataMultiplePagesOptions != null) { + maxresults = pagingGetOdataMultiplePagesOptions.maxresults(); + } + Integer timeout = null; + if (pagingGetOdataMultiplePagesOptions != null) { + timeout = pagingGetOdataMultiplePagesOptions.timeout(); + } + Call call = service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getOdataMultiplePagesDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getOdataMultiplePagesNextAsync(result.getBody().getNextPageLink(), clientRequestId, pagingGetOdataMultiplePagesOptions, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getOdataMultiplePagesDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesWithOffset(final PagingGetMultiplePagesWithOffsetOptionsInner pagingGetMultiplePagesWithOffsetOptions) throws CloudException, IOException, IllegalArgumentException { + if (pagingGetMultiplePagesWithOffsetOptions == null) { + throw new IllegalArgumentException("Parameter pagingGetMultiplePagesWithOffsetOptions is required and cannot be null."); + } + Validator.validate(pagingGetMultiplePagesWithOffsetOptions); + final String clientRequestId = null; + Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults(); + int offset = pagingGetMultiplePagesWithOffsetOptions.offset(); + Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout(); + Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + ServiceResponse> response = getMultiplePagesWithOffsetDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + PagingGetMultiplePagesWithOffsetNextOptionsInner pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptionsInner(); + pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults()); + pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout()); + return getMultiplePagesWithOffsetNext(nextPageLink, null, null).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesWithOffsetAsync(final PagingGetMultiplePagesWithOffsetOptionsInner pagingGetMultiplePagesWithOffsetOptions, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (pagingGetMultiplePagesWithOffsetOptions == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter pagingGetMultiplePagesWithOffsetOptions is required and cannot be null.")); + return null; + } + Validator.validate(pagingGetMultiplePagesWithOffsetOptions, serviceCallback); + final String clientRequestId = null; + Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults(); + int offset = pagingGetMultiplePagesWithOffsetOptions.offset(); + Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout(); + Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesWithOffsetDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + PagingGetMultiplePagesWithOffsetNextOptionsInner pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptionsInner(); + pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults()); + pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout()); + getMultiplePagesWithOffsetNextAsync(result.getBody().getNextPageLink(), null, null, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation + * @param clientRequestId the String value + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesWithOffset(final PagingGetMultiplePagesWithOffsetOptionsInner pagingGetMultiplePagesWithOffsetOptions, final String clientRequestId) throws CloudException, IOException, IllegalArgumentException { + if (pagingGetMultiplePagesWithOffsetOptions == null) { + throw new IllegalArgumentException("Parameter pagingGetMultiplePagesWithOffsetOptions is required and cannot be null."); + } + Validator.validate(pagingGetMultiplePagesWithOffsetOptions); + Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults(); + int offset = pagingGetMultiplePagesWithOffsetOptions.offset(); + Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout(); + Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + ServiceResponse> response = getMultiplePagesWithOffsetDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + PagingGetMultiplePagesWithOffsetNextOptionsInner pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptionsInner(); + pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults()); + pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout()); + return getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation + * @param clientRequestId the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesWithOffsetAsync(final PagingGetMultiplePagesWithOffsetOptionsInner pagingGetMultiplePagesWithOffsetOptions, final String clientRequestId, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (pagingGetMultiplePagesWithOffsetOptions == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter pagingGetMultiplePagesWithOffsetOptions is required and cannot be null.")); + return null; + } + Validator.validate(pagingGetMultiplePagesWithOffsetOptions, serviceCallback); + Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults(); + int offset = pagingGetMultiplePagesWithOffsetOptions.offset(); + Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout(); + Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesWithOffsetDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + PagingGetMultiplePagesWithOffsetNextOptionsInner pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptionsInner(); + pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults()); + pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout()); + getMultiplePagesWithOffsetNextAsync(result.getBody().getNextPageLink(), clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesWithOffsetDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesRetryFirst() throws CloudException, IOException { + Call call = service.getMultiplePagesRetryFirst(this.client.acceptLanguage(), this.client.userAgent()); + ServiceResponse> response = getMultiplePagesRetryFirstDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getMultiplePagesRetryFirstNext(nextPageLink).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesRetryFirstAsync(final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getMultiplePagesRetryFirst(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesRetryFirstDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesRetryFirstNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesRetryFirstDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesRetrySecond() throws CloudException, IOException { + Call call = service.getMultiplePagesRetrySecond(this.client.acceptLanguage(), this.client.userAgent()); + ServiceResponse> response = getMultiplePagesRetrySecondDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getMultiplePagesRetrySecondNext(nextPageLink).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesRetrySecondAsync(final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getMultiplePagesRetrySecond(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesRetrySecondDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesRetrySecondNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesRetrySecondDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that receives a 400 on the first call. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getSinglePagesFailure() throws CloudException, IOException { + Call call = service.getSinglePagesFailure(this.client.acceptLanguage(), this.client.userAgent()); + ServiceResponse> response = getSinglePagesFailureDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getSinglePagesFailureNext(nextPageLink).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that receives a 400 on the first call. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getSinglePagesFailureAsync(final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getSinglePagesFailure(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getSinglePagesFailureDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getSinglePagesFailureNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getSinglePagesFailureDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that receives a 400 on the second call. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesFailure() throws CloudException, IOException { + Call call = service.getMultiplePagesFailure(this.client.acceptLanguage(), this.client.userAgent()); + ServiceResponse> response = getMultiplePagesFailureDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getMultiplePagesFailureNext(nextPageLink).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that receives a 400 on the second call. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesFailureAsync(final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getMultiplePagesFailure(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesFailureDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesFailureNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesFailureDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that receives an invalid nextLink. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesFailureUri() throws CloudException, IOException { + Call call = service.getMultiplePagesFailureUri(this.client.acceptLanguage(), this.client.userAgent()); + ServiceResponse> response = getMultiplePagesFailureUriDelegate(call.execute()); + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getMultiplePagesFailureUriNext(nextPageLink).getBody(); + } + }; + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * A paging operation that receives an invalid nextLink. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesFailureUriAsync(final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getMultiplePagesFailureUri(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesFailureUriDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesFailureUriNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesFailureUriDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getSinglePagesNext(final String nextPageLink) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Call call = service.getSinglePagesNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + return getSinglePagesNextDelegate(call.execute()); + } + + /** + * A paging operation that finishes on the first call without a nextlink. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getSinglePagesNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + Call call = service.getSinglePagesNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getSinglePagesNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getSinglePagesNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getSinglePagesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesNext(final String nextPageLink) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final String clientRequestId = null; + final PagingGetMultiplePagesOptionsInner pagingGetMultiplePagesOptions = null; + Integer maxresults = null; + Integer timeout = null; + Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + return getMultiplePagesNextDelegate(call.execute()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + final String clientRequestId = null; + final PagingGetMultiplePagesOptionsInner pagingGetMultiplePagesOptions = null; + Integer maxresults = null; + Integer timeout = null; + Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesNextAsync(result.getBody().getNextPageLink(), null, null, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param clientRequestId the String value + * @param pagingGetMultiplePagesOptions Additional parameters for the operation + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesNext(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesOptionsInner pagingGetMultiplePagesOptions) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(pagingGetMultiplePagesOptions); + Integer maxresults = null; + if (pagingGetMultiplePagesOptions != null) { + maxresults = pagingGetMultiplePagesOptions.maxresults(); + } + Integer timeout = null; + if (pagingGetMultiplePagesOptions != null) { + timeout = pagingGetMultiplePagesOptions.timeout(); + } + Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + return getMultiplePagesNextDelegate(call.execute()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param clientRequestId the String value + * @param pagingGetMultiplePagesOptions Additional parameters for the operation + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesNextAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesOptionsInner pagingGetMultiplePagesOptions, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + Validator.validate(pagingGetMultiplePagesOptions, serviceCallback); + Integer maxresults = null; + if (pagingGetMultiplePagesOptions != null) { + maxresults = pagingGetMultiplePagesOptions.maxresults(); + } + Integer timeout = null; + if (pagingGetMultiplePagesOptions != null) { + timeout = pagingGetMultiplePagesOptions.timeout(); + } + Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesNextAsync(result.getBody().getNextPageLink(), clientRequestId, pagingGetMultiplePagesOptions, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getOdataMultiplePagesNext(final String nextPageLink) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final String clientRequestId = null; + final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions = null; + Integer maxresults = null; + Integer timeout = null; + Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + return getOdataMultiplePagesNextDelegate(call.execute()); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getOdataMultiplePagesNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + final String clientRequestId = null; + final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions = null; + Integer maxresults = null; + Integer timeout = null; + Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getOdataMultiplePagesNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getOdataMultiplePagesNextAsync(result.getBody().getNextPageLink(), null, null, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param clientRequestId the String value + * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getOdataMultiplePagesNext(final String nextPageLink, final String clientRequestId, final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(pagingGetOdataMultiplePagesOptions); + Integer maxresults = null; + if (pagingGetOdataMultiplePagesOptions != null) { + maxresults = pagingGetOdataMultiplePagesOptions.maxresults(); + } + Integer timeout = null; + if (pagingGetOdataMultiplePagesOptions != null) { + timeout = pagingGetOdataMultiplePagesOptions.timeout(); + } + Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + return getOdataMultiplePagesNextDelegate(call.execute()); + } + + /** + * A paging operation that includes a nextLink in odata format that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param clientRequestId the String value + * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getOdataMultiplePagesNextAsync(final String nextPageLink, final String clientRequestId, final PagingGetOdataMultiplePagesOptionsInner pagingGetOdataMultiplePagesOptions, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + Validator.validate(pagingGetOdataMultiplePagesOptions, serviceCallback); + Integer maxresults = null; + if (pagingGetOdataMultiplePagesOptions != null) { + maxresults = pagingGetOdataMultiplePagesOptions.maxresults(); + } + Integer timeout = null; + if (pagingGetOdataMultiplePagesOptions != null) { + timeout = pagingGetOdataMultiplePagesOptions.timeout(); + } + Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getOdataMultiplePagesNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getOdataMultiplePagesNextAsync(result.getBody().getNextPageLink(), clientRequestId, pagingGetOdataMultiplePagesOptions, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getOdataMultiplePagesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesWithOffsetNext(final String nextPageLink) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + final String clientRequestId = null; + final PagingGetMultiplePagesWithOffsetNextOptionsInner pagingGetMultiplePagesWithOffsetNextOptions = null; + Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.maxresults(); + Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.timeout(); + Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + return getMultiplePagesWithOffsetNextDelegate(call.execute()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesWithOffsetNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + final String clientRequestId = null; + final PagingGetMultiplePagesWithOffsetNextOptionsInner pagingGetMultiplePagesWithOffsetNextOptions = null; + Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.maxresults(); + Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.timeout(); + Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesWithOffsetNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesWithOffsetNextAsync(result.getBody().getNextPageLink(), null, null, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param clientRequestId the String value + * @param pagingGetMultiplePagesWithOffsetNextOptions Additional parameters for the operation + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesWithOffsetNext(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesWithOffsetNextOptionsInner pagingGetMultiplePagesWithOffsetNextOptions) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Validator.validate(pagingGetMultiplePagesWithOffsetNextOptions); + Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.maxresults(); + Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.timeout(); + Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + return getMultiplePagesWithOffsetNextDelegate(call.execute()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param clientRequestId the String value + * @param pagingGetMultiplePagesWithOffsetNextOptions Additional parameters for the operation + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesWithOffsetNextAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesWithOffsetNextOptionsInner pagingGetMultiplePagesWithOffsetNextOptions, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + Validator.validate(pagingGetMultiplePagesWithOffsetNextOptions, serviceCallback); + Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.maxresults(); + Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.timeout(); + Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesWithOffsetNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesWithOffsetNextAsync(result.getBody().getNextPageLink(), clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions, serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesWithOffsetNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesRetryFirstNext(final String nextPageLink) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Call call = service.getMultiplePagesRetryFirstNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + return getMultiplePagesRetryFirstNextDelegate(call.execute()); + } + + /** + * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesRetryFirstNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + Call call = service.getMultiplePagesRetryFirstNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesRetryFirstNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesRetryFirstNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesRetryFirstNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesRetrySecondNext(final String nextPageLink) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Call call = service.getMultiplePagesRetrySecondNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + return getMultiplePagesRetrySecondNextDelegate(call.execute()); + } + + /** + * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesRetrySecondNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + Call call = service.getMultiplePagesRetrySecondNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesRetrySecondNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesRetrySecondNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesRetrySecondNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that receives a 400 on the first call. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getSinglePagesFailureNext(final String nextPageLink) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Call call = service.getSinglePagesFailureNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + return getSinglePagesFailureNextDelegate(call.execute()); + } + + /** + * A paging operation that receives a 400 on the first call. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getSinglePagesFailureNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + Call call = service.getSinglePagesFailureNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getSinglePagesFailureNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getSinglePagesFailureNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getSinglePagesFailureNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that receives a 400 on the second call. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesFailureNext(final String nextPageLink) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Call call = service.getMultiplePagesFailureNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + return getMultiplePagesFailureNextDelegate(call.execute()); + } + + /** + * A paging operation that receives a 400 on the second call. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesFailureNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + Call call = service.getMultiplePagesFailureNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesFailureNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesFailureNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesFailureNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * A paging operation that receives an invalid nextLink. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getMultiplePagesFailureUriNext(final String nextPageLink) throws CloudException, IOException, IllegalArgumentException { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + Call call = service.getMultiplePagesFailureUriNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + return getMultiplePagesFailureUriNextDelegate(call.execute()); + } + + /** + * A paging operation that receives an invalid nextLink. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMultiplePagesFailureUriNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (nextPageLink == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + return null; + } + Call call = service.getMultiplePagesFailureUriNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); + serviceCall.newCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getMultiplePagesFailureUriNextDelegate(response); + serviceCallback.load(result.getBody().getItems()); + if (result.getBody().getNextPageLink() != null + && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { + getMultiplePagesFailureUriNextAsync(result.getBody().getNextPageLink(), serviceCall, serviceCallback); + } else { + serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); + } + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getMultiplePagesFailureUriNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/ProductInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/ProductInner.java new file mode 100644 index 0000000000000..c07bb62b4891c --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/ProductInner.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.paging.implementation; + +import fixtures.paging.ProductProperties; + +/** + * The ProductInner model. + */ +public class ProductInner { + /** + * The properties property. + */ + private ProductProperties properties; + + /** + * Get the properties value. + * + * @return the properties value + */ + public ProductProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the ProductInner object itself. + */ + public ProductInner withProperties(ProductProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/package-info.java new file mode 100644 index 0000000000000..2a185d97351ec --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestPagingTestService. + * Long-running Operation for AutoRest. + */ +package fixtures.paging.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/package-info.java new file mode 100644 index 0000000000000..97f3ff652ae88 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/paging/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for AutoRestPagingTestService. + * Long-running Operation for AutoRest. + */ +package fixtures.paging; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/Error.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/Error.java new file mode 100644 index 0000000000000..57311791de025 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/Error.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.subscriptionidapiversion; + + +/** + * The Error model. + */ +public class Error { + /** + * The code property. + */ + private Integer code; + + /** + * The message property. + */ + private String message; + + /** + * Get the code value. + * + * @return the code value + */ + public Integer code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the Error object itself. + */ + public Error withCode(Integer code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/ErrorException.java new file mode 100644 index 0000000000000..e16a19297d6b0 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/ErrorException.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.subscriptionidapiversion; + +import com.microsoft.rest.RestException; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with Error information. + */ +public class ErrorException extends RestException { + /** + * Information about the associated HTTP response. + */ + private Response response; + /** + * The actual response body. + */ + private Error body; + /** + * Initializes a new instance of the ErrorException class. + */ + public ErrorException() { } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message The exception message. + */ + public ErrorException(final String message) { + super(message); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message + * @param cause exception that caused this exception to occur + */ + public ErrorException(final String message, final Throwable cause) { + super(message, cause); + } + /** + * Initializes a new instance of the ErrorException class. + * + * @param cause exception that caused this exception to occur + */ + public ErrorException(final Throwable cause) { + super(cause); + } + /** + * Gets information about the associated HTTP response. + * + * @return the HTTP response + */ + public Response getResponse() { + return response; + } + /** + * Gets the HTTP response body. + * + * @return the response body + */ + public Error getBody() { + return body; + } + /** + * Sets the HTTP response. + * + * @param response the HTTP response + */ + public void setResponse(Response response) { + this.response = response; + } + /** + * Sets the HTTP response body. + * + * @param body the response body + */ + public void setBody(Error body) { + this.body = body; + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/GroupsInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/GroupsInner.java new file mode 100644 index 0000000000000..865b9d48cb6d5 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/GroupsInner.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.subscriptionidapiversion.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.subscriptionidapiversion.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in Groups. + */ +public final class GroupsInner { + /** The Retrofit service to perform REST calls. */ + private GroupsService service; + /** The service client containing this operation class. */ + private MicrosoftAzureTestUrlImpl client; + + /** + * Initializes an instance of GroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GroupsInner(Retrofit retrofit, MicrosoftAzureTestUrlImpl client) { + this.service = retrofit.create(GroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Groups to be + * used by Retrofit to perform actually REST calls. + */ + interface GroupsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + Call getSampleResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Provides a resouce group with name 'testgroup101' and location 'West US'. + * + * @param resourceGroupName Resource Group name 'testgroup101'. + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the SampleResourceGroupInner object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse getSampleResourceGroup(String resourceGroupName) throws ErrorException, IOException, IllegalArgumentException { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Call call = service.getSampleResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return getSampleResourceGroupDelegate(call.execute()); + } + + /** + * Provides a resouce group with name 'testgroup101' and location 'West US'. + * + * @param resourceGroupName Resource Group name 'testgroup101'. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getSampleResourceGroupAsync(String resourceGroupName, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); + return null; + } + if (resourceGroupName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + return null; + } + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); + return null; + } + Call call = service.getSampleResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getSampleResourceGroupDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getSampleResourceGroupDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/MicrosoftAzureTestUrlImpl.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/MicrosoftAzureTestUrlImpl.java new file mode 100644 index 0000000000000..b3b059e78cd1b --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/MicrosoftAzureTestUrlImpl.java @@ -0,0 +1,202 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.subscriptionidapiversion.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Initializes a new instance of the MicrosoftAzureTestUrlImpl class. + */ +public final class MicrosoftAzureTestUrlImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Subscription Id. */ + private String subscriptionId; + + /** + * Gets Subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public MicrosoftAzureTestUrlImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** API Version with value '2014-04-01-preview'. */ + private String apiVersion; + + /** + * Gets API Version with value '2014-04-01-preview'. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MicrosoftAzureTestUrlImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public MicrosoftAzureTestUrlImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public MicrosoftAzureTestUrlImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The GroupsInner object to access its operations. + */ + private GroupsInner groups; + + /** + * Gets the GroupsInner object to access its operations. + * @return the GroupsInner object. + */ + public GroupsInner groups() { + return this.groups; + } + + /** + * Initializes an instance of MicrosoftAzureTestUrl client. + * + * @param credentials the management credentials for Azure + */ + public MicrosoftAzureTestUrlImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com/", credentials); + } + + /** + * Initializes an instance of MicrosoftAzureTestUrl client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MicrosoftAzureTestUrlImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of MicrosoftAzureTestUrl client. + * + * @param restClient the REST client to connect to Azure. + */ + public MicrosoftAzureTestUrlImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2014-04-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.groups = new GroupsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "MicrosoftAzureTestUrl, 2014-04-01-preview"); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/SampleResourceGroupInner.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/SampleResourceGroupInner.java new file mode 100644 index 0000000000000..3d7431ef7312c --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/SampleResourceGroupInner.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.subscriptionidapiversion.implementation; + + +/** + * The SampleResourceGroupInner model. + */ +public class SampleResourceGroupInner { + /** + * resource group name 'testgroup101'. + */ + private String name; + + /** + * resource group location 'West US'. + */ + private String location; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the SampleResourceGroupInner object itself. + */ + public SampleResourceGroupInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the SampleResourceGroupInner object itself. + */ + public SampleResourceGroupInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/package-info.java new file mode 100644 index 0000000000000..c4f55dd890a9d --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for MicrosoftAzureTestUrl. + * Some cool documentation. + */ +package fixtures.subscriptionidapiversion.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/package-info.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/package-info.java new file mode 100644 index 0000000000000..f637222862141 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java/fixtures/subscriptionidapiversion/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the classes for MicrosoftAzureTestUrl. + * Some cool documentation. + */ +package fixtures.subscriptionidapiversion; diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurecustombaseuri/AzureCustomBaseUriTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurecustombaseuri/AzureCustomBaseUriTests.java new file mode 100644 index 0000000000000..50219b7056e63 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurecustombaseuri/AzureCustomBaseUriTests.java @@ -0,0 +1,65 @@ +package fixtures.azurecustombaseuri; + +import com.microsoft.rest.credentials.TokenCredentials; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.net.UnknownHostException; +import java.util.UUID; + +import fixtures.custombaseuri.implementation.AutoRestParameterizedHostTestClientImpl; + +public class AzureCustomBaseUriTests { + private static AutoRestParameterizedHostTestClientImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestParameterizedHostTestClientImpl(new TokenCredentials(null, UUID.randomUUID().toString())); + } + + // Positive test case + @Test + public void getEmptyWithValidCustomUri() throws Exception { + client.withHost("host:3000"); + Assert.assertTrue(client.paths().getEmpty("local").getResponse().isSuccessful()); + } + + @Test + public void getEmptyWithInvalidCustomUriAccountName() throws Exception { + try { + client.paths().getEmpty("bad"); + Assert.assertTrue(false); + } + catch (UnknownHostException e) { + Assert.assertTrue(true); + } + } + + @Test + public void getEmptyWithInvalidCustomUriHostName() throws Exception { + try { + client.withHost("badhost"); + client.paths().getEmpty("local"); + Assert.assertTrue(false); + } + catch (UnknownHostException e) { + Assert.assertTrue(true); + } + finally { + client.withHost("host.:3000"); + } + } + + @Test + public void getEmptyWithEmptyCustomUriAccountName() throws Exception { + try { + client.paths().getEmpty(null); + Assert.assertTrue(false); + } + catch (IllegalArgumentException e) { + Assert.assertTrue(true); + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azureparametergrouping/ParameterGroupingTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azureparametergrouping/ParameterGroupingTests.java new file mode 100644 index 0000000000000..38dbd83b7ec79 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azureparametergrouping/ParameterGroupingTests.java @@ -0,0 +1,59 @@ +package fixtures.azureparametergrouping; + +import com.microsoft.rest.ServiceResponse; + +import org.junit.BeforeClass; +import org.junit.Test; + +import fixtures.azureparametergrouping.implementation.AutoRestParameterGroupingTestServiceImpl; +import fixtures.azureparametergrouping.implementation.FirstParameterGroupInner; +import fixtures.azureparametergrouping.implementation.ParameterGroupingPostMultiParamGroupsSecondParamGroupInner; +import fixtures.azureparametergrouping.implementation.ParameterGroupingPostOptionalParametersInner; +import fixtures.azureparametergrouping.implementation.ParameterGroupingPostRequiredParametersInner; + + +public class ParameterGroupingTests { + private static AutoRestParameterGroupingTestServiceImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestParameterGroupingTestServiceImpl("http://localhost.:3000", null); + } + + @Test + public void postRequired() throws Exception { + ParameterGroupingPostRequiredParametersInner params = new ParameterGroupingPostRequiredParametersInner(); + params.withBody(1234); + params.withPath("path"); + params.withQuery(21); + params.withCustomHeader("header"); + ServiceResponse group = client.parameterGroupings().postRequired(params); + } + + @Test + public void postOptional() throws Exception { + ParameterGroupingPostOptionalParametersInner params = new ParameterGroupingPostOptionalParametersInner(); + params.withQuery(21); + params.withCustomHeader("header"); + ServiceResponse group = client.parameterGroupings().postOptional(params); + } + + @Test + public void postMultipleParameterGroups() throws Exception { + FirstParameterGroupInner first = new FirstParameterGroupInner(); + first.withQueryOne(21); + first.withHeaderOne("header"); + ParameterGroupingPostMultiParamGroupsSecondParamGroupInner second = new ParameterGroupingPostMultiParamGroupsSecondParamGroupInner(); + second.withHeaderTwo("header2"); + second.withQueryTwo(42); + ServiceResponse group = client.parameterGroupings().postMultiParamGroups(first, second); + } + + @Test + public void postParameterGroupWithSharedParameter() throws Exception { + FirstParameterGroupInner first = new FirstParameterGroupInner(); + first.withQueryOne(21); + first.withHeaderOne("header"); + ServiceResponse group = client.parameterGroupings().postSharedParameterGroupObject(first); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurereport/CoverageReporter.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurereport/CoverageReporter.java new file mode 100644 index 0000000000000..89eebfb07d165 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurereport/CoverageReporter.java @@ -0,0 +1,40 @@ +package fixtures.azurereport; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import fixtures.azurereport.implementation.AutoRestReportServiceForAzureImpl; + +public final class CoverageReporter { + private static AutoRestReportServiceForAzureImpl client = new AutoRestReportServiceForAzureImpl("http://localhost:3000", null); + + private CoverageReporter() { } + + public static void main(String[] args) throws Exception { + Map report = client.getReport().getBody(); + + // Pending URL encoding + report.put("AzureMethodPathUrlEncoding", 1); + report.put("AzurePathPathUrlEncoding", 1); + report.put("AzureSwaggerPathUrlEncoding", 1); + report.put("AzureMethodQueryUrlEncoding", 1); + report.put("AzurePathQueryUrlEncoding", 1); + report.put("AzureSwaggerQueryUrlEncoding", 1); + + int total = report.size(); + int hit = 0; + List missing = new ArrayList(); + for (Map.Entry entry : report.entrySet()) { + if (entry.getValue() != 0) { + hit++; + } else { + missing.add(entry.getKey()); + } + } + System.out.println(hit + " out of " + total + " tests hit. Missing tests:"); + for (String scenario : missing) { + System.out.println(scenario); + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/ApiVersionDefaultTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/ApiVersionDefaultTests.java new file mode 100644 index 0000000000000..89185ca280ca0 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/ApiVersionDefaultTests.java @@ -0,0 +1,41 @@ +package fixtures.azurespecials; + +import com.microsoft.rest.ServiceResponse; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + +public class ApiVersionDefaultTests { + private static AutoRestAzureSpecialParametersTestClientImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestAzureSpecialParametersTestClientImpl("http://localhost.:3000", null); + } + + @Test + public void getMethodGlobalValid() throws Exception { + ServiceResponse response = client.apiVersionDefaults().getMethodGlobalValid(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void getMethodGlobalNotProvidedValid() throws Exception { + ServiceResponse response = client.apiVersionDefaults().getMethodGlobalNotProvidedValid(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void getPathGlobalValid() throws Exception { + ServiceResponse response = client.apiVersionDefaults().getPathGlobalValid(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void getSwaggerGlobalValid() throws Exception { + ServiceResponse response = client.apiVersionDefaults().getSwaggerGlobalValid(); + Assert.assertEquals(200, response.getResponse().code()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/ApiVersionLocalTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/ApiVersionLocalTests.java new file mode 100644 index 0000000000000..1c730d6f66e22 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/ApiVersionLocalTests.java @@ -0,0 +1,41 @@ +package fixtures.azurespecials; + +import com.microsoft.rest.ServiceResponse; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + +public class ApiVersionLocalTests { + private static AutoRestAzureSpecialParametersTestClientImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestAzureSpecialParametersTestClientImpl("http://localhost.:3000", null); + } + + @Test + public void getMethodLocalValid() throws Exception { + ServiceResponse response = client.apiVersionLocals().getMethodLocalValid(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void getMethodGlobalNotProvidedValid() throws Exception { + ServiceResponse response = client.apiVersionLocals().getMethodLocalNull(null); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void getPathGlobalValid() throws Exception { + ServiceResponse response = client.apiVersionLocals().getPathLocalValid(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void getSwaggerGlobalValid() throws Exception { + ServiceResponse response = client.apiVersionLocals().getSwaggerLocalValid(); + Assert.assertEquals(200, response.getResponse().code()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/HeaderOperationsTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/HeaderOperationsTests.java new file mode 100644 index 0000000000000..77b4b9b5a2f5a --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/HeaderOperationsTests.java @@ -0,0 +1,27 @@ +package fixtures.azurespecials; + +import com.microsoft.rest.ServiceResponseWithHeaders; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; +import fixtures.azurespecials.implementation.HeaderCustomNamedRequestIdHeadersInner; + + +public class HeaderOperationsTests { + private static AutoRestAzureSpecialParametersTestClientImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestAzureSpecialParametersTestClientImpl("http://localhost.:3000", null); + } + + @Test + public void customNamedRequestId() throws Exception { + ServiceResponseWithHeaders response = client.headers().customNamedRequestId("9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("123", response.getHeaders().fooRequestId()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/SkipUrlEncodingTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/SkipUrlEncodingTests.java new file mode 100644 index 0000000000000..f4f214e2f3936 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/SkipUrlEncodingTests.java @@ -0,0 +1,65 @@ +package fixtures.azurespecials; + +import com.microsoft.rest.ServiceResponse; + +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; +import fixtures.azurespecials.implementation.SkipUrlEncodingsInner; + + +public class SkipUrlEncodingTests { + private static final int OK_STATUS_CODE = 200; + private static final int NOT_FOUND_STATUS_CODE = 404; + + private static String baseUrl = "http://localhost.:3000"; + private static String unencodedPath = "path1/path2/path3"; + private static String unencodedQuery = "value1&q2=value2&q3=value3"; + + private static SkipUrlEncodingsInner client; + + @BeforeClass + public static void setup() { + client = new AutoRestAzureSpecialParametersTestClientImpl(baseUrl, null).skipUrlEncodings(); + } + + @Ignore("wait for this release -- https://github.com/square/retrofit/commit/2ea70568bd057fa9235ae5183cebbde1659af84d") + public void getMethodPathValid() throws Exception { + ServiceResponse response = client.getMethodPathValid(unencodedPath); + // Will throw ServiceException if not 200. + //Assert.assertEquals(OK_STATUS_CODE, response.getResponse().code()); + } + + @Ignore("wait for this release -- https://github.com/square/retrofit/commit/2ea70568bd057fa9235ae5183cebbde1659af84d") + public void getPathPathValid() throws Exception { + ServiceResponse response = client.getPathPathValid(unencodedPath); + } + + @Ignore("wait for this release -- https://github.com/square/retrofit/commit/2ea70568bd057fa9235ae5183cebbde1659af84d") + public void getSwaggerPathValid() throws Exception { + ServiceResponse response = client.getSwaggerPathValid(); + } + + @Ignore("wait for this release -- https://github.com/square/retrofit/commit/2ea70568bd057fa9235ae5183cebbde1659af84d") + public void getMethodQueryValid() throws Exception { + ServiceResponse response = client.getMethodQueryValid(unencodedQuery); + } + + @Ignore("wait for this release -- https://github.com/square/retrofit/commit/2ea70568bd057fa9235ae5183cebbde1659af84d") + public void getPathQueryValid() throws Exception { + ServiceResponse response = client.getPathQueryValid(unencodedQuery); + } + + @Ignore("wait for this release -- https://github.com/square/retrofit/commit/2ea70568bd057fa9235ae5183cebbde1659af84d") + public void getSwaggerQueryValid() throws Exception { + ServiceResponse response = client.getSwaggerQueryValid(); + } + + @Test + public void getMethodQueryNull() throws Exception { + ServiceResponse response = client.getMethodQueryNull(null); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/SubscriptionInCredentialsTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/SubscriptionInCredentialsTests.java new file mode 100644 index 0000000000000..6a8397cf86fbe --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/SubscriptionInCredentialsTests.java @@ -0,0 +1,53 @@ +package fixtures.azurespecials; + +import com.microsoft.azure.RequestIdHeaderInterceptor; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.credentials.TokenCredentials; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.UUID; + +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + +public class SubscriptionInCredentialsTests { + private static AutoRestAzureSpecialParametersTestClientImpl client; + + @BeforeClass + public static void setup() { + RestClient restClient = new RestClient.Builder() + .withBaseUrl("http://localhost:3000") + .withCredentials(new TokenCredentials(null, UUID.randomUUID().toString())) + .withInterceptor(new RequestIdHeaderInterceptor()) + .build(); + client = new AutoRestAzureSpecialParametersTestClientImpl(restClient); + client.withSubscriptionId("1234-5678-9012-3456"); + } + + @Test + public void postMethodGlobalValid() throws Exception { + ServiceResponse response = client.subscriptionInCredentials().postMethodGlobalValid(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void postMethodGlobalNotProvidedValid() throws Exception { + ServiceResponse response = client.subscriptionInCredentials().postMethodGlobalNotProvidedValid(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void postPathGlobalValid() throws Exception { + ServiceResponse response = client.subscriptionInCredentials().postPathGlobalValid(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void postSwaggerGlobalValid() throws Exception { + ServiceResponse response = client.subscriptionInCredentials().postSwaggerGlobalValid(); + Assert.assertEquals(200, response.getResponse().code()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/SubscriptionInMethodTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/SubscriptionInMethodTests.java new file mode 100644 index 0000000000000..94a835318b306 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/SubscriptionInMethodTests.java @@ -0,0 +1,59 @@ +package fixtures.azurespecials; + +import com.microsoft.azure.RequestIdHeaderInterceptor; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.credentials.TokenCredentials; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.UUID; + +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + +import static org.junit.Assert.fail; + +public class SubscriptionInMethodTests { + private static AutoRestAzureSpecialParametersTestClientImpl client; + + @BeforeClass + public static void setup() { + RestClient restClient = new RestClient.Builder() + .withBaseUrl("http://localhost:3000") + .withCredentials(new TokenCredentials(null, UUID.randomUUID().toString())) + .withInterceptor(new RequestIdHeaderInterceptor()) + .build(); + client = new AutoRestAzureSpecialParametersTestClientImpl(restClient); + client.withSubscriptionId("1234-5678-9012-3456"); + } + + @Test + public void postMethodLocalValid() throws Exception { + ServiceResponse response = client.subscriptionInMethods().postMethodLocalValid("1234-5678-9012-3456"); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void postMethodLocalNull() throws Exception { + try { + ServiceResponse response = client.subscriptionInMethods().postMethodLocalNull(null); + fail(); + } catch (IllegalArgumentException ex) { + Assert.assertTrue(ex.getMessage().contains("Parameter subscriptionId is required")); + } + } + + @Test + public void postPathLocalValid() throws Exception { + ServiceResponse response = client.subscriptionInMethods().postPathLocalValid("1234-5678-9012-3456"); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void postSwaggerLocalValid() throws Exception { + ServiceResponse response = client.subscriptionInMethods().postSwaggerLocalValid("1234-5678-9012-3456"); + Assert.assertEquals(200, response.getResponse().code()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/XMsClientRequestIdTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/XMsClientRequestIdTests.java new file mode 100644 index 0000000000000..ecdb2d3b0775b --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/azurespecials/XMsClientRequestIdTests.java @@ -0,0 +1,38 @@ +package fixtures.azurespecials; + +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.credentials.TokenCredentials; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.UUID; + +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + +public class XMsClientRequestIdTests { + private static AutoRestAzureSpecialParametersTestClientImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestAzureSpecialParametersTestClientImpl("http://localhost.:3000", new TokenCredentials(null, UUID.randomUUID().toString())); + client.withSubscriptionId("1234-5678-9012-3456"); + } + + @Test + public void get() throws Exception { + client.restClient().headers().removeHeader("x-ms-client-request-id"); + client.restClient().headers().addHeader("x-ms-client-request-id", "9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); + ServiceResponse response = client.xMsClientRequestIds().get(); + client.restClient().headers().removeHeader("x-ms-client-request-id"); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void paramGet() throws Exception { + client.restClient().headers().removeHeader("x-ms-client-request-id"); + ServiceResponse response = client.xMsClientRequestIds().paramGet("9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); + Assert.assertEquals(200, response.getResponse().code()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/head/HttpSuccessTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/head/HttpSuccessTests.java new file mode 100644 index 0000000000000..c4fa2ef9567a4 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/head/HttpSuccessTests.java @@ -0,0 +1,31 @@ +package fixtures.head; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import fixtures.head.implementation.AutoRestHeadTestServiceImpl; + +public class HttpSuccessTests { + private static AutoRestHeadTestServiceImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestHeadTestServiceImpl("http://localhost.:3000", null); + } + + @Test + public void head200() throws Exception { + Assert.assertTrue(client.httpSuccess().head200().getBody()); + } + + @Test + public void head204() throws Exception { + Assert.assertTrue(client.httpSuccess().head204().getBody()); + } + + @Test + public void head404() throws Exception { + Assert.assertFalse(client.httpSuccess().head404().getBody()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/headexceptions/HeadExceptionTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/headexceptions/HeadExceptionTests.java new file mode 100644 index 0000000000000..612a30a0e1267 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/headexceptions/HeadExceptionTests.java @@ -0,0 +1,31 @@ +package fixtures.headexceptions; + +import com.microsoft.rest.ServiceException; +import org.junit.BeforeClass; +import org.junit.Test; + +import fixtures.headexceptions.implementation.AutoRestHeadExceptionTestServiceImpl; + +public class HeadExceptionTests { + private static AutoRestHeadExceptionTestServiceImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestHeadExceptionTestServiceImpl("http://localhost.:3000", null); + } + + @Test + public void headException200() throws Exception { + client.headExceptions().head200(); + } + + @Test + public void headException204() throws Exception { + client.headExceptions().head204(); + } + + @Test(expected = ServiceException.class) + public void headException404() throws Exception { + client.headExceptions().head404(); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LRORetrysTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LRORetrysTests.java new file mode 100644 index 0000000000000..f5a16cb928337 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LRORetrysTests.java @@ -0,0 +1,74 @@ +package fixtures.lro; + +import com.microsoft.rest.ServiceResponse; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import fixtures.lro.implementation.AutoRestLongRunningOperationTestServiceImpl; +import fixtures.lro.implementation.ProductInner; + + +public class LRORetrysTests { + private static AutoRestLongRunningOperationTestServiceImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestLongRunningOperationTestServiceImpl("http://localhost.:3000", null); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); + } + + @Test + public void put201CreatingSucceeded200() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lRORetrys().put201CreatingSucceeded200(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void putAsyncRelativeRetrySucceeded() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lRORetrys().putAsyncRelativeRetrySucceeded(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void deleteProvisioning202Accepted200Succeeded() throws Exception { + ServiceResponse response = client.lRORetrys().deleteProvisioning202Accepted200Succeeded(); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void delete202Retry200() throws Exception { + ServiceResponse response = client.lRORetrys().delete202Retry200(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void deleteAsyncRelativeRetrySucceeded() throws Exception { + ServiceResponse response = client.lRORetrys().deleteAsyncRelativeRetrySucceeded(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void post202Retry200() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lRORetrys().post202Retry200(product); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void postAsyncRelativeRetrySucceeded() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lRORetrys().postAsyncRelativeRetrySucceeded(product); + Assert.assertEquals(200, response.getResponse().code()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LROSADsTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LROSADsTests.java new file mode 100644 index 0000000000000..17160533f42bc --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LROSADsTests.java @@ -0,0 +1,312 @@ +package fixtures.lro; + +import com.fasterxml.jackson.core.JsonParseException; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceResponse; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.net.MalformedURLException; + +import fixtures.lro.implementation.AutoRestLongRunningOperationTestServiceImpl; +import fixtures.lro.implementation.ProductInner; + +import static org.junit.Assert.fail; + +public class LROSADsTests { + private static AutoRestLongRunningOperationTestServiceImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestLongRunningOperationTestServiceImpl("http://localhost.:3000", null); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); + } + + @Test + public void putNonRetry400() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().putNonRetry400(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(400, ex.getResponse().code()); + } + } + + @Test + public void putNonRetry201Creating400() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().putNonRetry201Creating400(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(400, ex.getResponse().code()); + } + } + + @Test + public void putAsyncRelativeRetry400() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().putAsyncRelativeRetry400(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(400, ex.getResponse().code()); + } + } + + @Test + public void deleteNonRetry400() throws Exception { + try { + ServiceResponse response = client.lROSADs().deleteNonRetry400(); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(400, ex.getResponse().code()); + } + } + + @Test + public void delete202NonRetry400() throws Exception { + try { + ServiceResponse response = client.lROSADs().delete202NonRetry400(); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(400, ex.getResponse().code()); + } + } + + @Test + public void deleteAsyncRelativeRetry400() throws Exception { + try { + ServiceResponse response = client.lROSADs().deleteAsyncRelativeRetry400(); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(400, ex.getResponse().code()); + } + } + + @Test + public void postNonRetry400() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().postNonRetry400(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(400, ex.getResponse().code()); + } + } + + @Test + public void post202NonRetry400() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().post202NonRetry400(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(400, ex.getResponse().code()); + } + } + + @Test + public void postAsyncRelativeRetry400() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().postAsyncRelativeRetry400(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(400, ex.getResponse().code()); + } + } + + @Test + public void putError201NoProvisioningStatePayload() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().putError201NoProvisioningStatePayload(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(200, ex.getResponse().code()); + Assert.assertTrue(ex.getMessage().contains("no body")); + } + } + + @Test + public void putAsyncRelativeRetryNoStatus() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().putAsyncRelativeRetryNoStatus(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(200, ex.getResponse().code()); + Assert.assertTrue(ex.getMessage().contains("no body")); + } + } + + @Test + public void putAsyncRelativeRetryNoStatusPayload() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().putAsyncRelativeRetryNoStatusPayload(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(200, ex.getResponse().code()); + Assert.assertTrue(ex.getMessage().contains("no body")); + } + } + + @Test + public void delete204Succeeded() throws Exception { + ServiceResponse response = client.lROSADs().delete204Succeeded(); + Assert.assertEquals(204, response.getResponse().code()); + } + + @Test + public void deleteAsyncRelativeRetryNoStatus() throws Exception { + try { + ServiceResponse response = client.lROSADs().deleteAsyncRelativeRetryNoStatus(); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(200, ex.getResponse().code()); + Assert.assertTrue(ex.getMessage().contains("no body")); + } + } + + @Test + public void post202NoLocation() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().post202NoLocation(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(202, ex.getResponse().code()); + Assert.assertTrue(ex.getMessage().contains("No header in response")); + } + } + + @Test + public void postAsyncRelativeRetryNoPayload() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().postAsyncRelativeRetryNoPayload(product); + fail(); + } catch (CloudException ex) { + Assert.assertEquals(200, ex.getResponse().code()); + Assert.assertTrue(ex.getMessage().contains("no body")); + } + } + + @Test + public void put200InvalidJson() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().put200InvalidJson(product); + fail(); + } catch (JsonParseException ex) { + Assert.assertTrue(ex.getMessage().contains("Unexpected end-of-input")); + } + } + + @Test + public void putAsyncRelativeRetryInvalidHeader() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().putAsyncRelativeRetryInvalidHeader(product); + fail(); + } catch (MalformedURLException ex) { + Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); + } + } + + @Test + public void putAsyncRelativeRetryInvalidJsonPolling() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().putAsyncRelativeRetryInvalidJsonPolling(product); + fail(); + } catch (JsonParseException ex) { + Assert.assertTrue(ex.getMessage().contains("Unexpected end-of-input")); + } + } + + @Test + public void delete202RetryInvalidHeader() throws Exception { + try { + ServiceResponse response = client.lROSADs().delete202RetryInvalidHeader(); + fail(); + } catch (MalformedURLException ex) { + Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); + } + } + + @Test + public void deleteAsyncRelativeRetryInvalidHeader() throws Exception { + try { + ServiceResponse response = client.lROSADs().deleteAsyncRelativeRetryInvalidHeader(); + fail(); + } catch (MalformedURLException ex) { + Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); + } + } + + @Test + public void deleteAsyncRelativeRetryInvalidJsonPolling() throws Exception { + try { + ServiceResponse response = client.lROSADs().deleteAsyncRelativeRetryInvalidJsonPolling(); + fail(); + } catch (JsonParseException ex) { + Assert.assertTrue(ex.getMessage().contains("Unexpected end-of-input")); + } + } + + @Test + public void post202RetryInvalidHeader() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().post202RetryInvalidHeader(product); + fail(); + } catch (MalformedURLException ex) { + Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); + } + } + + @Test + public void postAsyncRelativeRetryInvalidHeader() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().postAsyncRelativeRetryInvalidHeader(product); + fail(); + } catch (MalformedURLException ex) { + Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); + } + } + + @Test + public void postAsyncRelativeRetryInvalidJsonPolling() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROSADs().postAsyncRelativeRetryInvalidJsonPolling(product); + fail(); + } catch (JsonParseException ex) { + Assert.assertTrue(ex.getMessage().contains("Unexpected end-of-input")); + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LROsCustomHeaderTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LROsCustomHeaderTests.java new file mode 100644 index 0000000000000..a09a0e062c9e5 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LROsCustomHeaderTests.java @@ -0,0 +1,61 @@ +package fixtures.lro; + +import com.microsoft.rest.ServiceResponse; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; + +import fixtures.lro.implementation.AutoRestLongRunningOperationTestServiceImpl; +import fixtures.lro.implementation.ProductInner; + +public class LROsCustomHeaderTests { + private static AutoRestLongRunningOperationTestServiceImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestLongRunningOperationTestServiceImpl("http://localhost:3000", null); + client.restClient().headers().addHeader("x-ms-client-request-id", "9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); + } + + @AfterClass + public static void cleanup() { + client.restClient().headers().removeHeader("x-ms-client-request-id"); + } + + @Ignore("Pending headermap") + public void putAsyncRetrySucceeded() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROsCustomHeaders().putAsyncRetrySucceeded(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Ignore("Pending headermap") + public void put201CreatingSucceeded200() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROsCustomHeaders().put201CreatingSucceeded200(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Ignore("Pending headermap") + public void post202Retry200() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROsCustomHeaders().post202Retry200(product); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Ignore("Pending headermap") + public void postAsyncRetrySucceeded() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROsCustomHeaders().postAsyncRetrySucceeded(product); + Assert.assertEquals(200, response.getResponse().code()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LROsTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LROsTests.java new file mode 100644 index 0000000000000..5a14b016ac822 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/lro/LROsTests.java @@ -0,0 +1,366 @@ +package fixtures.lro; + +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import fixtures.lro.implementation.AutoRestLongRunningOperationTestServiceImpl; +import fixtures.lro.implementation.ProductInner; +import fixtures.lro.implementation.SkuInner; +import fixtures.lro.implementation.SubProductInner; + +import static org.junit.Assert.fail; + +public class LROsTests { + private static AutoRestLongRunningOperationTestServiceImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestLongRunningOperationTestServiceImpl("http://localhost.:3000", null); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); + } + + @Test + public void put200Succeeded() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put200Succeeded(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void put200SucceededNoState() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put200SucceededNoState(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("100", response.getBody().id()); + } + + @Test + public void put202Retry200() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put202Retry200(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("100", response.getBody().id()); + } + + @Ignore("Can cause flakiness - only run manually") + public void put202Retry200Async() throws Exception { + final CountDownLatch lock = new CountDownLatch(1); + long startTime = System.currentTimeMillis(); + final long[] callbackTime = new long[1]; + ProductInner product = new ProductInner(); + product.withLocation("West US"); + client.getAzureClient().withLongRunningOperationRetryTimeout(1); + client.lROs().put202Retry200Async(product, new ServiceCallback() { + @Override + public void failure(Throwable t) { + fail(); + } + + @Override + public void success(ServiceResponse result) { + Assert.assertEquals(200, result.getResponse().code()); + Assert.assertEquals("100", result.getBody().id()); + callbackTime[0] = System.currentTimeMillis(); + lock.countDown(); + } + }); + long endTime = System.currentTimeMillis(); + Assert.assertTrue(500 > endTime - startTime); + Assert.assertTrue(lock.await(3000, TimeUnit.MILLISECONDS)); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); + Assert.assertTrue(1000 < callbackTime[0] - startTime); + } + + @Test + public void put201CreatingSucceeded200() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put201CreatingSucceeded200(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void put200UpdatingSucceeded204() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put200UpdatingSucceeded204(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void put201CreatingFailed200() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROs().put201CreatingFailed200(product); + fail(); + } catch (CloudException e) { + Assert.assertEquals("Async operation failed", e.getMessage()); + } + } + + @Test + public void put200Acceptedcanceled200() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROs().put200Acceptedcanceled200(product); + fail(); + } catch (CloudException e) { + Assert.assertEquals("Async operation failed", e.getMessage()); + } + } + + @Test + public void putNoHeaderInRetry() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().putNoHeaderInRetry(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void putAsyncRetrySucceeded() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().putAsyncRetrySucceeded(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void putAsyncNoRetrySucceeded() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().putAsyncNoRetrySucceeded(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void putAsyncRetryFailed() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROs().putAsyncRetryFailed(product); + fail(); + } catch (CloudException e) { + Assert.assertEquals("Async operation failed", e.getMessage()); + } + } + + @Test + public void putAsyncNoRetrycanceled() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + try { + ServiceResponse response = client.lROs().putAsyncNoRetrycanceled(product); + fail(); + } catch (CloudException e) { + Assert.assertEquals("Async operation failed", e.getMessage()); + } + } + + @Test + public void putAsyncNoHeaderInRetry() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().putAsyncNoHeaderInRetry(product); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void putNonResource() throws Exception { + SkuInner sku = new SkuInner(); + ServiceResponse response = client.lROs().putNonResource(sku); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("100", response.getBody().id()); + } + + @Test + public void putAsyncNonResource() throws Exception { + SkuInner sku = new SkuInner(); + ServiceResponse response = client.lROs().putAsyncNonResource(sku); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("100", response.getBody().id()); + } + + @Test + public void putSubResource() throws Exception { + SubProductInner subProduct = new SubProductInner(); + ServiceResponse response = client.lROs().putSubResource(subProduct); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void putAsyncSubResource() throws Exception { + SubProductInner subProduct = new SubProductInner(); + ServiceResponse response = client.lROs().putAsyncSubResource(subProduct); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void deleteProvisioning202Accepted200Succeeded() throws Exception { + ServiceResponse response = client.lROs().deleteProvisioning202Accepted200Succeeded(); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); + } + + @Test + public void deleteProvisioning202DeletingFailed200() throws Exception { + ServiceResponse response = client.lROs().deleteProvisioning202DeletingFailed200(); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Failed", response.getBody().provisioningState()); + } + + @Test + public void deleteProvisioning202Deletingcanceled200() throws Exception { + ServiceResponse response = client.lROs().deleteProvisioning202Deletingcanceled200(); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("Canceled", response.getBody().provisioningState()); + } + + @Test + public void delete204Succeeded() throws Exception { + ServiceResponse response = client.lROs().delete204Succeeded(); + Assert.assertEquals(204, response.getResponse().code()); + } + + @Test + public void delete202Retry200() throws Exception { + ServiceResponse response = client.lROs().delete202Retry200(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void delete202NoRetry204() throws Exception { + ServiceResponse response = client.lROs().delete202NoRetry204(); + Assert.assertEquals(204, response.getResponse().code()); + } + + @Test + public void deleteNoHeaderInRetry() throws Exception { + ServiceResponse response = client.lROs().deleteNoHeaderInRetry(); + Assert.assertEquals(204, response.getResponse().code()); + } + + @Test + public void deleteAsyncNoHeaderInRetry() throws Exception { + ServiceResponse response = client.lROs().deleteAsyncNoHeaderInRetry(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void deleteAsyncRetrySucceeded() throws Exception { + ServiceResponse response = client.lROs().deleteAsyncRetrySucceeded(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void deleteAsyncNoRetrySucceeded() throws Exception { + ServiceResponse response = client.lROs().deleteAsyncNoRetrySucceeded(); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void deleteAsyncRetryFailed() throws Exception { + try { + ServiceResponse response = client.lROs().deleteAsyncRetryFailed(); + fail(); + } catch (CloudException e) { + Assert.assertEquals("Async operation failed", e.getMessage()); + } + } + + @Test + public void deleteAsyncRetrycanceled() throws Exception { + try { + ServiceResponse response = client.lROs().deleteAsyncRetrycanceled(); + fail(); + } catch (CloudException e) { + Assert.assertEquals("Async operation failed", e.getMessage()); + } + } + + @Test + public void post200WithPayload() throws Exception { + ServiceResponse response = client.lROs().post200WithPayload(); + Assert.assertEquals(200, response.getResponse().code()); + Assert.assertEquals("1", response.getBody().id()); + } + + @Test + public void post202Retry200() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().post202Retry200(product); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void post202NoRetry204() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().post202NoRetry204(product); + Assert.assertEquals(204, response.getResponse().code()); + } + + @Test + public void postAsyncRetrySucceeded() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().postAsyncRetrySucceeded(product); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void postAsyncNoRetrySucceeded() throws Exception { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().postAsyncNoRetrySucceeded(product); + Assert.assertEquals(200, response.getResponse().code()); + } + + @Test + public void postAsyncRetryFailed() throws Exception { + try { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().postAsyncRetryFailed(product); + fail(); + } catch (CloudException e) { + Assert.assertEquals("Async operation failed", e.getMessage()); + } + } + + @Test + public void postAsyncRetrycanceled() throws Exception { + try { + ProductInner product = new ProductInner(); + product.withLocation("West US"); + ServiceResponse response = client.lROs().postAsyncRetrycanceled(product); + fail(); + } catch (CloudException e) { + Assert.assertEquals("Async operation failed", e.getMessage()); + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/paging/PagingTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/paging/PagingTests.java new file mode 100644 index 0000000000000..f1e122734820a --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/paging/PagingTests.java @@ -0,0 +1,137 @@ +package fixtures.paging; + +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.rest.ServiceResponse; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import javax.xml.ws.WebServiceException; + +import fixtures.paging.implementation.AutoRestPagingTestServiceImpl; +import fixtures.paging.implementation.PagingGetMultiplePagesWithOffsetOptionsInner; +import fixtures.paging.implementation.ProductInner; + +import static org.junit.Assert.fail; + +public class PagingTests { + private static AutoRestPagingTestServiceImpl client; + + @BeforeClass + public static void setup() { + client = new AutoRestPagingTestServiceImpl("http://localhost:3000", null); + } + + @Test + public void getSinglePages() throws Exception { + List response = client.pagings().getSinglePages().getBody(); + Assert.assertEquals(1, response.size()); + } + + @Test + public void getMultiplePages() throws Exception { + List response = client.pagings().getMultiplePages().getBody(); + ProductInner p1 = new ProductInner(); + p1.withProperties(new ProductProperties()); + response.add(p1); + response.get(3); + ProductInner p4 = new ProductInner(); + p4.withProperties(new ProductProperties()); + response.add(p4); + int i = 0; + for (ProductInner p : response) { + if (++i == 7) { + break; + } + } + System.out.println("Asserting..."); + Assert.assertEquals(12, response.size()); + Assert.assertEquals(1, response.indexOf(p1)); + Assert.assertEquals(4, response.indexOf(p4)); + } + + @Test + public void getMultiplePagesWithOffset() throws Exception { + PagingGetMultiplePagesWithOffsetOptionsInner options = new PagingGetMultiplePagesWithOffsetOptionsInner(); + options.withOffset(100); + List response = client.pagings().getMultiplePagesWithOffset(options, "client-id").getBody(); + Assert.assertEquals(10, response.size()); + Assert.assertEquals(110, (int) response.get(response.size() - 1).properties().id()); + } + + @Test + public void getMultiplePagesAsync() throws Exception { + final CountDownLatch lock = new CountDownLatch(1); + client.pagings().getMultiplePagesAsync("client-id", null, new ListOperationCallback() { + @Override + public void failure(Throwable t) { + fail(); + } + + @Override + public void success(ServiceResponse> result) { + lock.countDown(); + } + + @Override + public PagingBahavior progress(List partial) { + if (pageCount() == 7) { + return PagingBahavior.STOP; + } else { + return PagingBahavior.CONTINUE; + } + } + }); + Assert.assertTrue(lock.await(10000, TimeUnit.MILLISECONDS)); + } + + @Test + public void getMultiplePagesRetryFirst() throws Exception { + List response = client.pagings().getMultiplePagesRetryFirst().getBody(); + Assert.assertEquals(10, response.size()); + } + + @Test + public void getMultiplePagesRetrySecond() throws Exception { + List response = client.pagings().getMultiplePagesRetrySecond().getBody(); + Assert.assertEquals(10, response.size()); + } + + @Test + public void getSinglePagesFailure() throws Exception { + try { + List response = client.pagings().getSinglePagesFailure().getBody(); + fail(); + } catch (CloudException ex) { + Assert.assertNotNull(ex.getResponse()); + } + } + + @Test + public void getMultiplePagesFailure() throws Exception { + try { + List response = client.pagings().getMultiplePagesFailure().getBody(); + response.size(); + fail(); + } catch (WebServiceException ex) { + Assert.assertNotNull(ex.getCause()); + } + } + + @Test + public void getMultiplePagesFailureUri() throws Exception { + try { + List response = client.pagings().getMultiplePagesFailureUri().getBody(); + response.size(); + fail(); + } catch (WebServiceException ex) { + Assert.assertNotNull(ex.getCause()); + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/subscriptionidapiversion/GroupTests.java b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/subscriptionidapiversion/GroupTests.java new file mode 100644 index 0000000000000..b66a064c2e0f8 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/test/java/fixtures/subscriptionidapiversion/GroupTests.java @@ -0,0 +1,27 @@ +package fixtures.subscriptionidapiversion; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.UUID; + +import fixtures.subscriptionidapiversion.implementation.MicrosoftAzureTestUrlImpl; +import fixtures.subscriptionidapiversion.implementation.SampleResourceGroupInner; + +public class GroupTests { + private static MicrosoftAzureTestUrlImpl client; + + @BeforeClass + public static void setup() { + client = new MicrosoftAzureTestUrlImpl("http://localhost.:3000", null); + } + + @Test + public void getSampleResourceGroup() throws Exception { + client.withSubscriptionId(UUID.randomUUID().toString()); + SampleResourceGroupInner group = client.groups().getSampleResourceGroup("testgroup101").getBody(); + Assert.assertEquals("testgroup101", group.name()); + Assert.assertEquals("West US", group.location()); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/AutoRest.Generator.Azure.Java.Fluent.csproj b/AutoRest/Generators/Java/Azure.Java.Fluent/AutoRest.Generator.Azure.Java.Fluent.csproj new file mode 100644 index 0000000000000..1483986711b6e --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/AutoRest.Generator.Azure.Java.Fluent.csproj @@ -0,0 +1,85 @@ + + + + + ..\..\..\..\ + AnyCPU + net45 + {D35E97FD-E360-4DAA-96D0-DA45F32150B9} + Library + Properties + Microsoft.Rest.Generator.Java.Azure.Fluent + AutoRest.Generator.Azure.Java.Fluent + 512 + Net45-Debug + + + + false + bin\Net45-Debug + 4 + + + + + + + + Properties\AssemblyVersionInfo.cs + + + + + + + + True + True + Resources.resx + + + + + + + + + + + + + + {c876085f-9dc3-41f0-b7b4-17022cd84684} + AutoRest.Core + + + {90b943ab-3879-4b64-b9ff-1a21297c0f26} + AutoRest.Generator.Azure.Extensions + + + {7dd043eb-5e53-4180-b123-cc3cc5022e34} + AutoRest.Generator.Extensions + + + {afd3f1c4-5c59-4018-b0bb-030e0da57c5c} + AutoRest.Generator.Azure.Java + + + {34B82690-0083-4F4C-8ABF-2D2A09304915} + AutoRest.Generator.Java + + + + + CustomDictionary.xml + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/AzureJavaFluentCodeGenerator.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/AzureJavaFluentCodeGenerator.cs new file mode 100644 index 0000000000000..cdfdd7b1efece --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/AzureJavaFluentCodeGenerator.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Globalization; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Rest.Generator.ClientModel; +using Microsoft.Rest.Generator.Java.Templates; +using Microsoft.Rest.Generator.Utilities; +using Microsoft.Rest.Generator.Java.Azure.Templates; +using System.Collections.Generic; +using Microsoft.Rest.Generator.Azure; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class AzureJavaFluentCodeGenerator : AzureJavaCodeGenerator + { + private readonly AzureJavaFluentCodeNamer _namer; + + private const string ClientRuntimePackage = "com.microsoft.azure:azure-client-runtime:0.0.1-SNAPSHOT"; + private const string _packageInfoFileName = "package-info.java"; + + // page extensions class dictionary. + private IDictionary, string> pageClasses; + + public AzureJavaFluentCodeGenerator(Settings settings) : base(settings) + { + _namer = new AzureJavaFluentCodeNamer(settings.Namespace); + IsSingleFileGenerationSupported = true; + pageClasses = new Dictionary, string>(); + } + + public override string Name + { + get { return "Azure.Java.Fluent"; } + } + + public override string Description + { + get { return "Azure specific Java fluent code generator."; } + } + + public override string UsageInstructions + { + get + { + return string.Format(CultureInfo.InvariantCulture, + Properties.Resources.UsageInformation, ClientRuntimePackage); + } + } + + /// + /// Normalizes client model by updating names and types to be language specific. + /// + /// + public override void NormalizeClientModel(ServiceClient serviceClient) + { + Settings.AddCredentials = true; + + // This extension from general extensions must be run prior to Azure specific extensions. + AzureExtensions.ProcessParameterizedHost(serviceClient, Settings); + AzureExtensions.ProcessClientRequestIdExtension(serviceClient); + AzureExtensions.UpdateHeadMethods(serviceClient); + AzureExtensions.FlattenModels(serviceClient); + AzureExtensions.FlattenMethodParameters(serviceClient, Settings); + ParameterGroupExtensionHelper.AddParameterGroups(serviceClient); + AzureExtensions.AddLongRunningOperations(serviceClient); + AzureExtensions.AddAzureProperties(serviceClient); + AzureExtensions.SetDefaultResponses(serviceClient); + AzureExtensions.AddPageableMethod(serviceClient, _namer); + _namer.NormalizeClientModel(serviceClient); + _namer.ResolveNameCollisions(serviceClient, Settings.Namespace, + Settings.Namespace + ".Models"); + _namer.NormalizePaginatedMethods(serviceClient, pageClasses); + _namer.NormalizeTopLevelTypes(serviceClient); + } + + /// + /// Generates C# code for service client. + /// + /// + /// + public override async Task Generate(ServiceClient serviceClient) + { + var serviceClientTemplateModel = new AzureFluentServiceClientTemplateModel(serviceClient); + // Service client + var serviceClientTemplate = new AzureServiceClientTemplate + { + Model = serviceClientTemplateModel, + }; + await Write(serviceClientTemplate, Path.Combine("implementation", serviceClient.Name.ToPascalCase() + "Impl.java")); + + //Models + foreach (var modelType in serviceClient.ModelTypes.Concat(serviceClient.HeaderTypes)) + { + if (modelType.Extensions.ContainsKey(AzureExtensions.ExternalExtension) && + (bool)modelType.Extensions[AzureExtensions.ExternalExtension]) + { + continue; + } + if (modelType.IsResource()) + { + continue; + } + + var modelTemplateModel = new AzureFluentModelTemplateModel(modelType, serviceClient); + var modelTemplate = new ModelTemplate + { + Model = modelTemplateModel + }; + await Write(modelTemplate, Path.Combine(modelTemplateModel.ModelsPackage.Replace(".", "/").TrimStart(new char[] { '/' }), modelType.Name.ToPascalCase() + ".java")); + } + + //MethodGroups + if (serviceClientTemplateModel.MethodGroupModels.Any()) + { + foreach (var methodGroupModel in serviceClientTemplateModel.MethodGroupModels) + { + var methodGroupTemplate = new AzureMethodGroupTemplate + { + Model = (AzureFluentMethodGroupTemplateModel)methodGroupModel + }; + await Write(methodGroupTemplate, Path.Combine("implementation", methodGroupModel.MethodGroupType.ToPascalCase() + "Inner.java")); + } + } + + //Enums + foreach (var enumType in serviceClient.EnumTypes) + { + var enumTemplateModel = new AzureFluentEnumTemplateModel(enumType); + var enumTemplate = new EnumTemplate + { + Model = enumTemplateModel, + }; + await Write(enumTemplate, Path.Combine(enumTemplateModel.ModelsPackage.Replace(".", "/").TrimStart(new char[] { '/' }), enumTemplate.Model.Name.ToPascalCase() + ".java")); + } + + // Page class + foreach (var pageClass in pageClasses) + { + var pageTemplate = new PageTemplate + { + Model = new FluentPageTemplateModel(pageClass.Value, pageClass.Key.Key, pageClass.Key.Value), + }; + await Write(pageTemplate, Path.Combine("implementation", pageTemplate.Model.TypeDefinitionName + ".java")); + } + + // Exceptions + foreach (var exceptionType in serviceClient.ErrorTypes) + { + if (exceptionType.Name == "CloudError") + { + continue; + } + + var exceptionTemplateModel = new AzureFluentModelTemplateModel(exceptionType, serviceClient); + var exceptionTemplate = new ExceptionTemplate + { + Model = exceptionTemplateModel, + }; + await Write(exceptionTemplate, Path.Combine(exceptionTemplateModel.ModelsPackage.Replace(".", "/").TrimStart(new char[] { '/' }), exceptionTemplate.Model.ExceptionTypeDefinitionName + ".java")); + } + + // package-info.java + await Write(new PackageInfoTemplate + { + Model = new PackageInfoTemplateModel(serviceClient, serviceClient.Name) + }, _packageInfoFileName); + await Write(new PackageInfoTemplate + { + Model = new PackageInfoTemplateModel(serviceClient, serviceClient.Name, "implementation") + }, Path.Combine("implementation", _packageInfoFileName)); + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/AzureJavaFluentCodeNamer.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/AzureJavaFluentCodeNamer.cs new file mode 100644 index 0000000000000..6c58270dee541 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/AzureJavaFluentCodeNamer.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Rest.Generator.ClientModel; +using Microsoft.Rest.Generator.Java.TemplateModels; +using Microsoft.Rest.Generator.Azure; +using System.Globalization; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class AzureJavaFluentCodeNamer : AzureJavaCodeNamer + { + private HashSet _innerTypes; + + public AzureJavaFluentCodeNamer(string nameSpace) + : base(nameSpace) + { + _innerTypes = new HashSet(); + } + + public void NormalizeTopLevelTypes(ServiceClient serviceClient) + { + foreach (var param in serviceClient.Methods.SelectMany(m => m.Parameters)) + { + AppendInnerToTopLevelType(param.Type, serviceClient); + } + foreach (var response in serviceClient.Methods.SelectMany(m => m.Responses).Select(r => r.Value)) + { + AppendInnerToTopLevelType(response.Body, serviceClient); + AppendInnerToTopLevelType(response.Headers, serviceClient); + } + } + + private void AppendInnerToTopLevelType(IType type, ServiceClient serviceClient) + { + if (type == null) + { + return; + } + CompositeType compositeType = type as CompositeType; + SequenceType sequenceType = type as SequenceType; + DictionaryType dictionaryType = type as DictionaryType; + if (compositeType != null && !_innerTypes.Contains(compositeType)) + { + compositeType.Name += "Inner"; + _innerTypes.Add(compositeType); + } + else if (sequenceType != null) + { + AppendInnerToTopLevelType(sequenceType.ElementType, serviceClient); + } + else if (dictionaryType != null) + { + AppendInnerToTopLevelType(dictionaryType.ValueType, serviceClient); + } + } + + protected override CompositeTypeModel NewCompositeTypeModel(CompositeType compositeType) + { + return new FluentCompositeTypeModel(compositeType, _package); + } + + protected override EnumTypeModel NewEnumTypeModel(EnumType enumType) + { + return new FluentEnumTypeModel(enumType, _package); + } + } +} \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/ClientModelExtensions.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/ClientModelExtensions.cs new file mode 100644 index 0000000000000..5f96d10f77c8f --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/ClientModelExtensions.cs @@ -0,0 +1,14 @@ +using Microsoft.Rest.Generator.Azure; +using Microsoft.Rest.Generator.ClientModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public static class ClientModelExtensions + { + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/GlobalSuppressions.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/GlobalSuppressions.cs new file mode 100644 index 0000000000000..0f4f74121ff25 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/GlobalSuppressions.cs @@ -0,0 +1,27 @@ +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureJavaFluentCodeGenerator.#.ctor(Microsoft.Rest.Generator.Settings)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureJavaFluentCodeNamer.#NormalizeTopLevelTypes(Microsoft.Rest.Generator.ClientModel.ServiceClient)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentMethodGroupTemplateModel.#ImplImports")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentMethodTemplateModel.#.ctor(Microsoft.Rest.Generator.ClientModel.Method,Microsoft.Rest.Generator.ClientModel.ServiceClient)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentMethodTemplateModel.#TransformPagingGroupedParameter(Microsoft.Rest.Generator.Utilities.IndentedStringBuilder,Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentMethodTemplateModel.#TransformPagingGroupedParameter(Microsoft.Rest.Generator.Utilities.IndentedStringBuilder,Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentMethodTemplateModel.#TransformPagingGroupedParameter(Microsoft.Rest.Generator.Utilities.IndentedStringBuilder,Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Rest.Generator.Utilities.IndentedStringBuilder.AppendLine(System.String)", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentMethodTemplateModel.#TransformPagingGroupedParameter(Microsoft.Rest.Generator.Utilities.IndentedStringBuilder,Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentMethodTemplateModel.#InterfaceImports")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentMethodTemplateModel.#ImplImports")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentModelTemplateModel.#.ctor(Microsoft.Rest.Generator.ClientModel.CompositeType,Microsoft.Rest.Generator.ClientModel.ServiceClient)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentServiceClientTemplateModel.#InterfaceImports")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.AzureFluentServiceClientTemplateModel.#ImplImports")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Rest.Generator.Java")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.FluentCompositeTypeModel.#.ctor(System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.Fluent.FluentCompositeTypeModel.#.ctor(System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.FluentEnumTypeModel.#.ctor(Microsoft.Rest.Generator.ClientModel.EnumType,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "Microsoft.Rest.Generator.Java.FluentEnumTypeModel.#.ctor(Microsoft.Rest.Generator.ClientModel.EnumType,System.String)")] +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. +// +// To add a suppression to this file, right-click the message in the +// Code Analysis results, point to "Suppress Message", and click +// "In Suppression File". +// You do not need to add suppressions to this file manually. diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/Properties/AssemblyInfo.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..c9f76b61eea29 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System; +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AutoRest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AutoRest")] +[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +// assembly version comes from assemblyfileversion.cs +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: CLSCompliant(false)] +[assembly: NeutralResourcesLanguage("en")] +[assembly: DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories)] diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/Properties/Resources.Designer.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/Properties/Resources.Designer.cs new file mode 100644 index 0000000000000..b0b83f9d07fc8 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/Properties/Resources.Designer.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Rest.Generator.Java.Azure.Fluent.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Long running operations for '{0}' requires a GET operation under the same path and same operation group '{1}'.. + /// + internal static string InvalidLongRunningOperationForCreateOrUpdate { + get { + return ResourceManager.GetString("InvalidLongRunningOperationForCreateOrUpdate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} maven dependency is required to compile and run the generated code.. + /// + internal static string UsageInformation { + get { + return ResourceManager.GetString("UsageInformation", resourceCulture); + } + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/Properties/Resources.resx b/AutoRest/Generators/Java/Azure.Java.Fluent/Properties/Resources.resx new file mode 100644 index 0000000000000..62d1d56b4f80b --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/Properties/Resources.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Long running operations for '{0}' requires a GET operation under the same path and same operation group '{1}'. + + + The {0} maven dependency is required to compile and run the generated code. + + \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentEnumTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentEnumTemplateModel.cs new file mode 100644 index 0000000000000..3053b899e3d61 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentEnumTemplateModel.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Rest.Generator.ClientModel; +using Microsoft.Rest.Generator.Utilities; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class AzureFluentEnumTemplateModel : AzureEnumTemplateModel + { + public AzureFluentEnumTemplateModel(EnumType source) + : base(source) + { + } + + public override string ModelsPackage + { + get + { + return ""; + } + } + } +} \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentMethodGroupTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentMethodGroupTemplateModel.cs new file mode 100644 index 0000000000000..1f10b2e94c4d9 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentMethodGroupTemplateModel.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Rest.Generator.Java.TemplateModels; +using Microsoft.Rest.Generator.Azure; +using Microsoft.Rest.Generator.ClientModel; +using Microsoft.Rest.Generator.Utilities; +using System.Globalization; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class AzureFluentMethodGroupTemplateModel : AzureMethodGroupTemplateModel + { + public AzureFluentMethodGroupTemplateModel(ServiceClient serviceClient, string methodGroupName) + : base(serviceClient, methodGroupName) + { + MethodTemplateModels.Clear(); + Methods.Where(m => m.Group == methodGroupName) + .ForEach(m => MethodTemplateModels.Add(new AzureFluentMethodTemplateModel(m, serviceClient))); + } + + public override string MethodGroupDeclarationType + { + get + { + return MethodGroupImplType; + } + } + + public override string ImplClassSuffix + { + get + { + return "Inner"; + } + } + + public override string ParentDeclaration + { + get + { + return ""; + } + } + + public override string ServiceClientType + { + get + { + return this.Name + "Impl"; + } + } + + public override string ImplPackage + { + get + { + return "implementation"; + } + } + + public override IEnumerable ImplImports + { + get + { + var imports = new List(); + var ns = Namespace.ToLower(CultureInfo.InvariantCulture); + foreach (var i in base.ImplImports.ToList()) + { + if (i.StartsWith(ns + "." + ImplPackage, StringComparison.OrdinalIgnoreCase)) + { + // Same package, do nothing + } + else if (i == ns + "." + this.MethodGroupType) + { + // do nothing + } + else + { + imports.Add(i); + } + } + return imports; + } + } + } +} \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentMethodTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentMethodTemplateModel.cs new file mode 100644 index 0000000000000..9ae49bfce08b1 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentMethodTemplateModel.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Microsoft.Rest.Generator.Azure; +using Microsoft.Rest.Generator.ClientModel; +using Microsoft.Rest.Generator.Java.Azure.Properties; +using Microsoft.Rest.Generator.Java.TemplateModels; +using Microsoft.Rest.Generator.Utilities; +using System.Net; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class AzureFluentMethodTemplateModel : AzureMethodTemplateModel + { + private AzureJavaFluentCodeNamer _namer; + + public AzureFluentMethodTemplateModel(Method source, ServiceClient serviceClient) + : base(source, serviceClient) + { + _namer = new AzureJavaFluentCodeNamer(serviceClient.Namespace); + } + + public override IEnumerable RetrofitParameters + { + get + { + List parameters = base.RetrofitParameters.ToList(); + + parameters.First(p => p.SerializedName == "User-Agent") + .ClientProperty = new FluentPropertyModel(new Property + { + Name = "userAgent" + }, ServiceClient.Namespace, false); + return parameters; + } + } + + protected override void TransformPagingGroupedParameter(IndentedStringBuilder builder, AzureMethodTemplateModel nextMethod, bool filterRequired = false) + { + if (this.InputParameterTransformation.IsNullOrEmpty()) + { + return; + } + var groupedType = this.InputParameterTransformation.First().ParameterMappings[0].InputParameter; + var nextGroupType = nextMethod.InputParameterTransformation.First().ParameterMappings[0].InputParameter; + if (nextGroupType.Name == groupedType.Name) + { + return; + } + var nextGroupTypeName = _namer.GetTypeName(nextGroupType.Name) + "Inner"; + if (filterRequired && !nextGroupType.IsRequired) + { + return; + } + if (!groupedType.IsRequired) + { + builder.AppendLine("{0} {1} = null;", nextGroupTypeName, nextGroupType.Name.ToCamelCase()); + builder.AppendLine("if ({0} != null) {{", groupedType.Name.ToCamelCase()); + builder.Indent(); + builder.AppendLine("{0} = new {1}();", nextGroupType.Name.ToCamelCase(), nextGroupTypeName); + } + else + { + builder.AppendLine("{1} {0} = new {1}();", nextGroupType.Name.ToCamelCase(), nextGroupTypeName); + } + foreach (var outParam in nextMethod.InputParameterTransformation.Select(t => t.OutputParameter)) + { + builder.AppendLine("{0}.with{1}({2}.{3}());", nextGroupType.Name.ToCamelCase(), outParam.Name.ToPascalCase(), groupedType.Name.ToCamelCase(), outParam.Name.ToCamelCase()); + } + if (!groupedType.IsRequired) + { + builder.Outdent().AppendLine(@"}"); + } + } + + public override List InterfaceImports + { + get + { + var imports = base.InterfaceImports; + if (this.IsPagingOperation || this.IsPagingNextOperation) + { + imports.Remove("com.microsoft.rest.ServiceCallback"); + imports.Add("com.microsoft.azure.ListOperationCallback"); + imports.Add("com.microsoft.azure.PagedList"); + imports.Remove("java.util.List"); + imports.AddRange(new CompositeTypeModel(ServiceClient.Namespace) { Name = ((AzureSequenceTypeModel) ReturnTypeModel.BodyClientType).PageImplType }.ImportSafe()); + } + return imports; + } + } + + public override List ImplImports + { + get + { + var imports = base.ImplImports; + if (OperationExceptionTypeString != "CloudException" && OperationExceptionTypeString != "ServiceException") + { + imports.RemoveAll(i => new CompositeTypeModel(ServiceClient.Namespace) { Name = OperationExceptionTypeString }.ImportSafe().Contains(i)); + imports.AddRange(new FluentCompositeTypeModel(ServiceClient.Namespace) { Name = OperationExceptionTypeString }.ImportSafe()); + } + if (this.IsLongRunningOperation) + { + imports.Remove("com.microsoft.rest.ServiceResponseEmptyCallback"); + imports.Remove("com.microsoft.rest.ServiceResponseCallback"); + imports.Remove("com.microsoft.azure.AzureServiceResponseBuilder"); + imports.Add("retrofit2.Callback"); + this.Responses.Select(r => r.Value.Body).Concat(new IType[]{ DefaultResponse.Body }) + .SelectMany(t => t.ImportSafe()) + .Where(i => !this.Parameters.Any(p => p.Type.ImportSafe().Contains(i))) + .ForEach(i => imports.Remove(i)); + // return type may have been removed as a side effect + imports.AddRange(this.ReturnTypeModel.ImplImports); + } + if (this.IsPagingOperation || this.IsPagingNextOperation) + { + imports.Remove("com.microsoft.rest.ServiceCallback"); + imports.Add("com.microsoft.azure.ListOperationCallback"); + imports.Add("com.microsoft.azure.Page"); + imports.Add("com.microsoft.azure.PagedList"); + imports.RemoveAll(i => new CompositeTypeModel(ServiceClient.Namespace) { Name = ((AzureSequenceTypeModel)ReturnTypeModel.BodyClientType).PageImplType }.ImportSafe().Contains(i)); + } + if (this.IsPagingNextOperation) + { + imports.Remove("retrofit2.http.Path"); + imports.Add("retrofit2.http.Url"); + } + if (this.IsPagingNonPollingOperation) + { + imports.RemoveAll(i => new CompositeTypeModel(ServiceClient.Namespace) { Name = ((AzureSequenceTypeModel)ReturnTypeModel.BodyClientType).PageImplType }.ImportSafe().Contains(i)); + } + return imports; + } + } + } +} \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentModelTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentModelTemplateModel.cs new file mode 100644 index 0000000000000..d91c6cd7e9e37 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentModelTemplateModel.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Rest.Generator.ClientModel; +using Microsoft.Rest.Generator.Java.TemplateModels; +using Microsoft.Rest.Generator.Utilities; +using Microsoft.Rest.Generator.Azure; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class AzureFluentModelTemplateModel : AzureModelTemplateModel + { + private AzureJavaFluentCodeNamer _namer; + + public AzureFluentModelTemplateModel(CompositeType source, ServiceClient serviceClient) + : base(source, serviceClient) + { + _namer = new AzureJavaFluentCodeNamer(serviceClient.Namespace); + PropertyModels = new List(); + Properties.ForEach(p => PropertyModels.Add(new FluentPropertyModel(p, serviceClient.Namespace, IsInnerModel))); + } + + protected override JavaCodeNamer Namer + { + get + { + return _namer; + } + } + + public override string ModelsPackage + { + get + { + if (this.IsInnerModel) + { + return ".implementation"; + } + else + { + return ""; + } + } + } + + public bool IsInnerModel + { + get + { + return this.Name.EndsWith("Inner", StringComparison.Ordinal); + } + } + } +} \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentServiceClientTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentServiceClientTemplateModel.cs new file mode 100644 index 0000000000000..4ed7e7e301c4c --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/AzureFluentServiceClientTemplateModel.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Rest.Generator.Java.TemplateModels; +using Microsoft.Rest.Generator.Azure; +using Microsoft.Rest.Generator.ClientModel; +using Microsoft.Rest.Generator.Utilities; +using System.Globalization; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class AzureFluentServiceClientTemplateModel : AzureServiceClientTemplateModel + { + public AzureFluentServiceClientTemplateModel(ServiceClient serviceClient) + : base(serviceClient) + { + MethodTemplateModels.Clear(); + Methods.Where(m => m.Group == null) + .ForEach(m => MethodTemplateModels.Add(new AzureFluentMethodTemplateModel(m, serviceClient))); + ModelTemplateModels.Clear(); + ModelTypes.ForEach(m => ModelTemplateModels.Add(new AzureFluentModelTemplateModel(m, serviceClient))); + } + + public override IEnumerable MethodGroupModels + { + get + { + return MethodGroups.Select(mg => new AzureFluentMethodGroupTemplateModel(this, mg)); + } + } + + public override IEnumerable Operations + { + get + { + return MethodGroups.Select(mg => new AzureFluentMethodGroupTemplateModel(this, mg)); + } + } + + public override string ImplPackage + { + get + { + return "implementation"; + } + } + + public override string ParentDeclaration + { + get + { + return " extends AzureServiceClient"; + } + } + + public override List InterfaceImports + { + get + { + var imports = base.InterfaceImports; + imports.Add("com.microsoft.azure.AzureClient"); + return imports.OrderBy(i => i).ToList(); + } + } + + public override IEnumerable ImplImports + { + get + { + var imports = new List(); + var ns = Namespace.ToLower(CultureInfo.InvariantCulture); + foreach (var i in base.ImplImports.ToList()) + { + if (i.StartsWith(ns + "." + ImplPackage, StringComparison.OrdinalIgnoreCase)) + { + // Same package, do nothing + } + else if (MethodGroupModels.Any(m => i.EndsWith(m.MethodGroupType, StringComparison.OrdinalIgnoreCase))) + { + // do nothing + } + else if (i.EndsWith(this.Name, StringComparison.OrdinalIgnoreCase)) + { + // do nothing + } + else + { + imports.Add(i); + } + } + return imports.OrderBy(i => i).ToList(); + } + } + } +} \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/FluentPageTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/FluentPageTemplateModel.cs new file mode 100644 index 0000000000000..76cbfb9fad7e6 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/TemplateModels/FluentPageTemplateModel.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Rest.Generator.ClientModel; +using Microsoft.Rest.Generator.Utilities; +using Microsoft.Rest.Generator.Azure; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class FluentPageTemplateModel : PageTemplateModel + { + public FluentPageTemplateModel(string typeDefinitionName, string nextLinkName, string itemName) + : base(typeDefinitionName, nextLinkName, itemName) { + } + + public override string ModelsPackage + { + get + { + return "implementation"; + } + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/TypeModels/FluentCompositeTypeModel.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/TypeModels/FluentCompositeTypeModel.cs new file mode 100644 index 0000000000000..52abcde99df17 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/TypeModels/FluentCompositeTypeModel.cs @@ -0,0 +1,48 @@ +using Microsoft.Rest.Generator.ClientModel; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Rest.Generator.Utilities; +using System.Globalization; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class FluentCompositeTypeModel : AzureCompositeTypeModel + { + public FluentCompositeTypeModel(CompositeType compositeType, string package) + : base(compositeType, package) + { + this.LoadFrom(compositeType); + } + + public FluentCompositeTypeModel(string package) + : base(package) + { + this._package = package.ToLower(CultureInfo.InvariantCulture); + } + + public override string Package + { + get + { + if (this.IsResource) + { + return _azureRuntimePackage; + } + else if (Extensions.ContainsKey(ExternalExtension) && + (bool)Extensions[ExternalExtension]) + { + return _runtimePackage; + } + else if (this.Name.EndsWith("Inner", StringComparison.Ordinal)) + { + return _package + ".implementation"; + } + else + { + return _package; + } + } + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/TypeModels/FluentEnumTypeModel.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/TypeModels/FluentEnumTypeModel.cs new file mode 100644 index 0000000000000..d7ad5e6be6208 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/TypeModels/FluentEnumTypeModel.cs @@ -0,0 +1,31 @@ +using Microsoft.Rest.Generator.ClientModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Rest.Generator.Java.TemplateModels; +using Microsoft.Rest.Generator.Utilities; +using System.Globalization; + +namespace Microsoft.Rest.Generator.Java +{ + public class FluentEnumTypeModel : EnumTypeModel + { + private string _package; + + public FluentEnumTypeModel(EnumType enumType, string package) + : base(enumType, package) + { + this._package = package.ToLower(CultureInfo.InvariantCulture); + } + + public override IEnumerable Imports + { + get + { + yield return string.Join(".", _package + (Name.EndsWith("Inner") ? ".implementation" : ""), Name); + } + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Fluent/TypeModels/FluentPropertyModel.cs b/AutoRest/Generators/Java/Azure.Java.Fluent/TypeModels/FluentPropertyModel.cs new file mode 100644 index 0000000000000..0273d4d81ee27 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Fluent/TypeModels/FluentPropertyModel.cs @@ -0,0 +1,39 @@ +using Microsoft.Rest.Generator.ClientModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Rest.Generator.Java.TemplateModels; +using Microsoft.Rest.Generator.Utilities; +using System.Globalization; + +namespace Microsoft.Rest.Generator.Java.Azure.Fluent +{ + public class FluentPropertyModel : PropertyModel + { + private bool isInnerModel; + + public FluentPropertyModel(Property property, string package, bool isInnerModel) + : base(property, package) + { + this.isInnerModel = isInnerModel; + } + + public override IEnumerable Imports + { + get + { + var imports = new List(Type.ImportSafe() + .Where(c => !c.StartsWith(_package, StringComparison.Ordinal) + || c.EndsWith("Inner", StringComparison.Ordinal) ^ isInnerModel)); + if (Type.IsPrimaryType(KnownPrimaryType.DateTimeRfc1123)) + { + imports.AddRange(Type.ImportSafe()); + imports.AddRange(((ITypeModel)Type).ResponseVariant.ImportSafe()); + } + return imports; + } + } + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestService.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestService.java index beed9929906f3..b7006468ae6ab 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestService.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestService.java @@ -11,44 +11,18 @@ package fixtures.azureparametergrouping; import com.microsoft.azure.AzureClient; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; +import com.microsoft.azure.RestClient; /** * The interface for AutoRestParameterGroupingTestService class. */ public interface AutoRestParameterGroupingTestService { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -57,58 +31,61 @@ public interface AutoRestParameterGroupingTestService { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + AutoRestParameterGroupingTestService withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + AutoRestParameterGroupingTestService withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + AutoRestParameterGroupingTestService withGenerateClientRequestId(boolean generateClientRequestId); /** - * Gets the ParameterGroupingOperations object to access its operations. - * @return the ParameterGroupingOperations object. + * Gets the ParameterGroupings object to access its operations. + * @return the ParameterGroupings object. */ - ParameterGroupingOperations getParameterGroupingOperations(); + ParameterGroupings parameterGroupings(); } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupingOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupings.java similarity index 99% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupingOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupings.java index d722a1f9feffe..98dcae398704e 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupingOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupings.java @@ -22,9 +22,9 @@ /** * An instance of this class provides access to all the operations defined - * in ParameterGroupingOperations. + * in ParameterGroupings. */ -public interface ParameterGroupingOperations { +public interface ParameterGroupings { /** * Post a bunch of required parameters grouped. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/implementation/AutoRestParameterGroupingTestServiceImpl.java similarity index 58% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestServiceImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/implementation/AutoRestParameterGroupingTestServiceImpl.java index 00c69af5d2367..5a093d7148c27 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/AutoRestParameterGroupingTestServiceImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/implementation/AutoRestParameterGroupingTestServiceImpl.java @@ -8,35 +8,22 @@ * regenerated. */ -package fixtures.azureparametergrouping; +package fixtures.azureparametergrouping.implementation; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.CustomHeaderInterceptor; -import com.microsoft.rest.AutoRestBaseUrl; +import com.microsoft.azure.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; -import java.util.UUID; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; +import fixtures.azureparametergrouping.AutoRestParameterGroupingTestService; +import fixtures.azureparametergrouping.ParameterGroupings; /** - * Initializes a new instance of the AutoRestParameterGroupingTestService class. + * Initializes a new instance of the AutoRestParameterGroupingTestServiceImpl class. */ public final class AutoRestParameterGroupingTestServiceImpl extends AzureServiceClient implements AutoRestParameterGroupingTestService { - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - /** * Gets the {@link AzureClient} used for long running operations. * @return the azure client; @@ -45,18 +32,6 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - /** Gets or sets the preferred language for the response. */ private String acceptLanguage; @@ -65,7 +40,7 @@ public ServiceClientCredentials getCredentials() { * * @return the acceptLanguage value. */ - public String getAcceptLanguage() { + public String acceptLanguage() { return this.acceptLanguage; } @@ -73,9 +48,11 @@ public String getAcceptLanguage() { * Sets Gets or sets the preferred language for the response. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - public void setAcceptLanguage(String acceptLanguage) { + public AutoRestParameterGroupingTestServiceImpl withAcceptLanguage(String acceptLanguage) { this.acceptLanguage = acceptLanguage; + return this; } /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ @@ -86,7 +63,7 @@ public void setAcceptLanguage(String acceptLanguage) { * * @return the longRunningOperationRetryTimeout value. */ - public int getLongRunningOperationRetryTimeout() { + public int longRunningOperationRetryTimeout() { return this.longRunningOperationRetryTimeout; } @@ -94,9 +71,11 @@ public int getLongRunningOperationRetryTimeout() { * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public AutoRestParameterGroupingTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; } /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ @@ -107,7 +86,7 @@ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTim * * @return the generateClientRequestId value. */ - public boolean getGenerateClientRequestId() { + public boolean generateClientRequestId() { return this.generateClientRequestId; } @@ -115,17 +94,24 @@ public boolean getGenerateClientRequestId() { * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { + public AutoRestParameterGroupingTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { this.generateClientRequestId = generateClientRequestId; + return this; } /** - * Gets the ParameterGroupingOperations object to access its operations. - * @return the ParameterGroupingOperations object. + * The ParameterGroupings object to access its operations. + */ + private ParameterGroupings parameterGroupings; + + /** + * Gets the ParameterGroupings object to access its operations. + * @return the ParameterGroupings object. */ - public ParameterGroupingOperations getParameterGroupingOperations() { - return new ParameterGroupingOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public ParameterGroupings parameterGroupings() { + return this.parameterGroupings; } /** @@ -144,39 +130,39 @@ public AutoRestParameterGroupingTestServiceImpl(ServiceClientCredentials credent * @param credentials the management credentials for Azure */ public AutoRestParameterGroupingTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } /** * Initializes an instance of AutoRestParameterGroupingTestService client. * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param restClient the REST client to connect to Azure. */ - public AutoRestParameterGroupingTestServiceImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; + public AutoRestParameterGroupingTestServiceImpl(RestClient restClient) { + super(restClient); initialize(); } - @Override protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); + this.parameterGroupings = new ParameterGroupingsImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestParameterGroupingTestService, 1.0.0"); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupingOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingsImpl.java similarity index 87% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupingOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingsImpl.java index 26385d6c09481..ad7f2ddbf2fc1 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/ParameterGroupingOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/implementation/ParameterGroupingsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.azureparametergrouping; +package fixtures.azureparametergrouping.implementation; +import retrofit2.Retrofit; +import fixtures.azureparametergrouping.ParameterGroupings; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; @@ -32,49 +34,48 @@ import retrofit2.http.POST; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in ParameterGroupingOperations. + * in ParameterGroupings. */ -public final class ParameterGroupingOperationsImpl implements ParameterGroupingOperations { +public final class ParameterGroupingsImpl implements ParameterGroupings { /** The Retrofit service to perform REST calls. */ - private ParameterGroupingService service; + private ParameterGroupingsService service; /** The service client containing this operation class. */ - private AutoRestParameterGroupingTestService client; + private AutoRestParameterGroupingTestServiceImpl client; /** - * Initializes an instance of ParameterGroupingOperations. + * Initializes an instance of ParameterGroupingsImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ParameterGroupingOperationsImpl(Retrofit retrofit, AutoRestParameterGroupingTestService client) { - this.service = retrofit.create(ParameterGroupingService.class); + public ParameterGroupingsImpl(Retrofit retrofit, AutoRestParameterGroupingTestServiceImpl client) { + this.service = retrofit.create(ParameterGroupingsService.class); this.client = client; } /** - * The interface defining all the services for ParameterGroupingOperations to be + * The interface defining all the services for ParameterGroupings to be * used by Retrofit to perform actually REST calls. */ - interface ParameterGroupingService { + interface ParameterGroupingsService { @Headers("Content-Type: application/json; charset=utf-8") @POST("parameterGrouping/postRequired/{path}") - Call postRequired(@Path("path") String path, @Header("accept-language") String acceptLanguage, @Body int body, @Header("customHeader") String customHeader, @Query("query") Integer query); + Call postRequired(@Path("path") String path, @Header("accept-language") String acceptLanguage, @Body int body, @Header("customHeader") String customHeader, @Query("query") Integer query, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("parameterGrouping/postOptional") - Call postOptional(@Header("accept-language") String acceptLanguage, @Header("customHeader") String customHeader, @Query("query") Integer query); + Call postOptional(@Header("accept-language") String acceptLanguage, @Header("customHeader") String customHeader, @Query("query") Integer query, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("parameterGrouping/postMultipleParameterGroups") - Call postMultiParamGroups(@Header("accept-language") String acceptLanguage, @Header("header-one") String headerOne, @Query("query-one") Integer queryOne, @Header("header-two") String headerTwo, @Query("query-two") Integer queryTwo); + Call postMultiParamGroups(@Header("accept-language") String acceptLanguage, @Header("header-one") String headerOne, @Query("query-one") Integer queryOne, @Header("header-two") String headerTwo, @Query("query-two") Integer queryTwo, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("parameterGrouping/sharedParameterGroupObject") - Call postSharedParameterGroupObject(@Header("accept-language") String acceptLanguage, @Header("header-one") String headerOne, @Query("query-one") Integer queryOne); + Call postSharedParameterGroupObject(@Header("accept-language") String acceptLanguage, @Header("header-one") String headerOne, @Query("query-one") Integer queryOne, @Header("User-Agent") String userAgent); } @@ -92,11 +93,11 @@ public ServiceResponse postRequired(ParameterGroupingPostRequiredParameter throw new IllegalArgumentException("Parameter parameterGroupingPostRequiredParameters is required and cannot be null."); } Validator.validate(parameterGroupingPostRequiredParameters); - int body = parameterGroupingPostRequiredParameters.getBody(); - String customHeader = parameterGroupingPostRequiredParameters.getCustomHeader(); - Integer query = parameterGroupingPostRequiredParameters.getQuery(); - String path = parameterGroupingPostRequiredParameters.getPath(); - Call call = service.postRequired(path, this.client.getAcceptLanguage(), body, customHeader, query); + int body = parameterGroupingPostRequiredParameters.body(); + String customHeader = parameterGroupingPostRequiredParameters.customHeader(); + Integer query = parameterGroupingPostRequiredParameters.query(); + String path = parameterGroupingPostRequiredParameters.path(); + Call call = service.postRequired(path, this.client.acceptLanguage(), body, customHeader, query, this.client.userAgent()); return postRequiredDelegate(call.execute()); } @@ -117,11 +118,11 @@ public ServiceCall postRequiredAsync(ParameterGroupingPostRequiredParameters par return null; } Validator.validate(parameterGroupingPostRequiredParameters, serviceCallback); - int body = parameterGroupingPostRequiredParameters.getBody(); - String customHeader = parameterGroupingPostRequiredParameters.getCustomHeader(); - Integer query = parameterGroupingPostRequiredParameters.getQuery(); - String path = parameterGroupingPostRequiredParameters.getPath(); - Call call = service.postRequired(path, this.client.getAcceptLanguage(), body, customHeader, query); + int body = parameterGroupingPostRequiredParameters.body(); + String customHeader = parameterGroupingPostRequiredParameters.customHeader(); + Integer query = parameterGroupingPostRequiredParameters.query(); + String path = parameterGroupingPostRequiredParameters.path(); + Call call = service.postRequired(path, this.client.acceptLanguage(), body, customHeader, query, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -137,7 +138,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -154,7 +155,7 @@ public ServiceResponse postOptional() throws ErrorException, IOException { final ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = null; String customHeader = null; Integer query = null; - Call call = service.postOptional(this.client.getAcceptLanguage(), customHeader, query); + Call call = service.postOptional(this.client.acceptLanguage(), customHeader, query, this.client.userAgent()); return postOptionalDelegate(call.execute()); } @@ -172,7 +173,7 @@ public ServiceCall postOptionalAsync(final ServiceCallback serviceCallback final ParameterGroupingPostOptionalParameters parameterGroupingPostOptionalParameters = null; String customHeader = null; Integer query = null; - Call call = service.postOptional(this.client.getAcceptLanguage(), customHeader, query); + Call call = service.postOptional(this.client.acceptLanguage(), customHeader, query, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -199,13 +200,13 @@ public ServiceResponse postOptional(ParameterGroupingPostOptionalParameter Validator.validate(parameterGroupingPostOptionalParameters); String customHeader = null; if (parameterGroupingPostOptionalParameters != null) { - customHeader = parameterGroupingPostOptionalParameters.getCustomHeader(); + customHeader = parameterGroupingPostOptionalParameters.customHeader(); } Integer query = null; if (parameterGroupingPostOptionalParameters != null) { - query = parameterGroupingPostOptionalParameters.getQuery(); + query = parameterGroupingPostOptionalParameters.query(); } - Call call = service.postOptional(this.client.getAcceptLanguage(), customHeader, query); + Call call = service.postOptional(this.client.acceptLanguage(), customHeader, query, this.client.userAgent()); return postOptionalDelegate(call.execute()); } @@ -224,13 +225,13 @@ public ServiceCall postOptionalAsync(ParameterGroupingPostOptionalParameters par Validator.validate(parameterGroupingPostOptionalParameters, serviceCallback); String customHeader = null; if (parameterGroupingPostOptionalParameters != null) { - customHeader = parameterGroupingPostOptionalParameters.getCustomHeader(); + customHeader = parameterGroupingPostOptionalParameters.customHeader(); } Integer query = null; if (parameterGroupingPostOptionalParameters != null) { - query = parameterGroupingPostOptionalParameters.getQuery(); + query = parameterGroupingPostOptionalParameters.query(); } - Call call = service.postOptional(this.client.getAcceptLanguage(), customHeader, query); + Call call = service.postOptional(this.client.acceptLanguage(), customHeader, query, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -246,7 +247,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -266,7 +267,7 @@ public ServiceResponse postMultiParamGroups() throws ErrorException, IOExc Integer queryOne = null; String headerTwo = null; Integer queryTwo = null; - Call call = service.postMultiParamGroups(this.client.getAcceptLanguage(), headerOne, queryOne, headerTwo, queryTwo); + Call call = service.postMultiParamGroups(this.client.acceptLanguage(), headerOne, queryOne, headerTwo, queryTwo, this.client.userAgent()); return postMultiParamGroupsDelegate(call.execute()); } @@ -287,7 +288,7 @@ public ServiceCall postMultiParamGroupsAsync(final ServiceCallback service Integer queryOne = null; String headerTwo = null; Integer queryTwo = null; - Call call = service.postMultiParamGroups(this.client.getAcceptLanguage(), headerOne, queryOne, headerTwo, queryTwo); + Call call = service.postMultiParamGroups(this.client.acceptLanguage(), headerOne, queryOne, headerTwo, queryTwo, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -316,21 +317,21 @@ public ServiceResponse postMultiParamGroups(FirstParameterGroup firstParam Validator.validate(parameterGroupingPostMultiParamGroupsSecondParamGroup); String headerOne = null; if (firstParameterGroup != null) { - headerOne = firstParameterGroup.getHeaderOne(); + headerOne = firstParameterGroup.headerOne(); } Integer queryOne = null; if (firstParameterGroup != null) { - queryOne = firstParameterGroup.getQueryOne(); + queryOne = firstParameterGroup.queryOne(); } String headerTwo = null; if (parameterGroupingPostMultiParamGroupsSecondParamGroup != null) { - headerTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.getHeaderTwo(); + headerTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.headerTwo(); } Integer queryTwo = null; if (parameterGroupingPostMultiParamGroupsSecondParamGroup != null) { - queryTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.getQueryTwo(); + queryTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.queryTwo(); } - Call call = service.postMultiParamGroups(this.client.getAcceptLanguage(), headerOne, queryOne, headerTwo, queryTwo); + Call call = service.postMultiParamGroups(this.client.acceptLanguage(), headerOne, queryOne, headerTwo, queryTwo, this.client.userAgent()); return postMultiParamGroupsDelegate(call.execute()); } @@ -351,21 +352,21 @@ public ServiceCall postMultiParamGroupsAsync(FirstParameterGroup firstParameterG Validator.validate(parameterGroupingPostMultiParamGroupsSecondParamGroup, serviceCallback); String headerOne = null; if (firstParameterGroup != null) { - headerOne = firstParameterGroup.getHeaderOne(); + headerOne = firstParameterGroup.headerOne(); } Integer queryOne = null; if (firstParameterGroup != null) { - queryOne = firstParameterGroup.getQueryOne(); + queryOne = firstParameterGroup.queryOne(); } String headerTwo = null; if (parameterGroupingPostMultiParamGroupsSecondParamGroup != null) { - headerTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.getHeaderTwo(); + headerTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.headerTwo(); } Integer queryTwo = null; if (parameterGroupingPostMultiParamGroupsSecondParamGroup != null) { - queryTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.getQueryTwo(); + queryTwo = parameterGroupingPostMultiParamGroupsSecondParamGroup.queryTwo(); } - Call call = service.postMultiParamGroups(this.client.getAcceptLanguage(), headerOne, queryOne, headerTwo, queryTwo); + Call call = service.postMultiParamGroups(this.client.acceptLanguage(), headerOne, queryOne, headerTwo, queryTwo, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -381,7 +382,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postMultiParamGroupsDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -398,7 +399,7 @@ public ServiceResponse postSharedParameterGroupObject() throws ErrorExcept final FirstParameterGroup firstParameterGroup = null; String headerOne = null; Integer queryOne = null; - Call call = service.postSharedParameterGroupObject(this.client.getAcceptLanguage(), headerOne, queryOne); + Call call = service.postSharedParameterGroupObject(this.client.acceptLanguage(), headerOne, queryOne, this.client.userAgent()); return postSharedParameterGroupObjectDelegate(call.execute()); } @@ -416,7 +417,7 @@ public ServiceCall postSharedParameterGroupObjectAsync(final ServiceCallback call = service.postSharedParameterGroupObject(this.client.getAcceptLanguage(), headerOne, queryOne); + Call call = service.postSharedParameterGroupObject(this.client.acceptLanguage(), headerOne, queryOne, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -443,13 +444,13 @@ public ServiceResponse postSharedParameterGroupObject(FirstParameterGroup Validator.validate(firstParameterGroup); String headerOne = null; if (firstParameterGroup != null) { - headerOne = firstParameterGroup.getHeaderOne(); + headerOne = firstParameterGroup.headerOne(); } Integer queryOne = null; if (firstParameterGroup != null) { - queryOne = firstParameterGroup.getQueryOne(); + queryOne = firstParameterGroup.queryOne(); } - Call call = service.postSharedParameterGroupObject(this.client.getAcceptLanguage(), headerOne, queryOne); + Call call = service.postSharedParameterGroupObject(this.client.acceptLanguage(), headerOne, queryOne, this.client.userAgent()); return postSharedParameterGroupObjectDelegate(call.execute()); } @@ -468,13 +469,13 @@ public ServiceCall postSharedParameterGroupObjectAsync(FirstParameterGroup first Validator.validate(firstParameterGroup, serviceCallback); String headerOne = null; if (firstParameterGroup != null) { - headerOne = firstParameterGroup.getHeaderOne(); + headerOne = firstParameterGroup.headerOne(); } Integer queryOne = null; if (firstParameterGroup != null) { - queryOne = firstParameterGroup.getQueryOne(); + queryOne = firstParameterGroup.queryOne(); } - Call call = service.postSharedParameterGroupObject(this.client.getAcceptLanguage(), headerOne, queryOne); + Call call = service.postSharedParameterGroupObject(this.client.acceptLanguage(), headerOne, queryOne, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -490,7 +491,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postSharedParameterGroupObjectDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/implementation/package-info.java new file mode 100644 index 0000000000000..191b184e65a7d --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestParameterGroupingTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.azureparametergrouping.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/Error.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/Error.java index cd7d6429cd30e..2b428d67e07ce 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/Error.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ErrorException.java index d6421c63fc32c..67f9fcfe9f865 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ErrorException.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.azureparametergrouping.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/FirstParameterGroup.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/FirstParameterGroup.java index bbe5038e8892e..d62a11765de32 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/FirstParameterGroup.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/FirstParameterGroup.java @@ -35,7 +35,7 @@ public class FirstParameterGroup { * * @return the headerOne value */ - public String getHeaderOne() { + public String headerOne() { return this.headerOne; } @@ -43,9 +43,11 @@ public String getHeaderOne() { * Set the headerOne value. * * @param headerOne the headerOne value to set + * @return the FirstParameterGroup object itself. */ - public void setHeaderOne(String headerOne) { + public FirstParameterGroup withHeaderOne(String headerOne) { this.headerOne = headerOne; + return this; } /** @@ -53,7 +55,7 @@ public void setHeaderOne(String headerOne) { * * @return the queryOne value */ - public Integer getQueryOne() { + public Integer queryOne() { return this.queryOne; } @@ -61,9 +63,11 @@ public Integer getQueryOne() { * Set the queryOne value. * * @param queryOne the queryOne value to set + * @return the FirstParameterGroup object itself. */ - public void setQueryOne(Integer queryOne) { + public FirstParameterGroup withQueryOne(Integer queryOne) { this.queryOne = queryOne; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostMultiParamGroupsSecondParamGroup.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostMultiParamGroupsSecondParamGroup.java index e8c9db90cc753..d37009341ea03 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostMultiParamGroupsSecondParamGroup.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostMultiParamGroupsSecondParamGroup.java @@ -34,7 +34,7 @@ public class ParameterGroupingPostMultiParamGroupsSecondParamGroup { * * @return the headerTwo value */ - public String getHeaderTwo() { + public String headerTwo() { return this.headerTwo; } @@ -42,9 +42,11 @@ public String getHeaderTwo() { * Set the headerTwo value. * * @param headerTwo the headerTwo value to set + * @return the ParameterGroupingPostMultiParamGroupsSecondParamGroup object itself. */ - public void setHeaderTwo(String headerTwo) { + public ParameterGroupingPostMultiParamGroupsSecondParamGroup withHeaderTwo(String headerTwo) { this.headerTwo = headerTwo; + return this; } /** @@ -52,7 +54,7 @@ public void setHeaderTwo(String headerTwo) { * * @return the queryTwo value */ - public Integer getQueryTwo() { + public Integer queryTwo() { return this.queryTwo; } @@ -60,9 +62,11 @@ public Integer getQueryTwo() { * Set the queryTwo value. * * @param queryTwo the queryTwo value to set + * @return the ParameterGroupingPostMultiParamGroupsSecondParamGroup object itself. */ - public void setQueryTwo(Integer queryTwo) { + public ParameterGroupingPostMultiParamGroupsSecondParamGroup withQueryTwo(Integer queryTwo) { this.queryTwo = queryTwo; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostOptionalParameters.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostOptionalParameters.java index 8177eb2257697..bfe9a81c3ffb8 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostOptionalParameters.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostOptionalParameters.java @@ -33,7 +33,7 @@ public class ParameterGroupingPostOptionalParameters { * * @return the customHeader value */ - public String getCustomHeader() { + public String customHeader() { return this.customHeader; } @@ -41,9 +41,11 @@ public String getCustomHeader() { * Set the customHeader value. * * @param customHeader the customHeader value to set + * @return the ParameterGroupingPostOptionalParameters object itself. */ - public void setCustomHeader(String customHeader) { + public ParameterGroupingPostOptionalParameters withCustomHeader(String customHeader) { this.customHeader = customHeader; + return this; } /** @@ -51,7 +53,7 @@ public void setCustomHeader(String customHeader) { * * @return the query value */ - public Integer getQuery() { + public Integer query() { return this.query; } @@ -59,9 +61,11 @@ public Integer getQuery() { * Set the query value. * * @param query the query value to set + * @return the ParameterGroupingPostOptionalParameters object itself. */ - public void setQuery(Integer query) { + public ParameterGroupingPostOptionalParameters withQuery(Integer query) { this.query = query; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostRequiredParameters.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostRequiredParameters.java index 98f0a230bc383..5d10f7647227a 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostRequiredParameters.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/ParameterGroupingPostRequiredParameters.java @@ -45,7 +45,7 @@ public class ParameterGroupingPostRequiredParameters { * * @return the body value */ - public int getBody() { + public int body() { return this.body; } @@ -53,9 +53,11 @@ public int getBody() { * Set the body value. * * @param body the body value to set + * @return the ParameterGroupingPostRequiredParameters object itself. */ - public void setBody(int body) { + public ParameterGroupingPostRequiredParameters withBody(int body) { this.body = body; + return this; } /** @@ -63,7 +65,7 @@ public void setBody(int body) { * * @return the customHeader value */ - public String getCustomHeader() { + public String customHeader() { return this.customHeader; } @@ -71,9 +73,11 @@ public String getCustomHeader() { * Set the customHeader value. * * @param customHeader the customHeader value to set + * @return the ParameterGroupingPostRequiredParameters object itself. */ - public void setCustomHeader(String customHeader) { + public ParameterGroupingPostRequiredParameters withCustomHeader(String customHeader) { this.customHeader = customHeader; + return this; } /** @@ -81,7 +85,7 @@ public void setCustomHeader(String customHeader) { * * @return the query value */ - public Integer getQuery() { + public Integer query() { return this.query; } @@ -89,9 +93,11 @@ public Integer getQuery() { * Set the query value. * * @param query the query value to set + * @return the ParameterGroupingPostRequiredParameters object itself. */ - public void setQuery(Integer query) { + public ParameterGroupingPostRequiredParameters withQuery(Integer query) { this.query = query; + return this; } /** @@ -99,7 +105,7 @@ public void setQuery(Integer query) { * * @return the path value */ - public String getPath() { + public String path() { return this.path; } @@ -107,9 +113,11 @@ public String getPath() { * Set the path value. * * @param path the path value to set + * @return the ParameterGroupingPostRequiredParameters object itself. */ - public void setPath(String path) { + public ParameterGroupingPostRequiredParameters withPath(String path) { this.path = path; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/package-info.java index ae1929ed830cd..e30bc323b301a 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureparametergrouping/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestParameterGroupingTestService. + * This package contains the models classes for AutoRestParameterGroupingTestService. * Test Infrastructure for AutoRest. */ package fixtures.azureparametergrouping.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/AutoRestReportServiceForAzure.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/AutoRestReportServiceForAzure.java index 5794e90191b73..6b35b7dd0a237 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/AutoRestReportServiceForAzure.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/AutoRestReportServiceForAzure.java @@ -11,50 +11,24 @@ package fixtures.azurereport; import com.microsoft.azure.AzureClient; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; +import com.microsoft.azure.RestClient; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import fixtures.azurereport.models.ErrorException; import java.io.IOException; -import java.util.List; import java.util.Map; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; /** * The interface for AutoRestReportServiceForAzure class. */ public interface AutoRestReportServiceForAzure { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -63,53 +37,56 @@ public interface AutoRestReportServiceForAzure { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + AutoRestReportServiceForAzure withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + AutoRestReportServiceForAzure withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + AutoRestReportServiceForAzure withGenerateClientRequestId(boolean generateClientRequestId); /** * Get test coverage report. diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/AutoRestReportServiceForAzureImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/implementation/AutoRestReportServiceForAzureImpl.java similarity index 68% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/AutoRestReportServiceForAzureImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/implementation/AutoRestReportServiceForAzureImpl.java index ea1668a034964..f5dcc50c11b2c 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/AutoRestReportServiceForAzureImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/implementation/AutoRestReportServiceForAzureImpl.java @@ -8,53 +8,38 @@ * regenerated. */ -package fixtures.azurereport; +package fixtures.azurereport.implementation; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; import com.microsoft.azure.AzureServiceResponseBuilder; -import com.microsoft.azure.CustomHeaderInterceptor; -import com.microsoft.rest.AutoRestBaseUrl; +import com.microsoft.azure.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; +import fixtures.azurereport.AutoRestReportServiceForAzure; import fixtures.azurereport.models.ErrorException; import java.io.IOException; import java.util.Map; -import java.util.UUID; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import okhttp3.OkHttpClient; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.Response; -import retrofit2.Retrofit; /** - * Initializes a new instance of the AutoRestReportServiceForAzure class. + * Initializes a new instance of the AutoRestReportServiceForAzureImpl class. */ public final class AutoRestReportServiceForAzureImpl extends AzureServiceClient implements AutoRestReportServiceForAzure { /** The Retrofit service to perform REST calls. */ private AutoRestReportServiceForAzureService service; - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - /** * Gets the {@link AzureClient} used for long running operations. * @return the azure client; @@ -63,18 +48,6 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - /** Gets or sets the preferred language for the response. */ private String acceptLanguage; @@ -83,7 +56,7 @@ public ServiceClientCredentials getCredentials() { * * @return the acceptLanguage value. */ - public String getAcceptLanguage() { + public String acceptLanguage() { return this.acceptLanguage; } @@ -91,9 +64,11 @@ public String getAcceptLanguage() { * Sets Gets or sets the preferred language for the response. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - public void setAcceptLanguage(String acceptLanguage) { + public AutoRestReportServiceForAzureImpl withAcceptLanguage(String acceptLanguage) { this.acceptLanguage = acceptLanguage; + return this; } /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ @@ -104,7 +79,7 @@ public void setAcceptLanguage(String acceptLanguage) { * * @return the longRunningOperationRetryTimeout value. */ - public int getLongRunningOperationRetryTimeout() { + public int longRunningOperationRetryTimeout() { return this.longRunningOperationRetryTimeout; } @@ -112,9 +87,11 @@ public int getLongRunningOperationRetryTimeout() { * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public AutoRestReportServiceForAzureImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; } /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ @@ -125,7 +102,7 @@ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTim * * @return the generateClientRequestId value. */ - public boolean getGenerateClientRequestId() { + public boolean generateClientRequestId() { return this.generateClientRequestId; } @@ -133,9 +110,11 @@ public boolean getGenerateClientRequestId() { * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { + public AutoRestReportServiceForAzureImpl withGenerateClientRequestId(boolean generateClientRequestId) { this.generateClientRequestId = generateClientRequestId; + return this; } /** @@ -154,58 +133,44 @@ public AutoRestReportServiceForAzureImpl(ServiceClientCredentials credentials) { * @param credentials the management credentials for Azure */ public AutoRestReportServiceForAzureImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } /** * Initializes an instance of AutoRestReportServiceForAzure client. * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param restClient the REST client to connect to Azure. */ - public AutoRestReportServiceForAzureImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; + public AutoRestReportServiceForAzureImpl(RestClient restClient) { + super(restClient); initialize(); } - @Override protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); + this.azureClient = new AzureClient(this); initializeService(); } - private void initializeService() { - service = this.retrofitBuilder.client(this.clientBuilder.build()) - .build() - .create(AutoRestReportServiceForAzureService.class); - } - /** - * Sets the logging level for OkHttp client. + * Gets the User-Agent header for the client. * - * @param logLevel the logging level enum + * @return the user agent string. */ @Override - public void setLogLevel(Level logLevel) { - super.setLogLevel(logLevel); - initializeService(); + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestReportServiceForAzure, 1.0.0"); + } + + private void initializeService() { + service = restClient().retrofit().create(AutoRestReportServiceForAzureService.class); } /** @@ -215,7 +180,7 @@ public void setLogLevel(Level logLevel) { interface AutoRestReportServiceForAzureService { @Headers("Content-Type: application/json; charset=utf-8") @GET("report/azure") - Call getReport(@Header("accept-language") String acceptLanguage); + Call getReport(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -227,7 +192,7 @@ interface AutoRestReportServiceForAzureService { * @return the Map<String, Integer> object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse> getReport() throws ErrorException, IOException { - Call call = service.getReport(this.getAcceptLanguage()); + Call call = service.getReport(this.acceptLanguage(), this.userAgent()); return getReportDelegate(call.execute()); } @@ -242,7 +207,7 @@ public ServiceCall getReportAsync(final ServiceCallback> se if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.getReport(this.getAcceptLanguage()); + Call call = service.getReport(this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -258,7 +223,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getReportDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder, ErrorException>(this.getMapperAdapter()) + return new AzureServiceResponseBuilder, ErrorException>(this.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/implementation/package-info.java new file mode 100644 index 0000000000000..769426621a74d --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestReportServiceForAzure. + * Test Infrastructure for AutoRest. + */ +package fixtures.azurereport.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/Error.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/Error.java index d8a9d6c0cdca1..e372134b84e89 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/Error.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/ErrorException.java index 980f97edeaf62..e3a1f253d2163 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/ErrorException.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.azurereport.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/package-info.java index 9cde5dda7d96a..10dd5da3f7c5e 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurereport/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestReportServiceForAzure. + * This package contains the models classes for AutoRestReportServiceForAzure. * Test Infrastructure for AutoRest. */ package fixtures.azurereport.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/AutoRestResourceFlatteningTestService.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/AutoRestResourceFlatteningTestService.java index 12aed18edea00..29d5722aacbf9 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/AutoRestResourceFlatteningTestService.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/AutoRestResourceFlatteningTestService.java @@ -12,9 +12,7 @@ import com.microsoft.azure.AzureClient; import com.microsoft.azure.Resource; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; +import com.microsoft.azure.RestClient; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -24,40 +22,17 @@ import java.io.IOException; import java.util.List; import java.util.Map; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; /** * The interface for AutoRestResourceFlatteningTestService class. */ public interface AutoRestResourceFlatteningTestService { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -66,53 +41,56 @@ public interface AutoRestResourceFlatteningTestService { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + AutoRestResourceFlatteningTestService withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + AutoRestResourceFlatteningTestService withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + AutoRestResourceFlatteningTestService withGenerateClientRequestId(boolean generateClientRequestId); /** * Put External Resource as an Array. diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/AutoRestResourceFlatteningTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/implementation/AutoRestResourceFlatteningTestServiceImpl.java similarity index 85% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/AutoRestResourceFlatteningTestServiceImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/implementation/AutoRestResourceFlatteningTestServiceImpl.java index 90ab59cae4f69..f10c7c580d376 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/AutoRestResourceFlatteningTestServiceImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/implementation/AutoRestResourceFlatteningTestServiceImpl.java @@ -8,30 +8,27 @@ * regenerated. */ -package fixtures.azureresource; +package fixtures.azureresource.implementation; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; import com.microsoft.azure.AzureServiceResponseBuilder; -import com.microsoft.azure.CustomHeaderInterceptor; import com.microsoft.azure.Resource; -import com.microsoft.rest.AutoRestBaseUrl; +import com.microsoft.azure.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; import com.microsoft.rest.Validator; +import fixtures.azureresource.AutoRestResourceFlatteningTestService; import fixtures.azureresource.models.ErrorException; import fixtures.azureresource.models.FlattenedProduct; import fixtures.azureresource.models.ResourceCollection; import java.io.IOException; import java.util.List; import java.util.Map; -import java.util.UUID; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import okhttp3.OkHttpClient; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.Body; @@ -40,28 +37,16 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** - * Initializes a new instance of the AutoRestResourceFlatteningTestService class. + * Initializes a new instance of the AutoRestResourceFlatteningTestServiceImpl class. */ public final class AutoRestResourceFlatteningTestServiceImpl extends AzureServiceClient implements AutoRestResourceFlatteningTestService { /** The Retrofit service to perform REST calls. */ private AutoRestResourceFlatteningTestServiceService service; - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - /** * Gets the {@link AzureClient} used for long running operations. * @return the azure client; @@ -70,18 +55,6 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - /** Gets or sets the preferred language for the response. */ private String acceptLanguage; @@ -90,7 +63,7 @@ public ServiceClientCredentials getCredentials() { * * @return the acceptLanguage value. */ - public String getAcceptLanguage() { + public String acceptLanguage() { return this.acceptLanguage; } @@ -98,9 +71,11 @@ public String getAcceptLanguage() { * Sets Gets or sets the preferred language for the response. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - public void setAcceptLanguage(String acceptLanguage) { + public AutoRestResourceFlatteningTestServiceImpl withAcceptLanguage(String acceptLanguage) { this.acceptLanguage = acceptLanguage; + return this; } /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ @@ -111,7 +86,7 @@ public void setAcceptLanguage(String acceptLanguage) { * * @return the longRunningOperationRetryTimeout value. */ - public int getLongRunningOperationRetryTimeout() { + public int longRunningOperationRetryTimeout() { return this.longRunningOperationRetryTimeout; } @@ -119,9 +94,11 @@ public int getLongRunningOperationRetryTimeout() { * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public AutoRestResourceFlatteningTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; } /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ @@ -132,7 +109,7 @@ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTim * * @return the generateClientRequestId value. */ - public boolean getGenerateClientRequestId() { + public boolean generateClientRequestId() { return this.generateClientRequestId; } @@ -140,9 +117,11 @@ public boolean getGenerateClientRequestId() { * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { + public AutoRestResourceFlatteningTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { this.generateClientRequestId = generateClientRequestId; + return this; } /** @@ -161,58 +140,44 @@ public AutoRestResourceFlatteningTestServiceImpl(ServiceClientCredentials creden * @param credentials the management credentials for Azure */ public AutoRestResourceFlatteningTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } /** * Initializes an instance of AutoRestResourceFlatteningTestService client. * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param restClient the REST client to connect to Azure. */ - public AutoRestResourceFlatteningTestServiceImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; + public AutoRestResourceFlatteningTestServiceImpl(RestClient restClient) { + super(restClient); initialize(); } - @Override protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); + this.azureClient = new AzureClient(this); initializeService(); } - private void initializeService() { - service = this.retrofitBuilder.client(this.clientBuilder.build()) - .build() - .create(AutoRestResourceFlatteningTestServiceService.class); - } - /** - * Sets the logging level for OkHttp client. + * Gets the User-Agent header for the client. * - * @param logLevel the logging level enum + * @return the user agent string. */ @Override - public void setLogLevel(Level logLevel) { - super.setLogLevel(logLevel); - initializeService(); + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestResourceFlatteningTestService, 1.0.0"); + } + + private void initializeService() { + service = restClient().retrofit().create(AutoRestResourceFlatteningTestServiceService.class); } /** @@ -222,27 +187,27 @@ public void setLogLevel(Level logLevel) { interface AutoRestResourceFlatteningTestServiceService { @Headers("Content-Type: application/json; charset=utf-8") @PUT("azure/resource-flatten/array") - Call putArray(@Body List resourceArray, @Header("accept-language") String acceptLanguage); + Call putArray(@Body List resourceArray, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azure/resource-flatten/array") - Call getArray(@Header("accept-language") String acceptLanguage); + Call getArray(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("azure/resource-flatten/dictionary") - Call putDictionary(@Body Map resourceDictionary, @Header("accept-language") String acceptLanguage); + Call putDictionary(@Body Map resourceDictionary, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azure/resource-flatten/dictionary") - Call getDictionary(@Header("accept-language") String acceptLanguage); + Call getDictionary(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("azure/resource-flatten/resourcecollection") - Call putResourceCollection(@Body ResourceCollection resourceComplexObject, @Header("accept-language") String acceptLanguage); + Call putResourceCollection(@Body ResourceCollection resourceComplexObject, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("azure/resource-flatten/resourcecollection") - Call getResourceCollection(@Header("accept-language") String acceptLanguage); + Call getResourceCollection(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -255,7 +220,7 @@ interface AutoRestResourceFlatteningTestServiceService { */ public ServiceResponse putArray() throws ErrorException, IOException { final List resourceArray = null; - Call call = service.putArray(resourceArray, this.getAcceptLanguage()); + Call call = service.putArray(resourceArray, this.acceptLanguage(), this.userAgent()); return putArrayDelegate(call.execute()); } @@ -271,7 +236,7 @@ public ServiceCall putArrayAsync(final ServiceCallback serviceCallback) th throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final List resourceArray = null; - Call call = service.putArray(resourceArray, this.getAcceptLanguage()); + Call call = service.putArray(resourceArray, this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -296,7 +261,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putArray(List resourceArray) throws ErrorException, IOException { Validator.validate(resourceArray); - Call call = service.putArray(resourceArray, this.getAcceptLanguage()); + Call call = service.putArray(resourceArray, this.acceptLanguage(), this.userAgent()); return putArrayDelegate(call.execute()); } @@ -313,7 +278,7 @@ public ServiceCall putArrayAsync(List resourceArray, final ServiceCall throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(resourceArray, serviceCallback); - Call call = service.putArray(resourceArray, this.getAcceptLanguage()); + Call call = service.putArray(resourceArray, this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -329,7 +294,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putArrayDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -343,7 +308,7 @@ private ServiceResponse putArrayDelegate(Response response) * @return the List<FlattenedProduct> object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse> getArray() throws ErrorException, IOException { - Call call = service.getArray(this.getAcceptLanguage()); + Call call = service.getArray(this.acceptLanguage(), this.userAgent()); return getArrayDelegate(call.execute()); } @@ -358,7 +323,7 @@ public ServiceCall getArrayAsync(final ServiceCallback> s if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.getArray(this.getAcceptLanguage()); + Call call = service.getArray(this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -374,7 +339,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getArrayDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder, ErrorException>(this.getMapperAdapter()) + return new AzureServiceResponseBuilder, ErrorException>(this.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -389,7 +354,7 @@ private ServiceResponse> getArrayDelegate(Response putDictionary() throws ErrorException, IOException { final Map resourceDictionary = null; - Call call = service.putDictionary(resourceDictionary, this.getAcceptLanguage()); + Call call = service.putDictionary(resourceDictionary, this.acceptLanguage(), this.userAgent()); return putDictionaryDelegate(call.execute()); } @@ -405,7 +370,7 @@ public ServiceCall putDictionaryAsync(final ServiceCallback serviceCallbac throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Map resourceDictionary = null; - Call call = service.putDictionary(resourceDictionary, this.getAcceptLanguage()); + Call call = service.putDictionary(resourceDictionary, this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -430,7 +395,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putDictionary(Map resourceDictionary) throws ErrorException, IOException { Validator.validate(resourceDictionary); - Call call = service.putDictionary(resourceDictionary, this.getAcceptLanguage()); + Call call = service.putDictionary(resourceDictionary, this.acceptLanguage(), this.userAgent()); return putDictionaryDelegate(call.execute()); } @@ -447,7 +412,7 @@ public ServiceCall putDictionaryAsync(Map resourceDict throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(resourceDictionary, serviceCallback); - Call call = service.putDictionary(resourceDictionary, this.getAcceptLanguage()); + Call call = service.putDictionary(resourceDictionary, this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -463,7 +428,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDictionaryDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -477,7 +442,7 @@ private ServiceResponse putDictionaryDelegate(Response respo * @return the Map<String, FlattenedProduct> object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse> getDictionary() throws ErrorException, IOException { - Call call = service.getDictionary(this.getAcceptLanguage()); + Call call = service.getDictionary(this.acceptLanguage(), this.userAgent()); return getDictionaryDelegate(call.execute()); } @@ -492,7 +457,7 @@ public ServiceCall getDictionaryAsync(final ServiceCallback call = service.getDictionary(this.getAcceptLanguage()); + Call call = service.getDictionary(this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -508,7 +473,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDictionaryDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder, ErrorException>(this.getMapperAdapter()) + return new AzureServiceResponseBuilder, ErrorException>(this.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -523,7 +488,7 @@ private ServiceResponse> getDictionaryDelegate(Res */ public ServiceResponse putResourceCollection() throws ErrorException, IOException { final ResourceCollection resourceComplexObject = null; - Call call = service.putResourceCollection(resourceComplexObject, this.getAcceptLanguage()); + Call call = service.putResourceCollection(resourceComplexObject, this.acceptLanguage(), this.userAgent()); return putResourceCollectionDelegate(call.execute()); } @@ -539,7 +504,7 @@ public ServiceCall putResourceCollectionAsync(final ServiceCallback servic throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final ResourceCollection resourceComplexObject = null; - Call call = service.putResourceCollection(resourceComplexObject, this.getAcceptLanguage()); + Call call = service.putResourceCollection(resourceComplexObject, this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -564,7 +529,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putResourceCollection(ResourceCollection resourceComplexObject) throws ErrorException, IOException { Validator.validate(resourceComplexObject); - Call call = service.putResourceCollection(resourceComplexObject, this.getAcceptLanguage()); + Call call = service.putResourceCollection(resourceComplexObject, this.acceptLanguage(), this.userAgent()); return putResourceCollectionDelegate(call.execute()); } @@ -581,7 +546,7 @@ public ServiceCall putResourceCollectionAsync(ResourceCollection resourceComplex throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(resourceComplexObject, serviceCallback); - Call call = service.putResourceCollection(resourceComplexObject, this.getAcceptLanguage()); + Call call = service.putResourceCollection(resourceComplexObject, this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -597,7 +562,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putResourceCollectionDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -611,7 +576,7 @@ private ServiceResponse putResourceCollectionDelegate(Response getResourceCollection() throws ErrorException, IOException { - Call call = service.getResourceCollection(this.getAcceptLanguage()); + Call call = service.getResourceCollection(this.acceptLanguage(), this.userAgent()); return getResourceCollectionDelegate(call.execute()); } @@ -626,7 +591,7 @@ public ServiceCall getResourceCollectionAsync(final ServiceCallback call = service.getResourceCollection(this.getAcceptLanguage()); + Call call = service.getResourceCollection(this.acceptLanguage(), this.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -642,7 +607,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getResourceCollectionDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/implementation/package-info.java new file mode 100644 index 0000000000000..941141e066cd5 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestResourceFlatteningTestService. + * Resource Flattening for AutoRest. + */ +package fixtures.azureresource.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/Error.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/Error.java index 84a7f7858ae9d..56a5f04054c5d 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/Error.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/ErrorException.java index 9ccaa93632d5d..55b2178241617 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/ErrorException.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.azureresource.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/FlattenedProduct.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/FlattenedProduct.java index 3492b8c8fe997..e16a7fe3b83ce 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/FlattenedProduct.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/FlattenedProduct.java @@ -42,7 +42,7 @@ public class FlattenedProduct extends Resource { * * @return the pname value */ - public String getPname() { + public String pname() { return this.pname; } @@ -50,9 +50,11 @@ public String getPname() { * Set the pname value. * * @param pname the pname value to set + * @return the FlattenedProduct object itself. */ - public void setPname(String pname) { + public FlattenedProduct withPname(String pname) { this.pname = pname; + return this; } /** @@ -60,7 +62,7 @@ public void setPname(String pname) { * * @return the lsize value */ - public Integer getLsize() { + public Integer lsize() { return this.lsize; } @@ -68,9 +70,11 @@ public Integer getLsize() { * Set the lsize value. * * @param lsize the lsize value to set + * @return the FlattenedProduct object itself. */ - public void setLsize(Integer lsize) { + public FlattenedProduct withLsize(Integer lsize) { this.lsize = lsize; + return this; } /** @@ -78,7 +82,7 @@ public void setLsize(Integer lsize) { * * @return the provisioningState value */ - public String getProvisioningState() { + public String provisioningState() { return this.provisioningState; } @@ -86,9 +90,11 @@ public String getProvisioningState() { * Set the provisioningState value. * * @param provisioningState the provisioningState value to set + * @return the FlattenedProduct object itself. */ - public void setProvisioningState(String provisioningState) { + public FlattenedProduct withProvisioningState(String provisioningState) { this.provisioningState = provisioningState; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/ResourceCollection.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/ResourceCollection.java index 935ee81b68a85..0069ae2cc152d 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/ResourceCollection.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/ResourceCollection.java @@ -37,7 +37,7 @@ public class ResourceCollection { * * @return the productresource value */ - public FlattenedProduct getProductresource() { + public FlattenedProduct productresource() { return this.productresource; } @@ -45,9 +45,11 @@ public FlattenedProduct getProductresource() { * Set the productresource value. * * @param productresource the productresource value to set + * @return the ResourceCollection object itself. */ - public void setProductresource(FlattenedProduct productresource) { + public ResourceCollection withProductresource(FlattenedProduct productresource) { this.productresource = productresource; + return this; } /** @@ -55,7 +57,7 @@ public void setProductresource(FlattenedProduct productresource) { * * @return the arrayofresources value */ - public List getArrayofresources() { + public List arrayofresources() { return this.arrayofresources; } @@ -63,9 +65,11 @@ public List getArrayofresources() { * Set the arrayofresources value. * * @param arrayofresources the arrayofresources value to set + * @return the ResourceCollection object itself. */ - public void setArrayofresources(List arrayofresources) { + public ResourceCollection withArrayofresources(List arrayofresources) { this.arrayofresources = arrayofresources; + return this; } /** @@ -73,7 +77,7 @@ public void setArrayofresources(List arrayofresources) { * * @return the dictionaryofresources value */ - public Map getDictionaryofresources() { + public Map dictionaryofresources() { return this.dictionaryofresources; } @@ -81,9 +85,11 @@ public Map getDictionaryofresources() { * Set the dictionaryofresources value. * * @param dictionaryofresources the dictionaryofresources value to set + * @return the ResourceCollection object itself. */ - public void setDictionaryofresources(Map dictionaryofresources) { + public ResourceCollection withDictionaryofresources(Map dictionaryofresources) { this.dictionaryofresources = dictionaryofresources; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/package-info.java index ff22e3f8dcd88..2c484ffc3d395 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azureresource/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestResourceFlatteningTestService. + * This package contains the models classes for AutoRestResourceFlatteningTestService. * Resource Flattening for AutoRest. */ package fixtures.azureresource.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionDefaultOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionDefaults.java similarity index 98% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionDefaultOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionDefaults.java index 731181c85e2eb..061e84d9824fa 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionDefaultOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionDefaults.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in ApiVersionDefaultOperations. + * in ApiVersionDefaults. */ -public interface ApiVersionDefaultOperations { +public interface ApiVersionDefaults { /** * GET method with api-version modeled in global settings. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocalOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocals.java similarity index 98% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocalOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocals.java index a1b713c32d322..14149f844f2fc 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocalOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/ApiVersionLocals.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in ApiVersionLocalOperations. + * in ApiVersionLocals. */ -public interface ApiVersionLocalOperations { +public interface ApiVersionLocals { /** * Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/AutoRestAzureSpecialParametersTestClient.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/AutoRestAzureSpecialParametersTestClient.java index 874384d4176e6..962f57e016aa9 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/AutoRestAzureSpecialParametersTestClient.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/AutoRestAzureSpecialParametersTestClient.java @@ -11,44 +11,18 @@ package fixtures.azurespecials; import com.microsoft.azure.AzureClient; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; +import com.microsoft.azure.RestClient; /** * The interface for AutoRestAzureSpecialParametersTestClient class. */ public interface AutoRestAzureSpecialParametersTestClient { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -57,121 +31,125 @@ public interface AutoRestAzureSpecialParametersTestClient { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. * * @return the subscriptionId value. */ - String getSubscriptionId(); + String subscriptionId(); /** * Sets The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. * * @param subscriptionId the subscriptionId value. + * @return the service client itself */ - void setSubscriptionId(String subscriptionId); + AutoRestAzureSpecialParametersTestClient withSubscriptionId(String subscriptionId); /** * Gets The api version, which appears in the query, the value is always '2015-07-01-preview'. * * @return the apiVersion value. */ - String getApiVersion(); + String apiVersion(); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + AutoRestAzureSpecialParametersTestClient withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + AutoRestAzureSpecialParametersTestClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + AutoRestAzureSpecialParametersTestClient withGenerateClientRequestId(boolean generateClientRequestId); /** - * Gets the XMsClientRequestIdOperations object to access its operations. - * @return the XMsClientRequestIdOperations object. + * Gets the XMsClientRequestIds object to access its operations. + * @return the XMsClientRequestIds object. */ - XMsClientRequestIdOperations getXMsClientRequestIdOperations(); + XMsClientRequestIds xMsClientRequestIds(); /** - * Gets the SubscriptionInCredentialsOperations object to access its operations. - * @return the SubscriptionInCredentialsOperations object. + * Gets the SubscriptionInCredentials object to access its operations. + * @return the SubscriptionInCredentials object. */ - SubscriptionInCredentialsOperations getSubscriptionInCredentialsOperations(); + SubscriptionInCredentials subscriptionInCredentials(); /** - * Gets the SubscriptionInMethodOperations object to access its operations. - * @return the SubscriptionInMethodOperations object. + * Gets the SubscriptionInMethods object to access its operations. + * @return the SubscriptionInMethods object. */ - SubscriptionInMethodOperations getSubscriptionInMethodOperations(); + SubscriptionInMethods subscriptionInMethods(); /** - * Gets the ApiVersionDefaultOperations object to access its operations. - * @return the ApiVersionDefaultOperations object. + * Gets the ApiVersionDefaults object to access its operations. + * @return the ApiVersionDefaults object. */ - ApiVersionDefaultOperations getApiVersionDefaultOperations(); + ApiVersionDefaults apiVersionDefaults(); /** - * Gets the ApiVersionLocalOperations object to access its operations. - * @return the ApiVersionLocalOperations object. + * Gets the ApiVersionLocals object to access its operations. + * @return the ApiVersionLocals object. */ - ApiVersionLocalOperations getApiVersionLocalOperations(); + ApiVersionLocals apiVersionLocals(); /** - * Gets the SkipUrlEncodingOperations object to access its operations. - * @return the SkipUrlEncodingOperations object. + * Gets the SkipUrlEncodings object to access its operations. + * @return the SkipUrlEncodings object. */ - SkipUrlEncodingOperations getSkipUrlEncodingOperations(); + SkipUrlEncodings skipUrlEncodings(); /** - * Gets the OdataOperations object to access its operations. - * @return the OdataOperations object. + * Gets the Odatas object to access its operations. + * @return the Odatas object. */ - OdataOperations getOdataOperations(); + Odatas odatas(); /** - * Gets the HeaderOperations object to access its operations. - * @return the HeaderOperations object. + * Gets the Headers object to access its operations. + * @return the Headers object. */ - HeaderOperations getHeaderOperations(); + Headers headers(); } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/AutoRestAzureSpecialParametersTestClientImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/AutoRestAzureSpecialParametersTestClientImpl.java deleted file mode 100644 index b8b936ed4758d..0000000000000 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/AutoRestAzureSpecialParametersTestClientImpl.java +++ /dev/null @@ -1,272 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -package fixtures.azurespecials; - -import com.microsoft.azure.AzureClient; -import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.CustomHeaderInterceptor; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import java.util.UUID; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; - -/** - * Initializes a new instance of the AutoRestAzureSpecialParametersTestClient class. - */ -public final class AutoRestAzureSpecialParametersTestClientImpl extends AzureServiceClient implements AutoRestAzureSpecialParametersTestClient { - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; - /** the {@link AzureClient} used for long running operations. */ - private AzureClient azureClient; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - - /** - * Gets the {@link AzureClient} used for long running operations. - * @return the azure client; - */ - public AzureClient getAzureClient() { - return this.azureClient; - } - - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - - /** The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. */ - private String subscriptionId; - - /** - * Gets The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * Sets The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. - * - * @param subscriptionId the subscriptionId value. - */ - public void setSubscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - } - - /** The api version, which appears in the query, the value is always '2015-07-01-preview'. */ - private String apiVersion; - - /** - * Gets The api version, which appears in the query, the value is always '2015-07-01-preview'. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** Gets or sets the preferred language for the response. */ - private String acceptLanguage; - - /** - * Gets Gets or sets the preferred language for the response. - * - * @return the acceptLanguage value. - */ - public String getAcceptLanguage() { - return this.acceptLanguage; - } - - /** - * Sets Gets or sets the preferred language for the response. - * - * @param acceptLanguage the acceptLanguage value. - */ - public void setAcceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - } - - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ - private int longRunningOperationRetryTimeout; - - /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * - * @return the longRunningOperationRetryTimeout value. - */ - public int getLongRunningOperationRetryTimeout() { - return this.longRunningOperationRetryTimeout; - } - - /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * - * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. - */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { - this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; - } - - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ - private boolean generateClientRequestId; - - /** - * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - * - * @return the generateClientRequestId value. - */ - public boolean getGenerateClientRequestId() { - return this.generateClientRequestId; - } - - /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - * - * @param generateClientRequestId the generateClientRequestId value. - */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { - this.generateClientRequestId = generateClientRequestId; - } - - /** - * Gets the XMsClientRequestIdOperations object to access its operations. - * @return the XMsClientRequestIdOperations object. - */ - public XMsClientRequestIdOperations getXMsClientRequestIdOperations() { - return new XMsClientRequestIdOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the SubscriptionInCredentialsOperations object to access its operations. - * @return the SubscriptionInCredentialsOperations object. - */ - public SubscriptionInCredentialsOperations getSubscriptionInCredentialsOperations() { - return new SubscriptionInCredentialsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the SubscriptionInMethodOperations object to access its operations. - * @return the SubscriptionInMethodOperations object. - */ - public SubscriptionInMethodOperations getSubscriptionInMethodOperations() { - return new SubscriptionInMethodOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the ApiVersionDefaultOperations object to access its operations. - * @return the ApiVersionDefaultOperations object. - */ - public ApiVersionDefaultOperations getApiVersionDefaultOperations() { - return new ApiVersionDefaultOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the ApiVersionLocalOperations object to access its operations. - * @return the ApiVersionLocalOperations object. - */ - public ApiVersionLocalOperations getApiVersionLocalOperations() { - return new ApiVersionLocalOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the SkipUrlEncodingOperations object to access its operations. - * @return the SkipUrlEncodingOperations object. - */ - public SkipUrlEncodingOperations getSkipUrlEncodingOperations() { - return new SkipUrlEncodingOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the OdataOperations object to access its operations. - * @return the OdataOperations object. - */ - public OdataOperations getOdataOperations() { - return new OdataOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the HeaderOperations object to access its operations. - * @return the HeaderOperations object. - */ - public HeaderOperations getHeaderOperations() { - return new HeaderOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Initializes an instance of AutoRestAzureSpecialParametersTestClient client. - * - * @param credentials the management credentials for Azure - */ - public AutoRestAzureSpecialParametersTestClientImpl(ServiceClientCredentials credentials) { - this("http://localhost", credentials); - } - - /** - * Initializes an instance of AutoRestAzureSpecialParametersTestClient client. - * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - */ - public AutoRestAzureSpecialParametersTestClientImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); - } - - /** - * Initializes an instance of AutoRestAzureSpecialParametersTestClient client. - * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} - */ - public AutoRestAzureSpecialParametersTestClientImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); - } - - @Override - protected void initialize() { - this.apiVersion = "2015-07-01-preview"; - this.acceptLanguage = "en-US"; - this.longRunningOperationRetryTimeout = 30; - this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); - } -} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/HeaderOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/Headers.java similarity index 98% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/HeaderOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/Headers.java index 2c188bbe53549..d8ae08de803eb 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/HeaderOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/Headers.java @@ -21,9 +21,9 @@ /** * An instance of this class provides access to all the operations defined - * in HeaderOperations. + * in Headers. */ -public interface HeaderOperations { +public interface Headers { /** * Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/OdataOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/Odatas.java similarity index 86% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/OdataOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/Odatas.java index c74bdaf0fdf5b..1aa935bcc6e5d 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/OdataOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/Odatas.java @@ -14,14 +14,13 @@ import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import fixtures.azurespecials.models.ErrorException; -import fixtures.azurespecials.models.OdataFilter; import java.io.IOException; /** * An instance of this class provides access to all the operations defined - * in OdataOperations. + * in Odatas. */ -public interface OdataOperations { +public interface Odatas { /** * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. * @@ -49,7 +48,7 @@ public interface OdataOperations { * @throws IOException exception thrown from serialization/deserialization * @return the {@link ServiceResponse} object if successful. */ - ServiceResponse getWithFilter(OdataFilter filter, Integer top, String orderby) throws ErrorException, IOException; + ServiceResponse getWithFilter(String filter, Integer top, String orderby) throws ErrorException, IOException; /** * Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. @@ -61,6 +60,6 @@ public interface OdataOperations { * @throws IllegalArgumentException thrown if callback is null * @return the {@link ServiceCall} object */ - ServiceCall getWithFilterAsync(OdataFilter filter, Integer top, String orderby, final ServiceCallback serviceCallback) throws IllegalArgumentException; + ServiceCall getWithFilterAsync(String filter, Integer top, String orderby, final ServiceCallback serviceCallback) throws IllegalArgumentException; } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SkipUrlEncodingOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SkipUrlEncodings.java similarity index 99% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SkipUrlEncodingOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SkipUrlEncodings.java index e1ecd6e89c455..62a85cfd3ab61 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SkipUrlEncodingOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SkipUrlEncodings.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in SkipUrlEncodingOperations. + * in SkipUrlEncodings. */ -public interface SkipUrlEncodingOperations { +public interface SkipUrlEncodings { /** * Get method with unencoded path parameter with value 'path1/path2/path3'. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentialsOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentials.java similarity index 98% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentialsOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentials.java index c0e1a94b09e0b..61661c8f5cd18 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentialsOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentials.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in SubscriptionInCredentialsOperations. + * in SubscriptionInCredentials. */ -public interface SubscriptionInCredentialsOperations { +public interface SubscriptionInCredentials { /** * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInMethodOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInMethods.java similarity index 98% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInMethodOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInMethods.java index 28695ceadf11d..f67c6a211a940 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInMethodOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInMethods.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in SubscriptionInMethodOperations. + * in SubscriptionInMethods. */ -public interface SubscriptionInMethodOperations { +public interface SubscriptionInMethods { /** * POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/XMsClientRequestIdOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/XMsClientRequestIds.java similarity index 97% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/XMsClientRequestIdOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/XMsClientRequestIds.java index 2a8f44d7592aa..e71d9fe3102ad 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/XMsClientRequestIdOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/XMsClientRequestIds.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in XMsClientRequestIdOperations. + * in XMsClientRequestIds. */ -public interface XMsClientRequestIdOperations { +public interface XMsClientRequestIds { /** * Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionDefaultsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionDefaultsImpl.java new file mode 100644 index 0000000000000..c6823e2bf5eb2 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionDefaultsImpl.java @@ -0,0 +1,287 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import retrofit2.Retrofit; +import fixtures.azurespecials.ApiVersionDefaults; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.azurespecials.models.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in ApiVersionDefaults. + */ +public final class ApiVersionDefaultsImpl implements ApiVersionDefaults { + /** The Retrofit service to perform REST calls. */ + private ApiVersionDefaultsService service; + /** The service client containing this operation class. */ + private AutoRestAzureSpecialParametersTestClientImpl client; + + /** + * Initializes an instance of ApiVersionDefaultsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiVersionDefaultsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(ApiVersionDefaultsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiVersionDefaults to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiVersionDefaultsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview") + Call getMethodGlobalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview") + Call getMethodGlobalNotProvidedValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview") + Call getPathGlobalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview") + Call getSwaggerGlobalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * GET method with api-version modeled in global settings. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getMethodGlobalValid() throws ErrorException, IOException, IllegalArgumentException { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Call call = service.getMethodGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return getMethodGlobalValidDelegate(call.execute()); + } + + /** + * GET method with api-version modeled in global settings. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMethodGlobalValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); + return null; + } + Call call = service.getMethodGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getMethodGlobalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getMethodGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * GET method with api-version modeled in global settings. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getMethodGlobalNotProvidedValid() throws ErrorException, IOException, IllegalArgumentException { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Call call = service.getMethodGlobalNotProvidedValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return getMethodGlobalNotProvidedValidDelegate(call.execute()); + } + + /** + * GET method with api-version modeled in global settings. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMethodGlobalNotProvidedValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); + return null; + } + Call call = service.getMethodGlobalNotProvidedValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getMethodGlobalNotProvidedValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getMethodGlobalNotProvidedValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * GET method with api-version modeled in global settings. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getPathGlobalValid() throws ErrorException, IOException, IllegalArgumentException { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Call call = service.getPathGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return getPathGlobalValidDelegate(call.execute()); + } + + /** + * GET method with api-version modeled in global settings. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getPathGlobalValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); + return null; + } + Call call = service.getPathGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getPathGlobalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getPathGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * GET method with api-version modeled in global settings. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getSwaggerGlobalValid() throws ErrorException, IOException, IllegalArgumentException { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Call call = service.getSwaggerGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return getSwaggerGlobalValidDelegate(call.execute()); + } + + /** + * GET method with api-version modeled in global settings. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getSwaggerGlobalValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); + return null; + } + Call call = service.getSwaggerGlobalValid(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getSwaggerGlobalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getSwaggerGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionLocalsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionLocalsImpl.java new file mode 100644 index 0000000000000..e14afc96f52fc --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/ApiVersionLocalsImpl.java @@ -0,0 +1,303 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import retrofit2.Retrofit; +import fixtures.azurespecials.ApiVersionLocals; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.azurespecials.models.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in ApiVersionLocals. + */ +public final class ApiVersionLocalsImpl implements ApiVersionLocals { + /** The Retrofit service to perform REST calls. */ + private ApiVersionLocalsService service; + /** The service client containing this operation class. */ + private AutoRestAzureSpecialParametersTestClientImpl client; + + /** + * Initializes an instance of ApiVersionLocalsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiVersionLocalsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(ApiVersionLocalsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiVersionLocals to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiVersionLocalsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/apiVersion/method/string/none/query/local/2.0") + Call getMethodLocalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/apiVersion/method/string/none/query/local/null") + Call getMethodLocalNull(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/apiVersion/path/string/none/query/local/2.0") + Call getPathLocalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/apiVersion/swagger/string/none/query/local/2.0") + Call getSwaggerLocalValid(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getMethodLocalValid() throws ErrorException, IOException { + final String apiVersion = "2.0"; + Call call = service.getMethodLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return getMethodLocalValidDelegate(call.execute()); + } + + /** + * Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMethodLocalValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String apiVersion = "2.0"; + Call call = service.getMethodLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getMethodLocalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getMethodLocalValidDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get method with api-version modeled in the method. pass in api-version = null to succeed. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getMethodLocalNull() throws ErrorException, IOException { + final String apiVersion = null; + Call call = service.getMethodLocalNull(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return getMethodLocalNullDelegate(call.execute()); + } + + /** + * Get method with api-version modeled in the method. pass in api-version = null to succeed. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMethodLocalNullAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String apiVersion = null; + Call call = service.getMethodLocalNull(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getMethodLocalNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Get method with api-version modeled in the method. pass in api-version = null to succeed. + * + * @param apiVersion This should appear as a method parameter, use value null, this should result in no serialized parameter + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getMethodLocalNull(String apiVersion) throws ErrorException, IOException { + Call call = service.getMethodLocalNull(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return getMethodLocalNullDelegate(call.execute()); + } + + /** + * Get method with api-version modeled in the method. pass in api-version = null to succeed. + * + * @param apiVersion This should appear as a method parameter, use value null, this should result in no serialized parameter + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMethodLocalNullAsync(String apiVersion, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getMethodLocalNull(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getMethodLocalNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getMethodLocalNullDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getPathLocalValid() throws ErrorException, IOException { + final String apiVersion = "2.0"; + Call call = service.getPathLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return getPathLocalValidDelegate(call.execute()); + } + + /** + * Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getPathLocalValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String apiVersion = "2.0"; + Call call = service.getPathLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getPathLocalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getPathLocalValidDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getSwaggerLocalValid() throws ErrorException, IOException { + final String apiVersion = "2.0"; + Call call = service.getSwaggerLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return getSwaggerLocalValidDelegate(call.execute()); + } + + /** + * Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getSwaggerLocalValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String apiVersion = "2.0"; + Call call = service.getSwaggerLocalValid(apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getSwaggerLocalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getSwaggerLocalValidDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/AutoRestAzureSpecialParametersTestClientImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/AutoRestAzureSpecialParametersTestClientImpl.java new file mode 100644 index 0000000000000..dd9e12a4ec90e --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/AutoRestAzureSpecialParametersTestClientImpl.java @@ -0,0 +1,309 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import fixtures.azurespecials.ApiVersionDefaults; +import fixtures.azurespecials.ApiVersionLocals; +import fixtures.azurespecials.AutoRestAzureSpecialParametersTestClient; +import fixtures.azurespecials.Headers; +import fixtures.azurespecials.Odatas; +import fixtures.azurespecials.SkipUrlEncodings; +import fixtures.azurespecials.SubscriptionInCredentials; +import fixtures.azurespecials.SubscriptionInMethods; +import fixtures.azurespecials.XMsClientRequestIds; + +/** + * Initializes a new instance of the AutoRestAzureSpecialParametersTestClientImpl class. + */ +public final class AutoRestAzureSpecialParametersTestClientImpl extends AzureServiceClient implements AutoRestAzureSpecialParametersTestClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. */ + private String subscriptionId; + + /** + * Gets The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AutoRestAzureSpecialParametersTestClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The api version, which appears in the query, the value is always '2015-07-01-preview'. */ + private String apiVersion; + + /** + * Gets The api version, which appears in the query, the value is always '2015-07-01-preview'. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AutoRestAzureSpecialParametersTestClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AutoRestAzureSpecialParametersTestClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AutoRestAzureSpecialParametersTestClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The XMsClientRequestIds object to access its operations. + */ + private XMsClientRequestIds xMsClientRequestIds; + + /** + * Gets the XMsClientRequestIds object to access its operations. + * @return the XMsClientRequestIds object. + */ + public XMsClientRequestIds xMsClientRequestIds() { + return this.xMsClientRequestIds; + } + + /** + * The SubscriptionInCredentials object to access its operations. + */ + private SubscriptionInCredentials subscriptionInCredentials; + + /** + * Gets the SubscriptionInCredentials object to access its operations. + * @return the SubscriptionInCredentials object. + */ + public SubscriptionInCredentials subscriptionInCredentials() { + return this.subscriptionInCredentials; + } + + /** + * The SubscriptionInMethods object to access its operations. + */ + private SubscriptionInMethods subscriptionInMethods; + + /** + * Gets the SubscriptionInMethods object to access its operations. + * @return the SubscriptionInMethods object. + */ + public SubscriptionInMethods subscriptionInMethods() { + return this.subscriptionInMethods; + } + + /** + * The ApiVersionDefaults object to access its operations. + */ + private ApiVersionDefaults apiVersionDefaults; + + /** + * Gets the ApiVersionDefaults object to access its operations. + * @return the ApiVersionDefaults object. + */ + public ApiVersionDefaults apiVersionDefaults() { + return this.apiVersionDefaults; + } + + /** + * The ApiVersionLocals object to access its operations. + */ + private ApiVersionLocals apiVersionLocals; + + /** + * Gets the ApiVersionLocals object to access its operations. + * @return the ApiVersionLocals object. + */ + public ApiVersionLocals apiVersionLocals() { + return this.apiVersionLocals; + } + + /** + * The SkipUrlEncodings object to access its operations. + */ + private SkipUrlEncodings skipUrlEncodings; + + /** + * Gets the SkipUrlEncodings object to access its operations. + * @return the SkipUrlEncodings object. + */ + public SkipUrlEncodings skipUrlEncodings() { + return this.skipUrlEncodings; + } + + /** + * The Odatas object to access its operations. + */ + private Odatas odatas; + + /** + * Gets the Odatas object to access its operations. + * @return the Odatas object. + */ + public Odatas odatas() { + return this.odatas; + } + + /** + * The Headers object to access its operations. + */ + private Headers headers; + + /** + * Gets the Headers object to access its operations. + * @return the Headers object. + */ + public Headers headers() { + return this.headers; + } + + /** + * Initializes an instance of AutoRestAzureSpecialParametersTestClient client. + * + * @param credentials the management credentials for Azure + */ + public AutoRestAzureSpecialParametersTestClientImpl(ServiceClientCredentials credentials) { + this("http://localhost", credentials); + } + + /** + * Initializes an instance of AutoRestAzureSpecialParametersTestClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AutoRestAzureSpecialParametersTestClientImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of AutoRestAzureSpecialParametersTestClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AutoRestAzureSpecialParametersTestClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-07-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.xMsClientRequestIds = new XMsClientRequestIdsImpl(restClient().retrofit(), this); + this.subscriptionInCredentials = new SubscriptionInCredentialsImpl(restClient().retrofit(), this); + this.subscriptionInMethods = new SubscriptionInMethodsImpl(restClient().retrofit(), this); + this.apiVersionDefaults = new ApiVersionDefaultsImpl(restClient().retrofit(), this); + this.apiVersionLocals = new ApiVersionLocalsImpl(restClient().retrofit(), this); + this.skipUrlEncodings = new SkipUrlEncodingsImpl(restClient().retrofit(), this); + this.odatas = new OdatasImpl(restClient().retrofit(), this); + this.headers = new HeadersImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestAzureSpecialParametersTestClient, 2015-07-01-preview"); + } +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/HeaderOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/HeadersImpl.java similarity index 88% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/HeaderOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/HeadersImpl.java index 316d527ee4f87..e62de92c6d763 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/HeaderOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/HeadersImpl.java @@ -8,8 +8,9 @@ * regenerated. */ -package fixtures.azurespecials; +package fixtures.azurespecials.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; @@ -28,41 +29,40 @@ import retrofit2.http.Headers; import retrofit2.http.POST; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HeaderOperations. + * in Headers. */ -public final class HeaderOperationsImpl implements HeaderOperations { +public final class HeadersImpl implements fixtures.azurespecials.Headers { /** The Retrofit service to perform REST calls. */ - private HeaderService service; + private HeadersService service; /** The service client containing this operation class. */ - private AutoRestAzureSpecialParametersTestClient client; + private AutoRestAzureSpecialParametersTestClientImpl client; /** - * Initializes an instance of HeaderOperations. + * Initializes an instance of HeadersImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HeaderOperationsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClient client) { - this.service = retrofit.create(HeaderService.class); + public HeadersImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(HeadersService.class); this.client = client; } /** - * The interface defining all the services for HeaderOperations to be + * The interface defining all the services for Headers to be * used by Retrofit to perform actually REST calls. */ - interface HeaderService { + interface HeadersService { @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/customNamedRequestId") - Call customNamedRequestId(@Header("foo-client-request-id") String fooClientRequestId, @Header("accept-language") String acceptLanguage); + Call customNamedRequestId(@Header("foo-client-request-id") String fooClientRequestId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("azurespecials/customNamedRequestIdParamGrouping") - Call customNamedRequestIdParamGrouping(@Header("accept-language") String acceptLanguage, @Header("foo-client-request-id") String fooClientRequestId); + Call customNamedRequestIdParamGrouping(@Header("accept-language") String acceptLanguage, @Header("foo-client-request-id") String fooClientRequestId, @Header("User-Agent") String userAgent); } @@ -79,7 +79,7 @@ public ServiceResponseWithHeaders custo if (fooClientRequestId == null) { throw new IllegalArgumentException("Parameter fooClientRequestId is required and cannot be null."); } - Call call = service.customNamedRequestId(fooClientRequestId, this.client.getAcceptLanguage()); + Call call = service.customNamedRequestId(fooClientRequestId, this.client.acceptLanguage(), this.client.userAgent()); return customNamedRequestIdDelegate(call.execute()); } @@ -99,7 +99,7 @@ public ServiceCall customNamedRequestIdAsync(String fooClientRequestId, final Se serviceCallback.failure(new IllegalArgumentException("Parameter fooClientRequestId is required and cannot be null.")); return null; } - Call call = service.customNamedRequestId(fooClientRequestId, this.client.getAcceptLanguage()); + Call call = service.customNamedRequestId(fooClientRequestId, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -115,7 +115,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders customNamedRequestIdDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderCustomNamedRequestIdHeaders.class); @@ -135,8 +135,8 @@ public ServiceResponseWithHeaders call = service.customNamedRequestIdParamGrouping(this.client.getAcceptLanguage(), fooClientRequestId); + String fooClientRequestId = headerCustomNamedRequestIdParamGroupingParameters.fooClientRequestId(); + Call call = service.customNamedRequestIdParamGrouping(this.client.acceptLanguage(), fooClientRequestId, this.client.userAgent()); return customNamedRequestIdParamGroupingDelegate(call.execute()); } @@ -157,8 +157,8 @@ public ServiceCall customNamedRequestIdParamGroupingAsync(HeaderCustomNamedReque return null; } Validator.validate(headerCustomNamedRequestIdParamGroupingParameters, serviceCallback); - String fooClientRequestId = headerCustomNamedRequestIdParamGroupingParameters.getFooClientRequestId(); - Call call = service.customNamedRequestIdParamGrouping(this.client.getAcceptLanguage(), fooClientRequestId); + String fooClientRequestId = headerCustomNamedRequestIdParamGroupingParameters.fooClientRequestId(); + Call call = service.customNamedRequestIdParamGrouping(this.client.acceptLanguage(), fooClientRequestId, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -174,7 +174,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders customNamedRequestIdParamGroupingDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderCustomNamedRequestIdParamGroupingHeaders.class); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/OdataOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/OdatasImpl.java similarity index 79% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/OdataOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/OdatasImpl.java index 75777653172cf..15a87af80b769 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/OdataOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/OdatasImpl.java @@ -8,17 +8,17 @@ * regenerated. */ -package fixtures.azurespecials; +package fixtures.azurespecials.implementation; +import retrofit2.Retrofit; +import fixtures.azurespecials.Odatas; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; -import com.microsoft.rest.Validator; import fixtures.azurespecials.models.ErrorException; -import fixtures.azurespecials.models.OdataFilter; import java.io.IOException; import okhttp3.ResponseBody; import retrofit2.Call; @@ -27,37 +27,36 @@ import retrofit2.http.Headers; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in OdataOperations. + * in Odatas. */ -public final class OdataOperationsImpl implements OdataOperations { +public final class OdatasImpl implements Odatas { /** The Retrofit service to perform REST calls. */ - private OdataService service; + private OdatasService service; /** The service client containing this operation class. */ - private AutoRestAzureSpecialParametersTestClient client; + private AutoRestAzureSpecialParametersTestClientImpl client; /** - * Initializes an instance of OdataOperations. + * Initializes an instance of OdatasImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public OdataOperationsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClient client) { - this.service = retrofit.create(OdataService.class); + public OdatasImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(OdatasService.class); this.client = client; } /** - * The interface defining all the services for OdataOperations to be + * The interface defining all the services for Odatas to be * used by Retrofit to perform actually REST calls. */ - interface OdataService { + interface OdatasService { @Headers("Content-Type: application/json; charset=utf-8") @GET("azurespecials/odata/filter") - Call getWithFilter(@Query("$filter") OdataFilter filter, @Query("$top") Integer top, @Query("$orderby") String orderby, @Header("accept-language") String acceptLanguage); + Call getWithFilter(@Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderby") String orderby, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -69,10 +68,10 @@ interface OdataService { * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse getWithFilter() throws ErrorException, IOException { - final OdataFilter filter = null; + final String filter = null; final Integer top = null; final String orderby = null; - Call call = service.getWithFilter(filter, top, orderby, this.client.getAcceptLanguage()); + Call call = service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent()); return getWithFilterDelegate(call.execute()); } @@ -87,10 +86,10 @@ public ServiceCall getWithFilterAsync(final ServiceCallback serviceCallbac if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final OdataFilter filter = null; + final String filter = null; final Integer top = null; final String orderby = null; - Call call = service.getWithFilter(filter, top, orderby, this.client.getAcceptLanguage()); + Call call = service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -115,9 +114,8 @@ public void onResponse(Call call, Response response) * @throws IOException exception thrown from serialization/deserialization * @return the {@link ServiceResponse} object if successful. */ - public ServiceResponse getWithFilter(OdataFilter filter, Integer top, String orderby) throws ErrorException, IOException { - Validator.validate(filter); - Call call = service.getWithFilter(filter, top, orderby, this.client.getAcceptLanguage()); + public ServiceResponse getWithFilter(String filter, Integer top, String orderby) throws ErrorException, IOException { + Call call = service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent()); return getWithFilterDelegate(call.execute()); } @@ -131,12 +129,11 @@ public ServiceResponse getWithFilter(OdataFilter filter, Integer top, Stri * @throws IllegalArgumentException thrown if callback is null * @return the {@link Call} object */ - public ServiceCall getWithFilterAsync(OdataFilter filter, Integer top, String orderby, final ServiceCallback serviceCallback) throws IllegalArgumentException { + public ServiceCall getWithFilterAsync(String filter, Integer top, String orderby, final ServiceCallback serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Validator.validate(filter, serviceCallback); - Call call = service.getWithFilter(filter, top, orderby, this.client.getAcceptLanguage()); + Call call = service.getWithFilter(filter, top, orderby, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -152,7 +149,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getWithFilterDelegate(Response response) throws ErrorException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/SkipUrlEncodingsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/SkipUrlEncodingsImpl.java new file mode 100644 index 0000000000000..7fa4099bdb02e --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/SkipUrlEncodingsImpl.java @@ -0,0 +1,489 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import retrofit2.Retrofit; +import fixtures.azurespecials.SkipUrlEncodings; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.azurespecials.models.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in SkipUrlEncodings. + */ +public final class SkipUrlEncodingsImpl implements SkipUrlEncodings { + /** The Retrofit service to perform REST calls. */ + private SkipUrlEncodingsService service; + /** The service client containing this operation class. */ + private AutoRestAzureSpecialParametersTestClientImpl client; + + /** + * Initializes an instance of SkipUrlEncodingsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SkipUrlEncodingsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(SkipUrlEncodingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SkipUrlEncodings to be + * used by Retrofit to perform actually REST calls. + */ + interface SkipUrlEncodingsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}") + Call getMethodPathValid(@Path("unencodedPathParam") String unencodedPathParam, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}") + Call getPathPathValid(@Path("unencodedPathParam") String unencodedPathParam, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}") + Call getSwaggerPathValid(@Path("unencodedPathParam") String unencodedPathParam, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/skipUrlEncoding/method/query/valid") + Call getMethodQueryValid(@Query("q1") String q1, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/skipUrlEncoding/method/query/null") + Call getMethodQueryNull(@Query("q1") String q1, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/skipUrlEncoding/path/query/valid") + Call getPathQueryValid(@Query("q1") String q1, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/skipUrlEncoding/swagger/query/valid") + Call getSwaggerQueryValid(@Query("q1") String q1, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get method with unencoded path parameter with value 'path1/path2/path3'. + * + * @param unencodedPathParam Unencoded path parameter with value 'path1/path2/path3' + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getMethodPathValid(String unencodedPathParam) throws ErrorException, IOException, IllegalArgumentException { + if (unencodedPathParam == null) { + throw new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null."); + } + Call call = service.getMethodPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); + return getMethodPathValidDelegate(call.execute()); + } + + /** + * Get method with unencoded path parameter with value 'path1/path2/path3'. + * + * @param unencodedPathParam Unencoded path parameter with value 'path1/path2/path3' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMethodPathValidAsync(String unencodedPathParam, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (unencodedPathParam == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null.")); + return null; + } + Call call = service.getMethodPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getMethodPathValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getMethodPathValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get method with unencoded path parameter with value 'path1/path2/path3'. + * + * @param unencodedPathParam Unencoded path parameter with value 'path1/path2/path3' + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getPathPathValid(String unencodedPathParam) throws ErrorException, IOException, IllegalArgumentException { + if (unencodedPathParam == null) { + throw new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null."); + } + Call call = service.getPathPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); + return getPathPathValidDelegate(call.execute()); + } + + /** + * Get method with unencoded path parameter with value 'path1/path2/path3'. + * + * @param unencodedPathParam Unencoded path parameter with value 'path1/path2/path3' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getPathPathValidAsync(String unencodedPathParam, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (unencodedPathParam == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter unencodedPathParam is required and cannot be null.")); + return null; + } + Call call = service.getPathPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getPathPathValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getPathPathValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get method with unencoded path parameter with value 'path1/path2/path3'. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getSwaggerPathValid() throws ErrorException, IOException { + final String unencodedPathParam = "path1/path2/path3"; + Call call = service.getSwaggerPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); + return getSwaggerPathValidDelegate(call.execute()); + } + + /** + * Get method with unencoded path parameter with value 'path1/path2/path3'. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getSwaggerPathValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String unencodedPathParam = "path1/path2/path3"; + Call call = service.getSwaggerPathValid(unencodedPathParam, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getSwaggerPathValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getSwaggerPathValidDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. + * + * @param q1 Unencoded query parameter with value 'value1&q2=value2&q3=value3' + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getMethodQueryValid(String q1) throws ErrorException, IOException, IllegalArgumentException { + if (q1 == null) { + throw new IllegalArgumentException("Parameter q1 is required and cannot be null."); + } + Call call = service.getMethodQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); + return getMethodQueryValidDelegate(call.execute()); + } + + /** + * Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. + * + * @param q1 Unencoded query parameter with value 'value1&q2=value2&q3=value3' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMethodQueryValidAsync(String q1, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (q1 == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter q1 is required and cannot be null.")); + return null; + } + Call call = service.getMethodQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getMethodQueryValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getMethodQueryValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get method with unencoded query parameter with value null. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getMethodQueryNull() throws ErrorException, IOException { + final String q1 = null; + Call call = service.getMethodQueryNull(q1, this.client.acceptLanguage(), this.client.userAgent()); + return getMethodQueryNullDelegate(call.execute()); + } + + /** + * Get method with unencoded query parameter with value null. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMethodQueryNullAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String q1 = null; + Call call = service.getMethodQueryNull(q1, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getMethodQueryNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + /** + * Get method with unencoded query parameter with value null. + * + * @param q1 Unencoded query parameter with value null + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getMethodQueryNull(String q1) throws ErrorException, IOException { + Call call = service.getMethodQueryNull(q1, this.client.acceptLanguage(), this.client.userAgent()); + return getMethodQueryNullDelegate(call.execute()); + } + + /** + * Get method with unencoded query parameter with value null. + * + * @param q1 Unencoded query parameter with value null + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getMethodQueryNullAsync(String q1, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getMethodQueryNull(q1, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getMethodQueryNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getMethodQueryNullDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. + * + * @param q1 Unencoded query parameter with value 'value1&q2=value2&q3=value3' + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getPathQueryValid(String q1) throws ErrorException, IOException, IllegalArgumentException { + if (q1 == null) { + throw new IllegalArgumentException("Parameter q1 is required and cannot be null."); + } + Call call = service.getPathQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); + return getPathQueryValidDelegate(call.execute()); + } + + /** + * Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. + * + * @param q1 Unencoded query parameter with value 'value1&q2=value2&q3=value3' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getPathQueryValidAsync(String q1, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (q1 == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter q1 is required and cannot be null.")); + return null; + } + Call call = service.getPathQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getPathQueryValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getPathQueryValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse getSwaggerQueryValid() throws ErrorException, IOException { + final String q1 = "value1&q2=value2&q3=value3"; + Call call = service.getSwaggerQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); + return getSwaggerQueryValidDelegate(call.execute()); + } + + /** + * Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getSwaggerQueryValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + final String q1 = "value1&q2=value2&q3=value3"; + Call call = service.getSwaggerQueryValid(q1, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getSwaggerQueryValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getSwaggerQueryValidDelegate(Response response) throws ErrorException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInCredentialsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInCredentialsImpl.java new file mode 100644 index 0000000000000..ecd19c4ec4c5a --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInCredentialsImpl.java @@ -0,0 +1,352 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import retrofit2.Retrofit; +import fixtures.azurespecials.SubscriptionInCredentials; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.azurespecials.models.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in SubscriptionInCredentials. + */ +public final class SubscriptionInCredentialsImpl implements SubscriptionInCredentials { + /** The Retrofit service to perform REST calls. */ + private SubscriptionInCredentialsService service; + /** The service client containing this operation class. */ + private AutoRestAzureSpecialParametersTestClientImpl client; + + /** + * Initializes an instance of SubscriptionInCredentialsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionInCredentialsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(SubscriptionInCredentialsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SubscriptionInCredentials to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionInCredentialsService { + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}") + Call postMethodGlobalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}") + Call postMethodGlobalNull(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}") + Call postMethodGlobalNotProvidedValid(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}") + Call postPathGlobalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}") + Call postSwaggerGlobalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postMethodGlobalValid() throws ErrorException, IOException, IllegalArgumentException { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + Call call = service.postMethodGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); + return postMethodGlobalValidDelegate(call.execute()); + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postMethodGlobalValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); + return null; + } + Call call = service.postMethodGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postMethodGlobalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postMethodGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postMethodGlobalNull() throws ErrorException, IOException, IllegalArgumentException { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + Call call = service.postMethodGlobalNull(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); + return postMethodGlobalNullDelegate(call.execute()); + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postMethodGlobalNullAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); + return null; + } + Call call = service.postMethodGlobalNull(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postMethodGlobalNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postMethodGlobalNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postMethodGlobalNotProvidedValid() throws ErrorException, IOException, IllegalArgumentException { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Call call = service.postMethodGlobalNotProvidedValid(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return postMethodGlobalNotProvidedValidDelegate(call.execute()); + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postMethodGlobalNotProvidedValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); + return null; + } + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); + return null; + } + Call call = service.postMethodGlobalNotProvidedValid(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postMethodGlobalNotProvidedValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postMethodGlobalNotProvidedValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postPathGlobalValid() throws ErrorException, IOException, IllegalArgumentException { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + Call call = service.postPathGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); + return postPathGlobalValidDelegate(call.execute()); + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postPathGlobalValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); + return null; + } + Call call = service.postPathGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postPathGlobalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postPathGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postSwaggerGlobalValid() throws ErrorException, IOException, IllegalArgumentException { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + Call call = service.postSwaggerGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); + return postSwaggerGlobalValidDelegate(call.execute()); + } + + /** + * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postSwaggerGlobalValidAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); + return null; + } + Call call = service.postSwaggerGlobalValid(this.client.subscriptionId(), this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postSwaggerGlobalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postSwaggerGlobalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInMethodsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInMethodsImpl.java new file mode 100644 index 0000000000000..0c78631d42cb9 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInMethodsImpl.java @@ -0,0 +1,295 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import retrofit2.Retrofit; +import fixtures.azurespecials.SubscriptionInMethods; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.azurespecials.models.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in SubscriptionInMethods. + */ +public final class SubscriptionInMethodsImpl implements SubscriptionInMethods { + /** The Retrofit service to perform REST calls. */ + private SubscriptionInMethodsService service; + /** The service client containing this operation class. */ + private AutoRestAzureSpecialParametersTestClientImpl client; + + /** + * Initializes an instance of SubscriptionInMethodsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionInMethodsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(SubscriptionInMethodsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SubscriptionInMethods to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionInMethodsService { + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}") + Call postMethodLocalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}") + Call postMethodLocalNull(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}") + Call postPathLocalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}") + Call postSwaggerLocalValid(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. + * + * @param subscriptionId This should appear as a method parameter, use value '1234-5678-9012-3456' + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postMethodLocalValid(String subscriptionId) throws ErrorException, IOException, IllegalArgumentException { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + Call call = service.postMethodLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); + return postMethodLocalValidDelegate(call.execute()); + } + + /** + * POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. + * + * @param subscriptionId This should appear as a method parameter, use value '1234-5678-9012-3456' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postMethodLocalValidAsync(String subscriptionId, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (subscriptionId == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + return null; + } + Call call = service.postMethodLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postMethodLocalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postMethodLocalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call. + * + * @param subscriptionId This should appear as a method parameter, use value null, client-side validation should prvenet the call + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postMethodLocalNull(String subscriptionId) throws ErrorException, IOException, IllegalArgumentException { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + Call call = service.postMethodLocalNull(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); + return postMethodLocalNullDelegate(call.execute()); + } + + /** + * POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call. + * + * @param subscriptionId This should appear as a method parameter, use value null, client-side validation should prvenet the call + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postMethodLocalNullAsync(String subscriptionId, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (subscriptionId == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + return null; + } + Call call = service.postMethodLocalNull(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postMethodLocalNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postMethodLocalNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. + * + * @param subscriptionId Should appear as a method parameter -use value '1234-5678-9012-3456' + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postPathLocalValid(String subscriptionId) throws ErrorException, IOException, IllegalArgumentException { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + Call call = service.postPathLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); + return postPathLocalValidDelegate(call.execute()); + } + + /** + * POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. + * + * @param subscriptionId Should appear as a method parameter -use value '1234-5678-9012-3456' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postPathLocalValidAsync(String subscriptionId, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (subscriptionId == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + return null; + } + Call call = service.postPathLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postPathLocalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postPathLocalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. + * + * @param subscriptionId The subscriptionId, which appears in the path, the value is always '1234-5678-9012-3456' + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse postSwaggerLocalValid(String subscriptionId) throws ErrorException, IOException, IllegalArgumentException { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + Call call = service.postSwaggerLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); + return postSwaggerLocalValidDelegate(call.execute()); + } + + /** + * POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. + * + * @param subscriptionId The subscriptionId, which appears in the path, the value is always '1234-5678-9012-3456' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall postSwaggerLocalValidAsync(String subscriptionId, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (subscriptionId == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + return null; + } + Call call = service.postSwaggerLocalValid(subscriptionId, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(postSwaggerLocalValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse postSwaggerLocalValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/XMsClientRequestIdsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/XMsClientRequestIdsImpl.java new file mode 100644 index 0000000000000..bc413c7ab2165 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/XMsClientRequestIdsImpl.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.azurespecials.implementation; + +import retrofit2.Retrofit; +import fixtures.azurespecials.XMsClientRequestIds; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import fixtures.azurespecials.models.ErrorException; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in XMsClientRequestIds. + */ +public final class XMsClientRequestIdsImpl implements XMsClientRequestIds { + /** The Retrofit service to perform REST calls. */ + private XMsClientRequestIdsService service; + /** The service client containing this operation class. */ + private AutoRestAzureSpecialParametersTestClientImpl client; + + /** + * Initializes an instance of XMsClientRequestIdsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public XMsClientRequestIdsImpl(Retrofit retrofit, AutoRestAzureSpecialParametersTestClientImpl client) { + this.service = retrofit.create(XMsClientRequestIdsService.class); + this.client = client; + } + + /** + * The interface defining all the services for XMsClientRequestIds to be + * used by Retrofit to perform actually REST calls. + */ + interface XMsClientRequestIdsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/overwrite/x-ms-client-request-id/method/") + Call get(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("azurespecials/overwrite/x-ms-client-request-id/via-param/method/") + Call paramGet(@Header("x-ms-client-request-id") String xMsClientRequestId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse get() throws CloudException, IOException { + Call call = service.get(this.client.acceptLanguage(), this.client.userAgent()); + return getDelegate(call.execute()); + } + + /** + * Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getAsync(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.get(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .build(response); + } + + /** + * Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param xMsClientRequestId This should appear as a method parameter, use value '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse paramGet(String xMsClientRequestId) throws ErrorException, IOException, IllegalArgumentException { + if (xMsClientRequestId == null) { + throw new IllegalArgumentException("Parameter xMsClientRequestId is required and cannot be null."); + } + Call call = service.paramGet(xMsClientRequestId, this.client.acceptLanguage(), this.client.userAgent()); + return paramGetDelegate(call.execute()); + } + + /** + * Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. + * + * @param xMsClientRequestId This should appear as a method parameter, use value '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall paramGetAsync(String xMsClientRequestId, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (xMsClientRequestId == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter xMsClientRequestId is required and cannot be null.")); + return null; + } + Call call = service.paramGet(xMsClientRequestId, this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(paramGetDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse paramGetDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/package-info.java new file mode 100644 index 0000000000000..141f0e35d66db --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestAzureSpecialParametersTestClient. + * Test Infrastructure for AutoRest. + */ +package fixtures.azurespecials.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/Error.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/Error.java index 7830cff2f895c..47fbd53922c56 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/Error.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/Error.java @@ -35,7 +35,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -43,9 +43,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -53,7 +55,7 @@ public void setStatus(Integer status) { * * @return the constantId value */ - public Integer getConstantId() { + public Integer constantId() { return this.constantId; } @@ -61,9 +63,11 @@ public Integer getConstantId() { * Set the constantId value. * * @param constantId the constantId value to set + * @return the Error object itself. */ - public void setConstantId(Integer constantId) { + public Error withConstantId(Integer constantId) { this.constantId = constantId; + return this; } /** @@ -71,7 +75,7 @@ public void setConstantId(Integer constantId) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -79,9 +83,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/ErrorException.java index c2e6c2a70df1d..3c732a0c5af94 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/ErrorException.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.azurespecials.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdHeaders.java index 24547fc73777d..60989579d6f5f 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdHeaders.java @@ -27,7 +27,7 @@ public class HeaderCustomNamedRequestIdHeaders { * * @return the fooRequestId value */ - public String getFooRequestId() { + public String fooRequestId() { return this.fooRequestId; } @@ -35,9 +35,11 @@ public String getFooRequestId() { * Set the fooRequestId value. * * @param fooRequestId the fooRequestId value to set + * @return the HeaderCustomNamedRequestIdHeaders object itself. */ - public void setFooRequestId(String fooRequestId) { + public HeaderCustomNamedRequestIdHeaders withFooRequestId(String fooRequestId) { this.fooRequestId = fooRequestId; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdParamGroupingHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdParamGroupingHeaders.java index bd2f6562bd776..d00cf480014de 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdParamGroupingHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdParamGroupingHeaders.java @@ -27,7 +27,7 @@ public class HeaderCustomNamedRequestIdParamGroupingHeaders { * * @return the fooRequestId value */ - public String getFooRequestId() { + public String fooRequestId() { return this.fooRequestId; } @@ -35,9 +35,11 @@ public String getFooRequestId() { * Set the fooRequestId value. * * @param fooRequestId the fooRequestId value to set + * @return the HeaderCustomNamedRequestIdParamGroupingHeaders object itself. */ - public void setFooRequestId(String fooRequestId) { + public HeaderCustomNamedRequestIdParamGroupingHeaders withFooRequestId(String fooRequestId) { this.fooRequestId = fooRequestId; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdParamGroupingParameters.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdParamGroupingParameters.java index e24d784a3a57e..dc832b177f4a5 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdParamGroupingParameters.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/HeaderCustomNamedRequestIdParamGroupingParameters.java @@ -28,7 +28,7 @@ public class HeaderCustomNamedRequestIdParamGroupingParameters { * * @return the fooClientRequestId value */ - public String getFooClientRequestId() { + public String fooClientRequestId() { return this.fooClientRequestId; } @@ -36,9 +36,11 @@ public String getFooClientRequestId() { * Set the fooClientRequestId value. * * @param fooClientRequestId the fooClientRequestId value to set + * @return the HeaderCustomNamedRequestIdParamGroupingParameters object itself. */ - public void setFooClientRequestId(String fooClientRequestId) { + public HeaderCustomNamedRequestIdParamGroupingParameters withFooClientRequestId(String fooClientRequestId) { this.fooClientRequestId = fooClientRequestId; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/OdataFilter.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/OdataFilter.java index 6f9be2ad6d32e..279098b354812 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/OdataFilter.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/OdataFilter.java @@ -30,7 +30,7 @@ public class OdataFilter { * * @return the id value */ - public Integer getId() { + public Integer id() { return this.id; } @@ -38,9 +38,11 @@ public Integer getId() { * Set the id value. * * @param id the id value to set + * @return the OdataFilter object itself. */ - public void setId(Integer id) { + public OdataFilter withId(Integer id) { this.id = id; + return this; } /** @@ -48,7 +50,7 @@ public void setId(Integer id) { * * @return the name value */ - public String getName() { + public String name() { return this.name; } @@ -56,9 +58,11 @@ public String getName() { * Set the name value. * * @param name the name value to set + * @return the OdataFilter object itself. */ - public void setName(String name) { + public OdataFilter withName(String name) { this.name = name; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/package-info.java index f7c2c19800952..477570c1b5445 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestAzureSpecialParametersTestClient. + * This package contains the models classes for AutoRestAzureSpecialParametersTestClient. * Test Infrastructure for AutoRest. */ package fixtures.azurespecials.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClient.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClient.java index b15b7429e40f0..0d1afb14d6125 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClient.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClient.java @@ -11,44 +11,18 @@ package fixtures.custombaseuri; import com.microsoft.azure.AzureClient; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; +import com.microsoft.azure.RestClient; /** * The interface for AutoRestParameterizedHostTestClient class. */ public interface AutoRestParameterizedHostTestClient { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -57,72 +31,76 @@ public interface AutoRestParameterizedHostTestClient { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets A string value that is used as a global part of the parameterized host. * * @return the host value. */ - String getHost(); + String host(); /** * Sets A string value that is used as a global part of the parameterized host. * * @param host the host value. + * @return the service client itself */ - void setHost(String host); + AutoRestParameterizedHostTestClient withHost(String host); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + AutoRestParameterizedHostTestClient withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + AutoRestParameterizedHostTestClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + AutoRestParameterizedHostTestClient withGenerateClientRequestId(boolean generateClientRequestId); /** - * Gets the PathsOperations object to access its operations. - * @return the PathsOperations object. + * Gets the Paths object to access its operations. + * @return the Paths object. */ - PathsOperations getPathsOperations(); + Paths paths(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/Paths.java similarity index 96% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/Paths.java index 89c0b4d4d11c9..1566930565597 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/Paths.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in PathsOperations. + * in Paths. */ -public interface PathsOperations { +public interface Paths { /** * Get a 200 to test a valid base uri. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClientImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/implementation/AutoRestParameterizedHostTestClientImpl.java similarity index 62% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClientImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/implementation/AutoRestParameterizedHostTestClientImpl.java index 4387f63b39ce1..5a1430cad4f7a 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClientImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/implementation/AutoRestParameterizedHostTestClientImpl.java @@ -8,35 +8,22 @@ * regenerated. */ -package fixtures.custombaseuri; +package fixtures.custombaseuri.implementation; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.CustomHeaderInterceptor; -import com.microsoft.rest.AutoRestBaseUrl; +import com.microsoft.azure.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; -import java.util.UUID; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; +import fixtures.custombaseuri.AutoRestParameterizedHostTestClient; +import fixtures.custombaseuri.Paths; /** - * Initializes a new instance of the AutoRestParameterizedHostTestClient class. + * Initializes a new instance of the AutoRestParameterizedHostTestClientImpl class. */ public final class AutoRestParameterizedHostTestClientImpl extends AzureServiceClient implements AutoRestParameterizedHostTestClient { - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - /** * Gets the {@link AzureClient} used for long running operations. * @return the azure client; @@ -45,18 +32,6 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - /** A string value that is used as a global part of the parameterized host. */ private String host; @@ -65,7 +40,7 @@ public ServiceClientCredentials getCredentials() { * * @return the host value. */ - public String getHost() { + public String host() { return this.host; } @@ -73,9 +48,11 @@ public String getHost() { * Sets A string value that is used as a global part of the parameterized host. * * @param host the host value. + * @return the service client itself */ - public void setHost(String host) { + public AutoRestParameterizedHostTestClientImpl withHost(String host) { this.host = host; + return this; } /** Gets or sets the preferred language for the response. */ @@ -86,7 +63,7 @@ public void setHost(String host) { * * @return the acceptLanguage value. */ - public String getAcceptLanguage() { + public String acceptLanguage() { return this.acceptLanguage; } @@ -94,9 +71,11 @@ public String getAcceptLanguage() { * Sets Gets or sets the preferred language for the response. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - public void setAcceptLanguage(String acceptLanguage) { + public AutoRestParameterizedHostTestClientImpl withAcceptLanguage(String acceptLanguage) { this.acceptLanguage = acceptLanguage; + return this; } /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ @@ -107,7 +86,7 @@ public void setAcceptLanguage(String acceptLanguage) { * * @return the longRunningOperationRetryTimeout value. */ - public int getLongRunningOperationRetryTimeout() { + public int longRunningOperationRetryTimeout() { return this.longRunningOperationRetryTimeout; } @@ -115,9 +94,11 @@ public int getLongRunningOperationRetryTimeout() { * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public AutoRestParameterizedHostTestClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; } /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ @@ -128,7 +109,7 @@ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTim * * @return the generateClientRequestId value. */ - public boolean getGenerateClientRequestId() { + public boolean generateClientRequestId() { return this.generateClientRequestId; } @@ -136,17 +117,24 @@ public boolean getGenerateClientRequestId() { * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { + public AutoRestParameterizedHostTestClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { this.generateClientRequestId = generateClientRequestId; + return this; } /** - * Gets the PathsOperations object to access its operations. - * @return the PathsOperations object. + * The Paths object to access its operations. */ - public PathsOperations getPathsOperations() { - return new PathsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + private Paths paths; + + /** + * Gets the Paths object to access its operations. + * @return the Paths object. + */ + public Paths paths() { + return this.paths; } /** @@ -165,39 +153,40 @@ public AutoRestParameterizedHostTestClientImpl(ServiceClientCredentials credenti * @param credentials the management credentials for Azure */ private AutoRestParameterizedHostTestClientImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } /** * Initializes an instance of AutoRestParameterizedHostTestClient client. * - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param restClient the REST client to connect to Azure. */ - public AutoRestParameterizedHostTestClientImpl(ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl("http://{accountName}{host}"); - this.credentials = credentials; + public AutoRestParameterizedHostTestClientImpl(RestClient restClient) { + super(restClient); initialize(); } - @Override protected void initialize() { this.host = "host"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); + this.paths = new PathsImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestParameterizedHostTestClient, 1.0.0"); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsImpl.java similarity index 76% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsImpl.java index ab4add30c8dcc..917e5fe963b25 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsImpl.java @@ -8,8 +8,11 @@ * regenerated. */ -package fixtures.custombaseuri; +package fixtures.custombaseuri.implementation; +import retrofit2.Retrofit; +import fixtures.custombaseuri.Paths; +import com.google.common.base.Joiner; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; @@ -24,37 +27,36 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in PathsOperations. + * in Paths. */ -public final class PathsOperationsImpl implements PathsOperations { +public final class PathsImpl implements Paths { /** The Retrofit service to perform REST calls. */ private PathsService service; /** The service client containing this operation class. */ - private AutoRestParameterizedHostTestClient client; + private AutoRestParameterizedHostTestClientImpl client; /** - * Initializes an instance of PathsOperations. + * Initializes an instance of PathsImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PathsOperationsImpl(Retrofit retrofit, AutoRestParameterizedHostTestClient client) { + public PathsImpl(Retrofit retrofit, AutoRestParameterizedHostTestClientImpl client) { this.service = retrofit.create(PathsService.class); this.client = client; } /** - * The interface defining all the services for PathsOperations to be + * The interface defining all the services for Paths to be * used by Retrofit to perform actually REST calls. */ interface PathsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("customuri") - Call getEmpty(@Header("accept-language") String acceptLanguage); + Call getEmpty(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } @@ -71,12 +73,11 @@ public ServiceResponse getEmpty(String accountName) throws ErrorException, if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } - if (this.client.getHost() == null) { - throw new IllegalArgumentException("Parameter this.client.getHost() is required and cannot be null."); + if (this.client.host() == null) { + throw new IllegalArgumentException("Parameter this.client.host() is required and cannot be null."); } - this.client.getBaseUrl().set("{accountName}", accountName); - this.client.getBaseUrl().set("{host}", this.client.getHost()); - Call call = service.getEmpty(this.client.getAcceptLanguage()); + String parameterizedHost = Joiner.on(", ").join("{accountName}", accountName, "{host}", this.client.host()); + Call call = service.getEmpty(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()); return getEmptyDelegate(call.execute()); } @@ -96,13 +97,12 @@ public ServiceCall getEmptyAsync(String accountName, final ServiceCallback serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); return null; } - if (this.client.getHost() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getHost() is required and cannot be null.")); + if (this.client.host() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.host() is required and cannot be null.")); return null; } - this.client.getBaseUrl().set("{accountName}", accountName); - this.client.getBaseUrl().set("{host}", this.client.getHost()); - Call call = service.getEmpty(this.client.getAcceptLanguage()); + String parameterizedHost = Joiner.on(", ").join("{accountName}", accountName, "{host}", this.client.host()); + Call call = service.getEmpty(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -118,7 +118,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/implementation/package-info.java new file mode 100644 index 0000000000000..9449c1aeeb63c --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestParameterizedHostTestClient. + * Test Infrastructure for AutoRest. + */ +package fixtures.custombaseuri.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/Error.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/Error.java index afdbef2ab489b..2242e90360cbe 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/Error.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/ErrorException.java index c2f868b6dcaa5..eb2624f4f3bbb 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/ErrorException.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.custombaseuri.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/package-info.java index 9f9b5368cdf7e..22f43a621543e 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestParameterizedHostTestClient. + * This package contains the models classes for AutoRestParameterizedHostTestClient. * Test Infrastructure for AutoRest. */ package fixtures.custombaseuri.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/AutoRestHeadTestService.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/AutoRestHeadTestService.java index 08a2deb08623e..079219f3047e1 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/AutoRestHeadTestService.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/AutoRestHeadTestService.java @@ -11,44 +11,18 @@ package fixtures.head; import com.microsoft.azure.AzureClient; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; +import com.microsoft.azure.RestClient; /** * The interface for AutoRestHeadTestService class. */ public interface AutoRestHeadTestService { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -57,58 +31,61 @@ public interface AutoRestHeadTestService { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + AutoRestHeadTestService withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + AutoRestHeadTestService withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + AutoRestHeadTestService withGenerateClientRequestId(boolean generateClientRequestId); /** - * Gets the HttpSuccessOperations object to access its operations. - * @return the HttpSuccessOperations object. + * Gets the HttpSuccess object to access its operations. + * @return the HttpSuccess object. */ - HttpSuccessOperations getHttpSuccessOperations(); + HttpSuccess httpSuccess(); } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/HttpSuccessOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/HttpSuccess.java similarity index 97% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/HttpSuccessOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/HttpSuccess.java index 7ca9a529752e3..59d2177b3bf58 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/HttpSuccessOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/HttpSuccess.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in HttpSuccessOperations. + * in HttpSuccess. */ -public interface HttpSuccessOperations { +public interface HttpSuccess { /** * Return 200 status code if successful. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/AutoRestHeadTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/implementation/AutoRestHeadTestServiceImpl.java similarity index 58% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/AutoRestHeadTestServiceImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/implementation/AutoRestHeadTestServiceImpl.java index 2bea02ff6c170..50b7b6edbd4a8 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/AutoRestHeadTestServiceImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/implementation/AutoRestHeadTestServiceImpl.java @@ -8,35 +8,22 @@ * regenerated. */ -package fixtures.head; +package fixtures.head.implementation; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.CustomHeaderInterceptor; -import com.microsoft.rest.AutoRestBaseUrl; +import com.microsoft.azure.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; -import java.util.UUID; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; +import fixtures.head.AutoRestHeadTestService; +import fixtures.head.HttpSuccess; /** - * Initializes a new instance of the AutoRestHeadTestService class. + * Initializes a new instance of the AutoRestHeadTestServiceImpl class. */ public final class AutoRestHeadTestServiceImpl extends AzureServiceClient implements AutoRestHeadTestService { - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - /** * Gets the {@link AzureClient} used for long running operations. * @return the azure client; @@ -45,18 +32,6 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - /** Gets or sets the preferred language for the response. */ private String acceptLanguage; @@ -65,7 +40,7 @@ public ServiceClientCredentials getCredentials() { * * @return the acceptLanguage value. */ - public String getAcceptLanguage() { + public String acceptLanguage() { return this.acceptLanguage; } @@ -73,9 +48,11 @@ public String getAcceptLanguage() { * Sets Gets or sets the preferred language for the response. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - public void setAcceptLanguage(String acceptLanguage) { + public AutoRestHeadTestServiceImpl withAcceptLanguage(String acceptLanguage) { this.acceptLanguage = acceptLanguage; + return this; } /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ @@ -86,7 +63,7 @@ public void setAcceptLanguage(String acceptLanguage) { * * @return the longRunningOperationRetryTimeout value. */ - public int getLongRunningOperationRetryTimeout() { + public int longRunningOperationRetryTimeout() { return this.longRunningOperationRetryTimeout; } @@ -94,9 +71,11 @@ public int getLongRunningOperationRetryTimeout() { * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public AutoRestHeadTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; } /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ @@ -107,7 +86,7 @@ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTim * * @return the generateClientRequestId value. */ - public boolean getGenerateClientRequestId() { + public boolean generateClientRequestId() { return this.generateClientRequestId; } @@ -115,17 +94,24 @@ public boolean getGenerateClientRequestId() { * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { + public AutoRestHeadTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { this.generateClientRequestId = generateClientRequestId; + return this; } /** - * Gets the HttpSuccessOperations object to access its operations. - * @return the HttpSuccessOperations object. + * The HttpSuccess object to access its operations. + */ + private HttpSuccess httpSuccess; + + /** + * Gets the HttpSuccess object to access its operations. + * @return the HttpSuccess object. */ - public HttpSuccessOperations getHttpSuccessOperations() { - return new HttpSuccessOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public HttpSuccess httpSuccess() { + return this.httpSuccess; } /** @@ -144,39 +130,39 @@ public AutoRestHeadTestServiceImpl(ServiceClientCredentials credentials) { * @param credentials the management credentials for Azure */ public AutoRestHeadTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } /** * Initializes an instance of AutoRestHeadTestService client. * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param restClient the REST client to connect to Azure. */ - public AutoRestHeadTestServiceImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; + public AutoRestHeadTestServiceImpl(RestClient restClient) { + super(restClient); initialize(); } - @Override protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); + this.httpSuccess = new HttpSuccessImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestHeadTestService, 1.0.0"); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/implementation/HttpSuccessImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/implementation/HttpSuccessImpl.java new file mode 100644 index 0000000000000..119ebf62d2606 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/implementation/HttpSuccessImpl.java @@ -0,0 +1,207 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.head.implementation; + +import retrofit2.Retrofit; +import fixtures.head.HttpSuccess; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseEmptyCallback; +import java.io.IOException; +import retrofit2.Call; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in HttpSuccess. + */ +public final class HttpSuccessImpl implements HttpSuccess { + /** The Retrofit service to perform REST calls. */ + private HttpSuccessService service; + /** The service client containing this operation class. */ + private AutoRestHeadTestServiceImpl client; + + /** + * Initializes an instance of HttpSuccessImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public HttpSuccessImpl(Retrofit retrofit, AutoRestHeadTestServiceImpl client) { + this.service = retrofit.create(HttpSuccessService.class); + this.client = client; + } + + /** + * The interface defining all the services for HttpSuccess to be + * used by Retrofit to perform actually REST calls. + */ + interface HttpSuccessService { + @Headers("Content-Type: application/json; charset=utf-8") + @HEAD("http/success/200") + Call head200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HEAD("http/success/204") + Call head204(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HEAD("http/success/404") + Call head404(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Return 200 status code if successful. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the boolean object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse head200() throws CloudException, IOException { + Call call = service.head200(this.client.acceptLanguage(), this.client.userAgent()); + return head200Delegate(call.execute()); + } + + /** + * Return 200 status code if successful. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall head200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.head200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(head200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse head200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Return 204 status code if successful. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the boolean object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse head204() throws CloudException, IOException { + Call call = service.head204(this.client.acceptLanguage(), this.client.userAgent()); + return head204Delegate(call.execute()); + } + + /** + * Return 204 status code if successful. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall head204Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.head204(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(head204Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse head204Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Return 404 status code if successful. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the boolean object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse head404() throws CloudException, IOException { + Call call = service.head404(this.client.acceptLanguage(), this.client.userAgent()); + return head404Delegate(call.execute()); + } + + /** + * Return 404 status code if successful. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall head404Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.head404(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(head404Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse head404Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/implementation/package-info.java new file mode 100644 index 0000000000000..d058ca5a28ab1 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestHeadTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.head.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/models/package-info.java index a5f26d32d0443..5d7b9101448bb 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/head/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestHeadTestService. + * This package contains the models classes for AutoRestHeadTestService. * Test Infrastructure for AutoRest. */ package fixtures.head.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/AutoRestHeadExceptionTestService.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/AutoRestHeadExceptionTestService.java index fa73d8b93d2ef..ef2377f658ee1 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/AutoRestHeadExceptionTestService.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/AutoRestHeadExceptionTestService.java @@ -11,44 +11,18 @@ package fixtures.headexceptions; import com.microsoft.azure.AzureClient; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; +import com.microsoft.azure.RestClient; /** * The interface for AutoRestHeadExceptionTestService class. */ public interface AutoRestHeadExceptionTestService { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -57,58 +31,61 @@ public interface AutoRestHeadExceptionTestService { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + AutoRestHeadExceptionTestService withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + AutoRestHeadExceptionTestService withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + AutoRestHeadExceptionTestService withGenerateClientRequestId(boolean generateClientRequestId); /** - * Gets the HeadExceptionOperations object to access its operations. - * @return the HeadExceptionOperations object. + * Gets the HeadExceptions object to access its operations. + * @return the HeadExceptions object. */ - HeadExceptionOperations getHeadExceptionOperations(); + HeadExceptions headExceptions(); } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/HeadExceptionOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/HeadExceptions.java similarity index 97% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/HeadExceptionOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/HeadExceptions.java index 3382e6dbd27ca..7dbd34b346282 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/HeadExceptionOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/HeadExceptions.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in HeadExceptionOperations. + * in HeadExceptions. */ -public interface HeadExceptionOperations { +public interface HeadExceptions { /** * Return 200 status code if successful. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/AutoRestHeadExceptionTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/implementation/AutoRestHeadExceptionTestServiceImpl.java similarity index 59% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/AutoRestHeadExceptionTestServiceImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/implementation/AutoRestHeadExceptionTestServiceImpl.java index 5bbe772906b43..ebc2bb32321d2 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/AutoRestHeadExceptionTestServiceImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/implementation/AutoRestHeadExceptionTestServiceImpl.java @@ -8,35 +8,22 @@ * regenerated. */ -package fixtures.headexceptions; +package fixtures.headexceptions.implementation; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.CustomHeaderInterceptor; -import com.microsoft.rest.AutoRestBaseUrl; +import com.microsoft.azure.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; -import java.util.UUID; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; +import fixtures.headexceptions.AutoRestHeadExceptionTestService; +import fixtures.headexceptions.HeadExceptions; /** - * Initializes a new instance of the AutoRestHeadExceptionTestService class. + * Initializes a new instance of the AutoRestHeadExceptionTestServiceImpl class. */ public final class AutoRestHeadExceptionTestServiceImpl extends AzureServiceClient implements AutoRestHeadExceptionTestService { - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - /** * Gets the {@link AzureClient} used for long running operations. * @return the azure client; @@ -45,18 +32,6 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - /** Gets or sets the preferred language for the response. */ private String acceptLanguage; @@ -65,7 +40,7 @@ public ServiceClientCredentials getCredentials() { * * @return the acceptLanguage value. */ - public String getAcceptLanguage() { + public String acceptLanguage() { return this.acceptLanguage; } @@ -73,9 +48,11 @@ public String getAcceptLanguage() { * Sets Gets or sets the preferred language for the response. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - public void setAcceptLanguage(String acceptLanguage) { + public AutoRestHeadExceptionTestServiceImpl withAcceptLanguage(String acceptLanguage) { this.acceptLanguage = acceptLanguage; + return this; } /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ @@ -86,7 +63,7 @@ public void setAcceptLanguage(String acceptLanguage) { * * @return the longRunningOperationRetryTimeout value. */ - public int getLongRunningOperationRetryTimeout() { + public int longRunningOperationRetryTimeout() { return this.longRunningOperationRetryTimeout; } @@ -94,9 +71,11 @@ public int getLongRunningOperationRetryTimeout() { * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public AutoRestHeadExceptionTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; } /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ @@ -107,7 +86,7 @@ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTim * * @return the generateClientRequestId value. */ - public boolean getGenerateClientRequestId() { + public boolean generateClientRequestId() { return this.generateClientRequestId; } @@ -115,17 +94,24 @@ public boolean getGenerateClientRequestId() { * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { + public AutoRestHeadExceptionTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { this.generateClientRequestId = generateClientRequestId; + return this; } /** - * Gets the HeadExceptionOperations object to access its operations. - * @return the HeadExceptionOperations object. + * The HeadExceptions object to access its operations. + */ + private HeadExceptions headExceptions; + + /** + * Gets the HeadExceptions object to access its operations. + * @return the HeadExceptions object. */ - public HeadExceptionOperations getHeadExceptionOperations() { - return new HeadExceptionOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public HeadExceptions headExceptions() { + return this.headExceptions; } /** @@ -144,39 +130,39 @@ public AutoRestHeadExceptionTestServiceImpl(ServiceClientCredentials credentials * @param credentials the management credentials for Azure */ public AutoRestHeadExceptionTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } /** * Initializes an instance of AutoRestHeadExceptionTestService client. * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param restClient the REST client to connect to Azure. */ - public AutoRestHeadExceptionTestServiceImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; + public AutoRestHeadExceptionTestServiceImpl(RestClient restClient) { + super(restClient); initialize(); } - @Override protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); + this.headExceptions = new HeadExceptionsImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestHeadExceptionTestService, 1.0.0"); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/implementation/HeadExceptionsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/implementation/HeadExceptionsImpl.java new file mode 100644 index 0000000000000..8f665f5903bc7 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/implementation/HeadExceptionsImpl.java @@ -0,0 +1,201 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.headexceptions.implementation; + +import retrofit2.Retrofit; +import fixtures.headexceptions.HeadExceptions; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseEmptyCallback; +import java.io.IOException; +import retrofit2.Call; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in HeadExceptions. + */ +public final class HeadExceptionsImpl implements HeadExceptions { + /** The Retrofit service to perform REST calls. */ + private HeadExceptionsService service; + /** The service client containing this operation class. */ + private AutoRestHeadExceptionTestServiceImpl client; + + /** + * Initializes an instance of HeadExceptionsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public HeadExceptionsImpl(Retrofit retrofit, AutoRestHeadExceptionTestServiceImpl client) { + this.service = retrofit.create(HeadExceptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for HeadExceptions to be + * used by Retrofit to perform actually REST calls. + */ + interface HeadExceptionsService { + @Headers("Content-Type: application/json; charset=utf-8") + @HEAD("http/success/200") + Call head200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HEAD("http/success/204") + Call head204(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HEAD("http/success/404") + Call head404(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Return 200 status code if successful. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse head200() throws CloudException, IOException { + Call call = service.head200(this.client.acceptLanguage(), this.client.userAgent()); + return head200Delegate(call.execute()); + } + + /** + * Return 200 status code if successful. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall head200Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.head200(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(head200Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse head200Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .buildEmpty(response); + } + + /** + * Return 204 status code if successful. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse head204() throws CloudException, IOException { + Call call = service.head204(this.client.acceptLanguage(), this.client.userAgent()); + return head204Delegate(call.execute()); + } + + /** + * Return 204 status code if successful. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall head204Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.head204(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(head204Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse head204Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(204, new TypeToken() { }.getType()) + .buildEmpty(response); + } + + /** + * Return 404 status code if successful. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse head404() throws CloudException, IOException { + Call call = service.head404(this.client.acceptLanguage(), this.client.userAgent()); + return head404Delegate(call.execute()); + } + + /** + * Return 404 status code if successful. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall head404Async(final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.head404(this.client.acceptLanguage(), this.client.userAgent()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseEmptyCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(head404Delegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse head404Delegate(Response response) throws CloudException, IOException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(204, new TypeToken() { }.getType()) + .buildEmpty(response); + } + +} diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/implementation/package-info.java new file mode 100644 index 0000000000000..db31cf72cfbe7 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestHeadExceptionTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.headexceptions.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/models/package-info.java index 0a664e0310edd..6524f78af9500 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/headexceptions/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestHeadExceptionTestService. + * This package contains the models classes for AutoRestHeadExceptionTestService. * Test Infrastructure for AutoRest. */ package fixtures.headexceptions.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/AutoRestLongRunningOperationTestService.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/AutoRestLongRunningOperationTestService.java index 93d4b39ee9afd..6968998d0ccfe 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/AutoRestLongRunningOperationTestService.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/AutoRestLongRunningOperationTestService.java @@ -11,44 +11,18 @@ package fixtures.lro; import com.microsoft.azure.AzureClient; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; +import com.microsoft.azure.RestClient; /** * The interface for AutoRestLongRunningOperationTestService class. */ public interface AutoRestLongRunningOperationTestService { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -57,76 +31,79 @@ public interface AutoRestLongRunningOperationTestService { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + AutoRestLongRunningOperationTestService withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + AutoRestLongRunningOperationTestService withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + AutoRestLongRunningOperationTestService withGenerateClientRequestId(boolean generateClientRequestId); /** - * Gets the LROsOperations object to access its operations. - * @return the LROsOperations object. + * Gets the LROs object to access its operations. + * @return the LROs object. */ - LROsOperations getLROsOperations(); + LROs lROs(); /** - * Gets the LRORetrysOperations object to access its operations. - * @return the LRORetrysOperations object. + * Gets the LRORetrys object to access its operations. + * @return the LRORetrys object. */ - LRORetrysOperations getLRORetrysOperations(); + LRORetrys lRORetrys(); /** - * Gets the LROSADsOperations object to access its operations. - * @return the LROSADsOperations object. + * Gets the LROSADs object to access its operations. + * @return the LROSADs object. */ - LROSADsOperations getLROSADsOperations(); + LROSADs lROSADs(); /** - * Gets the LROsCustomHeaderOperations object to access its operations. - * @return the LROsCustomHeaderOperations object. + * Gets the LROsCustomHeaders object to access its operations. + * @return the LROsCustomHeaders object. */ - LROsCustomHeaderOperations getLROsCustomHeaderOperations(); + LROsCustomHeaders lROsCustomHeaders(); } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrysOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrys.java similarity index 99% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrysOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrys.java index e1d540d85a7bd..9edebff8056d8 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrysOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrys.java @@ -26,9 +26,9 @@ /** * An instance of this class provides access to all the operations defined - * in LRORetrysOperations. + * in LRORetrys. */ -public interface LRORetrysOperations { +public interface LRORetrys { /** * Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADsOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADs.java similarity index 99% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADsOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADs.java index 7fdc2cc170dd2..9a608e11c1b47 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADsOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADs.java @@ -40,9 +40,9 @@ /** * An instance of this class provides access to all the operations defined - * in LROSADsOperations. + * in LROSADs. */ -public interface LROSADsOperations { +public interface LROSADs { /** * Long running put request, service returns a 400 to the initial request. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROs.java similarity index 99% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROs.java index 5fd72fc377928..e5493aa002ba1 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROs.java @@ -45,9 +45,9 @@ /** * An instance of this class provides access to all the operations defined - * in LROsOperations. + * in LROs. */ -public interface LROsOperations { +public interface LROs { /** * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsCustomHeaderOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsCustomHeaders.java similarity index 99% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsCustomHeaderOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsCustomHeaders.java index 4cf1c72e3fdaa..c58d23f13ba78 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsCustomHeaderOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsCustomHeaders.java @@ -23,9 +23,9 @@ /** * An instance of this class provides access to all the operations defined - * in LROsCustomHeaderOperations. + * in LROsCustomHeaders. */ -public interface LROsCustomHeaderOperations { +public interface LROsCustomHeaders { /** * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/AutoRestLongRunningOperationTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/AutoRestLongRunningOperationTestServiceImpl.java similarity index 53% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/AutoRestLongRunningOperationTestServiceImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/AutoRestLongRunningOperationTestServiceImpl.java index f1af145ca2d33..eded03c1d9012 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/AutoRestLongRunningOperationTestServiceImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/AutoRestLongRunningOperationTestServiceImpl.java @@ -8,35 +8,25 @@ * regenerated. */ -package fixtures.lro; +package fixtures.lro.implementation; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.CustomHeaderInterceptor; -import com.microsoft.rest.AutoRestBaseUrl; +import com.microsoft.azure.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; -import java.util.UUID; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; +import fixtures.lro.AutoRestLongRunningOperationTestService; +import fixtures.lro.LRORetrys; +import fixtures.lro.LROs; +import fixtures.lro.LROSADs; +import fixtures.lro.LROsCustomHeaders; /** - * Initializes a new instance of the AutoRestLongRunningOperationTestService class. + * Initializes a new instance of the AutoRestLongRunningOperationTestServiceImpl class. */ public final class AutoRestLongRunningOperationTestServiceImpl extends AzureServiceClient implements AutoRestLongRunningOperationTestService { - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - /** * Gets the {@link AzureClient} used for long running operations. * @return the azure client; @@ -45,18 +35,6 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - /** Gets or sets the preferred language for the response. */ private String acceptLanguage; @@ -65,7 +43,7 @@ public ServiceClientCredentials getCredentials() { * * @return the acceptLanguage value. */ - public String getAcceptLanguage() { + public String acceptLanguage() { return this.acceptLanguage; } @@ -73,9 +51,11 @@ public String getAcceptLanguage() { * Sets Gets or sets the preferred language for the response. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - public void setAcceptLanguage(String acceptLanguage) { + public AutoRestLongRunningOperationTestServiceImpl withAcceptLanguage(String acceptLanguage) { this.acceptLanguage = acceptLanguage; + return this; } /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ @@ -86,7 +66,7 @@ public void setAcceptLanguage(String acceptLanguage) { * * @return the longRunningOperationRetryTimeout value. */ - public int getLongRunningOperationRetryTimeout() { + public int longRunningOperationRetryTimeout() { return this.longRunningOperationRetryTimeout; } @@ -94,9 +74,11 @@ public int getLongRunningOperationRetryTimeout() { * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public AutoRestLongRunningOperationTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; } /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ @@ -107,7 +89,7 @@ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTim * * @return the generateClientRequestId value. */ - public boolean getGenerateClientRequestId() { + public boolean generateClientRequestId() { return this.generateClientRequestId; } @@ -115,41 +97,63 @@ public boolean getGenerateClientRequestId() { * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { + public AutoRestLongRunningOperationTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { this.generateClientRequestId = generateClientRequestId; + return this; } /** - * Gets the LROsOperations object to access its operations. - * @return the LROsOperations object. + * The LROs object to access its operations. + */ + private LROs lROs; + + /** + * Gets the LROs object to access its operations. + * @return the LROs object. */ - public LROsOperations getLROsOperations() { - return new LROsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public LROs lROs() { + return this.lROs; } /** - * Gets the LRORetrysOperations object to access its operations. - * @return the LRORetrysOperations object. + * The LRORetrys object to access its operations. + */ + private LRORetrys lRORetrys; + + /** + * Gets the LRORetrys object to access its operations. + * @return the LRORetrys object. */ - public LRORetrysOperations getLRORetrysOperations() { - return new LRORetrysOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public LRORetrys lRORetrys() { + return this.lRORetrys; } /** - * Gets the LROSADsOperations object to access its operations. - * @return the LROSADsOperations object. + * The LROSADs object to access its operations. */ - public LROSADsOperations getLROSADsOperations() { - return new LROSADsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + private LROSADs lROSADs; + + /** + * Gets the LROSADs object to access its operations. + * @return the LROSADs object. + */ + public LROSADs lROSADs() { + return this.lROSADs; } /** - * Gets the LROsCustomHeaderOperations object to access its operations. - * @return the LROsCustomHeaderOperations object. + * The LROsCustomHeaders object to access its operations. + */ + private LROsCustomHeaders lROsCustomHeaders; + + /** + * Gets the LROsCustomHeaders object to access its operations. + * @return the LROsCustomHeaders object. */ - public LROsCustomHeaderOperations getLROsCustomHeaderOperations() { - return new LROsCustomHeaderOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public LROsCustomHeaders lROsCustomHeaders() { + return this.lROsCustomHeaders; } /** @@ -168,39 +172,42 @@ public AutoRestLongRunningOperationTestServiceImpl(ServiceClientCredentials cred * @param credentials the management credentials for Azure */ public AutoRestLongRunningOperationTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } /** * Initializes an instance of AutoRestLongRunningOperationTestService client. * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param restClient the REST client to connect to Azure. */ - public AutoRestLongRunningOperationTestServiceImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; + public AutoRestLongRunningOperationTestServiceImpl(RestClient restClient) { + super(restClient); initialize(); } - @Override protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); + this.lROs = new LROsImpl(restClient().retrofit(), this); + this.lRORetrys = new LRORetrysImpl(restClient().retrofit(), this); + this.lROSADs = new LROSADsImpl(restClient().retrofit(), this); + this.lROsCustomHeaders = new LROsCustomHeadersImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestLongRunningOperationTestService, 1.0.0"); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrysOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LRORetrysImpl.java similarity index 92% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrysOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LRORetrysImpl.java index 7dc45ef9871d4..c7796c26b19bc 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrysOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LRORetrysImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.lro; +package fixtures.lro.implementation; +import retrofit2.Retrofit; +import fixtures.lro.LRORetrys; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; @@ -37,89 +39,88 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in LRORetrysOperations. + * in LRORetrys. */ -public final class LRORetrysOperationsImpl implements LRORetrysOperations { +public final class LRORetrysImpl implements LRORetrys { /** The Retrofit service to perform REST calls. */ private LRORetrysService service; /** The service client containing this operation class. */ - private AutoRestLongRunningOperationTestService client; + private AutoRestLongRunningOperationTestServiceImpl client; /** - * Initializes an instance of LRORetrysOperations. + * Initializes an instance of LRORetrysImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public LRORetrysOperationsImpl(Retrofit retrofit, AutoRestLongRunningOperationTestService client) { + public LRORetrysImpl(Retrofit retrofit, AutoRestLongRunningOperationTestServiceImpl client) { this.service = retrofit.create(LRORetrysService.class); this.client = client; } /** - * The interface defining all the services for LRORetrysOperations to be + * The interface defining all the services for LRORetrys to be * used by Retrofit to perform actually REST calls. */ interface LRORetrysService { @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/retryerror/put/201/creating/succeeded/200") - Call put201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/retryerror/put/201/creating/succeeded/200") - Call beginPut201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/retryerror/putasync/retry/succeeded") - Call putAsyncRelativeRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncRelativeRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/retryerror/putasync/retry/succeeded") - Call beginPutAsyncRelativeRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncRelativeRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/retryerror/delete/provisioning/202/accepted/200/succeeded", method = "DELETE", hasBody = true) - Call deleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage); + Call deleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/retryerror/delete/provisioning/202/accepted/200/succeeded", method = "DELETE", hasBody = true) - Call beginDeleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage); + Call beginDeleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/retryerror/delete/202/retry/200", method = "DELETE", hasBody = true) - Call delete202Retry200(@Header("accept-language") String acceptLanguage); + Call delete202Retry200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/retryerror/delete/202/retry/200", method = "DELETE", hasBody = true) - Call beginDelete202Retry200(@Header("accept-language") String acceptLanguage); + Call beginDelete202Retry200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/retryerror/deleteasync/retry/succeeded", method = "DELETE", hasBody = true) - Call deleteAsyncRelativeRetrySucceeded(@Header("accept-language") String acceptLanguage); + Call deleteAsyncRelativeRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/retryerror/deleteasync/retry/succeeded", method = "DELETE", hasBody = true) - Call beginDeleteAsyncRelativeRetrySucceeded(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncRelativeRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/retryerror/post/202/retry/200") - Call post202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call post202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/retryerror/post/202/retry/200") - Call beginPost202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPost202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/retryerror/postasync/retry/succeeded") - Call postAsyncRelativeRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncRelativeRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/retryerror/postasync/retry/succeeded") - Call beginPostAsyncRelativeRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncRelativeRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -133,7 +134,7 @@ interface LRORetrysService { */ public ServiceResponse put201CreatingSucceeded200() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -149,7 +150,7 @@ public ServiceCall put201CreatingSucceeded200Async(final ServiceCallback call = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -174,7 +175,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put201CreatingSucceeded200(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -191,7 +192,7 @@ public ServiceCall put201CreatingSucceeded200Async(Product product, final Servic throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -215,7 +216,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut201CreatingSucceeded200() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut201CreatingSucceeded200Delegate(call.execute()); } @@ -231,7 +232,7 @@ public ServiceCall beginPut201CreatingSucceeded200Async(final ServiceCallback call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -256,7 +257,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut201CreatingSucceeded200(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut201CreatingSucceeded200Delegate(call.execute()); } @@ -273,7 +274,7 @@ public ServiceCall beginPut201CreatingSucceeded200Async(Product product, final S throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -289,7 +290,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut201CreatingSucceeded200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -306,7 +307,7 @@ private ServiceResponse beginPut201CreatingSucceeded200Delegate(Respons */ public ServiceResponseWithHeaders putAsyncRelativeRetrySucceeded() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPutAsyncRelativeRetrySucceededHeaders.class); } @@ -322,7 +323,7 @@ public ServiceCall putAsyncRelativeRetrySucceededAsync(final ServiceCallback call = service.putAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -347,7 +348,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncRelativeRetrySucceeded(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPutAsyncRelativeRetrySucceededHeaders.class); } @@ -364,7 +365,7 @@ public ServiceCall putAsyncRelativeRetrySucceededAsync(Product product, final Se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -388,7 +389,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetrySucceeded() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetrySucceededDelegate(call.execute()); } @@ -404,7 +405,7 @@ public ServiceCall beginPutAsyncRelativeRetrySucceededAsync(final ServiceCallbac throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -429,7 +430,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetrySucceeded(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetrySucceededDelegate(call.execute()); } @@ -446,7 +447,7 @@ public ServiceCall beginPutAsyncRelativeRetrySucceededAsync(Product product, fin throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -462,7 +463,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncRelativeRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LRORetrysPutAsyncRelativeRetrySucceededHeaders.class); @@ -477,7 +478,7 @@ private ServiceResponseWithHeaders deleteProvisioning202Accepted200Succeeded() throws CloudException, IOException, InterruptedException { - Response result = service.deleteProvisioning202Accepted200Succeeded(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysDeleteProvisioning202Accepted200SucceededHeaders.class); } @@ -492,7 +493,7 @@ public ServiceCall deleteProvisioning202Accepted200SucceededAsync(final ServiceC if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteProvisioning202Accepted200Succeeded(this.client.getAcceptLanguage()); + Call call = service.deleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -515,7 +516,7 @@ public void onResponse(Call call, Response response) * @return the Product object wrapped in {@link ServiceResponseWithHeaders} if successful. */ public ServiceResponseWithHeaders beginDeleteProvisioning202Accepted200Succeeded() throws CloudException, IOException { - Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteProvisioning202Accepted200SucceededDelegate(call.execute()); } @@ -530,7 +531,7 @@ public ServiceCall beginDeleteProvisioning202Accepted200SucceededAsync(final Ser if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -546,7 +547,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteProvisioning202Accepted200SucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -562,7 +563,7 @@ private ServiceResponseWithHeaders delete202Retry200() throws CloudException, IOException, InterruptedException { - Response result = service.delete202Retry200(this.client.getAcceptLanguage()).execute(); + Response result = service.delete202Retry200(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysDelete202Retry200Headers.class); } @@ -577,7 +578,7 @@ public ServiceCall delete202Retry200Async(final ServiceCallback serviceCal if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.delete202Retry200(this.client.getAcceptLanguage()); + Call call = service.delete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -600,7 +601,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDelete202Retry200() throws CloudException, IOException { - Call call = service.beginDelete202Retry200(this.client.getAcceptLanguage()); + Call call = service.beginDelete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); return beginDelete202Retry200Delegate(call.execute()); } @@ -615,7 +616,7 @@ public ServiceCall beginDelete202Retry200Async(final ServiceCallback servi if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDelete202Retry200(this.client.getAcceptLanguage()); + Call call = service.beginDelete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -631,7 +632,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDelete202Retry200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LRORetrysDelete202Retry200Headers.class); @@ -646,7 +647,7 @@ private ServiceResponseWithHeaders begi * @return the ServiceResponseWithHeaders object if successful. */ public ServiceResponseWithHeaders deleteAsyncRelativeRetrySucceeded() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncRelativeRetrySucceeded(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncRelativeRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysDeleteAsyncRelativeRetrySucceededHeaders.class); } @@ -661,7 +662,7 @@ public ServiceCall deleteAsyncRelativeRetrySucceededAsync(final ServiceCallback< if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteAsyncRelativeRetrySucceeded(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncRelativeRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -684,7 +685,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetrySucceeded() throws CloudException, IOException { - Call call = service.beginDeleteAsyncRelativeRetrySucceeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncRelativeRetrySucceededDelegate(call.execute()); } @@ -699,7 +700,7 @@ public ServiceCall beginDeleteAsyncRelativeRetrySucceededAsync(final ServiceCall if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteAsyncRelativeRetrySucceeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -715,7 +716,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LRORetrysDeleteAsyncRelativeRetrySucceededHeaders.class); @@ -731,7 +732,7 @@ private ServiceResponseWithHeaders post202Retry200() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.post202Retry200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPost202Retry200Headers.class); } @@ -747,7 +748,7 @@ public ServiceCall post202Retry200Async(final ServiceCallback serviceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.post202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -772,7 +773,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders post202Retry200(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.post202Retry200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPost202Retry200Headers.class); } @@ -789,7 +790,7 @@ public ServiceCall post202Retry200Async(Product product, final ServiceCallback call = service.post202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -813,7 +814,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202Retry200() throws CloudException, IOException { final Product product = null; - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202Retry200Delegate(call.execute()); } @@ -829,7 +830,7 @@ public ServiceCall beginPost202Retry200Async(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -854,7 +855,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202Retry200(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202Retry200Delegate(call.execute()); } @@ -871,7 +872,7 @@ public ServiceCall beginPost202Retry200Async(Product product, final ServiceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -887,7 +888,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPost202Retry200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LRORetrysPost202Retry200Headers.class); @@ -903,7 +904,7 @@ private ServiceResponseWithHeaders beginP */ public ServiceResponseWithHeaders postAsyncRelativeRetrySucceeded() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPostAsyncRelativeRetrySucceededHeaders.class); } @@ -919,7 +920,7 @@ public ServiceCall postAsyncRelativeRetrySucceededAsync(final ServiceCallback call = service.postAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -944,7 +945,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncRelativeRetrySucceeded(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LRORetrysPostAsyncRelativeRetrySucceededHeaders.class); } @@ -961,7 +962,7 @@ public ServiceCall postAsyncRelativeRetrySucceededAsync(Product product, final S throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -985,7 +986,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetrySucceeded() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetrySucceededDelegate(call.execute()); } @@ -1001,7 +1002,7 @@ public ServiceCall beginPostAsyncRelativeRetrySucceededAsync(final ServiceCallba throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1026,7 +1027,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetrySucceeded(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetrySucceededDelegate(call.execute()); } @@ -1043,7 +1044,7 @@ public ServiceCall beginPostAsyncRelativeRetrySucceededAsync(Product product, fi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1059,7 +1060,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncRelativeRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LRORetrysPostAsyncRelativeRetrySucceededHeaders.class); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADsOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LROSADsImpl.java similarity index 92% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADsOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LROSADsImpl.java index 2f3623d834f8d..bf3f13fc913ce 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADsOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LROSADsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.lro; +package fixtures.lro.implementation; +import retrofit2.Retrofit; +import fixtures.lro.LROSADs; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; @@ -51,241 +53,240 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in LROSADsOperations. + * in LROSADs. */ -public final class LROSADsOperationsImpl implements LROSADsOperations { +public final class LROSADsImpl implements LROSADs { /** The Retrofit service to perform REST calls. */ private LROSADsService service; /** The service client containing this operation class. */ - private AutoRestLongRunningOperationTestService client; + private AutoRestLongRunningOperationTestServiceImpl client; /** - * Initializes an instance of LROSADsOperations. + * Initializes an instance of LROSADsImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public LROSADsOperationsImpl(Retrofit retrofit, AutoRestLongRunningOperationTestService client) { + public LROSADsImpl(Retrofit retrofit, AutoRestLongRunningOperationTestServiceImpl client) { this.service = retrofit.create(LROSADsService.class); this.client = client; } /** - * The interface defining all the services for LROSADsOperations to be + * The interface defining all the services for LROSADs to be * used by Retrofit to perform actually REST calls. */ interface LROSADsService { @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/nonretryerror/put/400") - Call putNonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putNonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/nonretryerror/put/400") - Call beginPutNonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutNonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/nonretryerror/put/201/creating/400") - Call putNonRetry201Creating400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putNonRetry201Creating400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/nonretryerror/put/201/creating/400") - Call beginPutNonRetry201Creating400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutNonRetry201Creating400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/nonretryerror/put/201/creating/400/invalidjson") - Call putNonRetry201Creating400InvalidJson(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putNonRetry201Creating400InvalidJson(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/nonretryerror/put/201/creating/400/invalidjson") - Call beginPutNonRetry201Creating400InvalidJson(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutNonRetry201Creating400InvalidJson(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/nonretryerror/putasync/retry/400") - Call putAsyncRelativeRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncRelativeRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/nonretryerror/putasync/retry/400") - Call beginPutAsyncRelativeRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncRelativeRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/nonretryerror/delete/400", method = "DELETE", hasBody = true) - Call deleteNonRetry400(@Header("accept-language") String acceptLanguage); + Call deleteNonRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/nonretryerror/delete/400", method = "DELETE", hasBody = true) - Call beginDeleteNonRetry400(@Header("accept-language") String acceptLanguage); + Call beginDeleteNonRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/nonretryerror/delete/202/retry/400", method = "DELETE", hasBody = true) - Call delete202NonRetry400(@Header("accept-language") String acceptLanguage); + Call delete202NonRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/nonretryerror/delete/202/retry/400", method = "DELETE", hasBody = true) - Call beginDelete202NonRetry400(@Header("accept-language") String acceptLanguage); + Call beginDelete202NonRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/nonretryerror/deleteasync/retry/400", method = "DELETE", hasBody = true) - Call deleteAsyncRelativeRetry400(@Header("accept-language") String acceptLanguage); + Call deleteAsyncRelativeRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/nonretryerror/deleteasync/retry/400", method = "DELETE", hasBody = true) - Call beginDeleteAsyncRelativeRetry400(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncRelativeRetry400(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/nonretryerror/post/400") - Call postNonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postNonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/nonretryerror/post/400") - Call beginPostNonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostNonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/nonretryerror/post/202/retry/400") - Call post202NonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call post202NonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/nonretryerror/post/202/retry/400") - Call beginPost202NonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPost202NonRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/nonretryerror/postasync/retry/400") - Call postAsyncRelativeRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncRelativeRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/nonretryerror/postasync/retry/400") - Call beginPostAsyncRelativeRetry400(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncRelativeRetry400(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/put/201/noprovisioningstatepayload") - Call putError201NoProvisioningStatePayload(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putError201NoProvisioningStatePayload(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/put/201/noprovisioningstatepayload") - Call beginPutError201NoProvisioningStatePayload(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutError201NoProvisioningStatePayload(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/putasync/retry/nostatus") - Call putAsyncRelativeRetryNoStatus(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncRelativeRetryNoStatus(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/putasync/retry/nostatus") - Call beginPutAsyncRelativeRetryNoStatus(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncRelativeRetryNoStatus(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/putasync/retry/nostatuspayload") - Call putAsyncRelativeRetryNoStatusPayload(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncRelativeRetryNoStatusPayload(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/putasync/retry/nostatuspayload") - Call beginPutAsyncRelativeRetryNoStatusPayload(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncRelativeRetryNoStatusPayload(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/delete/204/nolocation", method = "DELETE", hasBody = true) - Call delete204Succeeded(@Header("accept-language") String acceptLanguage); + Call delete204Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/delete/204/nolocation", method = "DELETE", hasBody = true) - Call beginDelete204Succeeded(@Header("accept-language") String acceptLanguage); + Call beginDelete204Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/deleteasync/retry/nostatus", method = "DELETE", hasBody = true) - Call deleteAsyncRelativeRetryNoStatus(@Header("accept-language") String acceptLanguage); + Call deleteAsyncRelativeRetryNoStatus(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/deleteasync/retry/nostatus", method = "DELETE", hasBody = true) - Call beginDeleteAsyncRelativeRetryNoStatus(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncRelativeRetryNoStatus(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/post/202/nolocation") - Call post202NoLocation(@Body Product product, @Header("accept-language") String acceptLanguage); + Call post202NoLocation(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/post/202/nolocation") - Call beginPost202NoLocation(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPost202NoLocation(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/postasync/retry/nopayload") - Call postAsyncRelativeRetryNoPayload(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncRelativeRetryNoPayload(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/postasync/retry/nopayload") - Call beginPostAsyncRelativeRetryNoPayload(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncRelativeRetryNoPayload(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/put/200/invalidjson") - Call put200InvalidJson(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put200InvalidJson(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/put/200/invalidjson") - Call beginPut200InvalidJson(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut200InvalidJson(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/putasync/retry/invalidheader") - Call putAsyncRelativeRetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncRelativeRetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/putasync/retry/invalidheader") - Call beginPutAsyncRelativeRetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncRelativeRetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/putasync/retry/invalidjsonpolling") - Call putAsyncRelativeRetryInvalidJsonPolling(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncRelativeRetryInvalidJsonPolling(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/error/putasync/retry/invalidjsonpolling") - Call beginPutAsyncRelativeRetryInvalidJsonPolling(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncRelativeRetryInvalidJsonPolling(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/delete/202/retry/invalidheader", method = "DELETE", hasBody = true) - Call delete202RetryInvalidHeader(@Header("accept-language") String acceptLanguage); + Call delete202RetryInvalidHeader(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/delete/202/retry/invalidheader", method = "DELETE", hasBody = true) - Call beginDelete202RetryInvalidHeader(@Header("accept-language") String acceptLanguage); + Call beginDelete202RetryInvalidHeader(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/deleteasync/retry/invalidheader", method = "DELETE", hasBody = true) - Call deleteAsyncRelativeRetryInvalidHeader(@Header("accept-language") String acceptLanguage); + Call deleteAsyncRelativeRetryInvalidHeader(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/deleteasync/retry/invalidheader", method = "DELETE", hasBody = true) - Call beginDeleteAsyncRelativeRetryInvalidHeader(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncRelativeRetryInvalidHeader(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/deleteasync/retry/invalidjsonpolling", method = "DELETE", hasBody = true) - Call deleteAsyncRelativeRetryInvalidJsonPolling(@Header("accept-language") String acceptLanguage); + Call deleteAsyncRelativeRetryInvalidJsonPolling(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/error/deleteasync/retry/invalidjsonpolling", method = "DELETE", hasBody = true) - Call beginDeleteAsyncRelativeRetryInvalidJsonPolling(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncRelativeRetryInvalidJsonPolling(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/post/202/retry/invalidheader") - Call post202RetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage); + Call post202RetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/post/202/retry/invalidheader") - Call beginPost202RetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPost202RetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/postasync/retry/invalidheader") - Call postAsyncRelativeRetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncRelativeRetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/postasync/retry/invalidheader") - Call beginPostAsyncRelativeRetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncRelativeRetryInvalidHeader(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/postasync/retry/invalidjsonpolling") - Call postAsyncRelativeRetryInvalidJsonPolling(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncRelativeRetryInvalidJsonPolling(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/error/postasync/retry/invalidjsonpolling") - Call beginPostAsyncRelativeRetryInvalidJsonPolling(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncRelativeRetryInvalidJsonPolling(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -299,7 +300,7 @@ interface LROSADsService { */ public ServiceResponse putNonRetry400() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putNonRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -315,7 +316,7 @@ public ServiceCall putNonRetry400Async(final ServiceCallback serviceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -340,7 +341,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putNonRetry400(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putNonRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -357,7 +358,7 @@ public ServiceCall putNonRetry400Async(Product product, final ServiceCallback call = service.putNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.putNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -381,7 +382,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutNonRetry400() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNonRetry400Delegate(call.execute()); } @@ -397,7 +398,7 @@ public ServiceCall beginPutNonRetry400Async(final ServiceCallback servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -422,7 +423,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutNonRetry400(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNonRetry400Delegate(call.execute()); } @@ -439,7 +440,7 @@ public ServiceCall beginPutNonRetry400Async(Product product, final ServiceCallba throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -455,7 +456,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPutNonRetry400Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -472,7 +473,7 @@ private ServiceResponse beginPutNonRetry400Delegate(Response putNonRetry201Creating400() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putNonRetry201Creating400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -488,7 +489,7 @@ public ServiceCall putNonRetry201Creating400Async(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putNonRetry201Creating400(product, this.client.getAcceptLanguage()); + Call call = service.putNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -513,7 +514,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putNonRetry201Creating400(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putNonRetry201Creating400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -530,7 +531,7 @@ public ServiceCall putNonRetry201Creating400Async(Product product, final Service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putNonRetry201Creating400(product, this.client.getAcceptLanguage()); + Call call = service.putNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -554,7 +555,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutNonRetry201Creating400() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutNonRetry201Creating400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNonRetry201Creating400Delegate(call.execute()); } @@ -570,7 +571,7 @@ public ServiceCall beginPutNonRetry201Creating400Async(final ServiceCallback call = service.beginPutNonRetry201Creating400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -595,7 +596,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutNonRetry201Creating400(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutNonRetry201Creating400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNonRetry201Creating400Delegate(call.execute()); } @@ -612,7 +613,7 @@ public ServiceCall beginPutNonRetry201Creating400Async(Product product, final Se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutNonRetry201Creating400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry201Creating400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -628,7 +629,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPutNonRetry201Creating400Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -645,7 +646,7 @@ private ServiceResponse beginPutNonRetry201Creating400Delegate(Response */ public ServiceResponse putNonRetry201Creating400InvalidJson() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putNonRetry201Creating400InvalidJson(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -661,7 +662,7 @@ public ServiceCall putNonRetry201Creating400InvalidJsonAsync(final ServiceCallba throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putNonRetry201Creating400InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.putNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -686,7 +687,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putNonRetry201Creating400InvalidJson(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putNonRetry201Creating400InvalidJson(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -703,7 +704,7 @@ public ServiceCall putNonRetry201Creating400InvalidJsonAsync(Product product, fi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putNonRetry201Creating400InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.putNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -727,7 +728,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutNonRetry201Creating400InvalidJson() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNonRetry201Creating400InvalidJsonDelegate(call.execute()); } @@ -743,7 +744,7 @@ public ServiceCall beginPutNonRetry201Creating400InvalidJsonAsync(final ServiceC throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -768,7 +769,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutNonRetry201Creating400InvalidJson(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNonRetry201Creating400InvalidJsonDelegate(call.execute()); } @@ -785,7 +786,7 @@ public ServiceCall beginPutNonRetry201Creating400InvalidJsonAsync(Product produc throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNonRetry201Creating400InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -801,7 +802,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPutNonRetry201Creating400InvalidJsonDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -818,7 +819,7 @@ private ServiceResponse beginPutNonRetry201Creating400InvalidJsonDelega */ public ServiceResponseWithHeaders putAsyncRelativeRetry400() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncRelativeRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetry400Headers.class); } @@ -834,7 +835,7 @@ public ServiceCall putAsyncRelativeRetry400Async(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -859,7 +860,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncRelativeRetry400(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncRelativeRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetry400Headers.class); } @@ -876,7 +877,7 @@ public ServiceCall putAsyncRelativeRetry400Async(Product product, final ServiceC throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -900,7 +901,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetry400() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetry400Delegate(call.execute()); } @@ -916,7 +917,7 @@ public ServiceCall beginPutAsyncRelativeRetry400Async(final ServiceCallback call = service.beginPutAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -941,7 +942,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetry400(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetry400Delegate(call.execute()); } @@ -958,7 +959,7 @@ public ServiceCall beginPutAsyncRelativeRetry400Async(Product product, final Ser throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -974,7 +975,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncRelativeRetry400Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPutAsyncRelativeRetry400Headers.class); @@ -989,7 +990,7 @@ private ServiceResponseWithHeaders deleteNonRetry400() throws CloudException, IOException, InterruptedException { - Response result = service.deleteNonRetry400(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteNonRetry400(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteNonRetry400Headers.class); } @@ -1004,7 +1005,7 @@ public ServiceCall deleteNonRetry400Async(final ServiceCallback serviceCal if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteNonRetry400(this.client.getAcceptLanguage()); + Call call = service.deleteNonRetry400(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1027,7 +1028,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteNonRetry400() throws CloudException, IOException { - Call call = service.beginDeleteNonRetry400(this.client.getAcceptLanguage()); + Call call = service.beginDeleteNonRetry400(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteNonRetry400Delegate(call.execute()); } @@ -1042,7 +1043,7 @@ public ServiceCall beginDeleteNonRetry400Async(final ServiceCallback servi if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteNonRetry400(this.client.getAcceptLanguage()); + Call call = service.beginDeleteNonRetry400(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1058,7 +1059,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteNonRetry400Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsDeleteNonRetry400Headers.class); @@ -1073,7 +1074,7 @@ private ServiceResponseWithHeaders beginD * @return the ServiceResponseWithHeaders object if successful. */ public ServiceResponseWithHeaders delete202NonRetry400() throws CloudException, IOException, InterruptedException { - Response result = service.delete202NonRetry400(this.client.getAcceptLanguage()).execute(); + Response result = service.delete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDelete202NonRetry400Headers.class); } @@ -1088,7 +1089,7 @@ public ServiceCall delete202NonRetry400Async(final ServiceCallback service if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.delete202NonRetry400(this.client.getAcceptLanguage()); + Call call = service.delete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1111,7 +1112,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDelete202NonRetry400() throws CloudException, IOException { - Call call = service.beginDelete202NonRetry400(this.client.getAcceptLanguage()); + Call call = service.beginDelete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()); return beginDelete202NonRetry400Delegate(call.execute()); } @@ -1126,7 +1127,7 @@ public ServiceCall beginDelete202NonRetry400Async(final ServiceCallback se if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDelete202NonRetry400(this.client.getAcceptLanguage()); + Call call = service.beginDelete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1142,7 +1143,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDelete202NonRetry400Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsDelete202NonRetry400Headers.class); @@ -1157,7 +1158,7 @@ private ServiceResponseWithHeaders beg * @return the ServiceResponseWithHeaders object if successful. */ public ServiceResponseWithHeaders deleteAsyncRelativeRetry400() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncRelativeRetry400(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncRelativeRetry400(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetry400Headers.class); } @@ -1172,7 +1173,7 @@ public ServiceCall deleteAsyncRelativeRetry400Async(final ServiceCallback if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteAsyncRelativeRetry400(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncRelativeRetry400(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1195,7 +1196,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetry400() throws CloudException, IOException { - Call call = service.beginDeleteAsyncRelativeRetry400(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetry400(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncRelativeRetry400Delegate(call.execute()); } @@ -1210,7 +1211,7 @@ public ServiceCall beginDeleteAsyncRelativeRetry400Async(final ServiceCallback call = service.beginDeleteAsyncRelativeRetry400(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetry400(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1226,7 +1227,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetry400Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsDeleteAsyncRelativeRetry400Headers.class); @@ -1242,7 +1243,7 @@ private ServiceResponseWithHeaders postNonRetry400() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postNonRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostNonRetry400Headers.class); } @@ -1258,7 +1259,7 @@ public ServiceCall postNonRetry400Async(final ServiceCallback serviceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.postNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.postNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1283,7 +1284,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postNonRetry400(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postNonRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostNonRetry400Headers.class); } @@ -1300,7 +1301,7 @@ public ServiceCall postNonRetry400Async(Product product, final ServiceCallback call = service.postNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.postNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1324,7 +1325,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostNonRetry400() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPostNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostNonRetry400Delegate(call.execute()); } @@ -1340,7 +1341,7 @@ public ServiceCall beginPostNonRetry400Async(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPostNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPostNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1365,7 +1366,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostNonRetry400(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPostNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostNonRetry400Delegate(call.execute()); } @@ -1382,7 +1383,7 @@ public ServiceCall beginPostNonRetry400Async(Product product, final ServiceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostNonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPostNonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1398,7 +1399,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostNonRetry400Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPostNonRetry400Headers.class); @@ -1414,7 +1415,7 @@ private ServiceResponseWithHeaders beginPos */ public ServiceResponseWithHeaders post202NonRetry400() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.post202NonRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202NonRetry400Headers.class); } @@ -1430,7 +1431,7 @@ public ServiceCall post202NonRetry400Async(final ServiceCallback serviceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.post202NonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.post202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1455,7 +1456,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders post202NonRetry400(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.post202NonRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202NonRetry400Headers.class); } @@ -1472,7 +1473,7 @@ public ServiceCall post202NonRetry400Async(Product product, final ServiceCallbac throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.post202NonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.post202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1496,7 +1497,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202NonRetry400() throws CloudException, IOException { final Product product = null; - Call call = service.beginPost202NonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202NonRetry400Delegate(call.execute()); } @@ -1512,7 +1513,7 @@ public ServiceCall beginPost202NonRetry400Async(final ServiceCallback serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPost202NonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1537,7 +1538,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202NonRetry400(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPost202NonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202NonRetry400Delegate(call.execute()); } @@ -1554,7 +1555,7 @@ public ServiceCall beginPost202NonRetry400Async(Product product, final ServiceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPost202NonRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1570,7 +1571,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPost202NonRetry400Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPost202NonRetry400Headers.class); @@ -1586,7 +1587,7 @@ private ServiceResponseWithHeaders begin */ public ServiceResponseWithHeaders postAsyncRelativeRetry400() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncRelativeRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetry400Headers.class); } @@ -1602,7 +1603,7 @@ public ServiceCall postAsyncRelativeRetry400Async(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.postAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1627,7 +1628,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncRelativeRetry400(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncRelativeRetry400(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetry400Headers.class); } @@ -1644,7 +1645,7 @@ public ServiceCall postAsyncRelativeRetry400Async(Product product, final Service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1668,7 +1669,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetry400() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetry400Delegate(call.execute()); } @@ -1684,7 +1685,7 @@ public ServiceCall beginPostAsyncRelativeRetry400Async(final ServiceCallback call = service.beginPostAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1709,7 +1710,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetry400(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetry400Delegate(call.execute()); } @@ -1726,7 +1727,7 @@ public ServiceCall beginPostAsyncRelativeRetry400Async(Product product, final Se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncRelativeRetry400(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetry400(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1742,7 +1743,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncRelativeRetry400Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPostAsyncRelativeRetry400Headers.class); @@ -1758,7 +1759,7 @@ private ServiceResponseWithHeaders putError201NoProvisioningStatePayload() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putError201NoProvisioningStatePayload(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -1774,7 +1775,7 @@ public ServiceCall putError201NoProvisioningStatePayloadAsync(final ServiceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putError201NoProvisioningStatePayload(product, this.client.getAcceptLanguage()); + Call call = service.putError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1799,7 +1800,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putError201NoProvisioningStatePayload(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putError201NoProvisioningStatePayload(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -1816,7 +1817,7 @@ public ServiceCall putError201NoProvisioningStatePayloadAsync(Product product, f throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putError201NoProvisioningStatePayload(product, this.client.getAcceptLanguage()); + Call call = service.putError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1840,7 +1841,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutError201NoProvisioningStatePayload() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutError201NoProvisioningStatePayloadDelegate(call.execute()); } @@ -1856,7 +1857,7 @@ public ServiceCall beginPutError201NoProvisioningStatePayloadAsync(final Service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1881,7 +1882,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutError201NoProvisioningStatePayload(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutError201NoProvisioningStatePayloadDelegate(call.execute()); } @@ -1898,7 +1899,7 @@ public ServiceCall beginPutError201NoProvisioningStatePayloadAsync(Product produ throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPutError201NoProvisioningStatePayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1914,7 +1915,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPutError201NoProvisioningStatePayloadDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -1931,7 +1932,7 @@ private ServiceResponse beginPutError201NoProvisioningStatePayloadDeleg */ public ServiceResponseWithHeaders putAsyncRelativeRetryNoStatus() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncRelativeRetryNoStatus(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusHeaders.class); } @@ -1947,7 +1948,7 @@ public ServiceCall putAsyncRelativeRetryNoStatusAsync(final ServiceCallback call = service.putAsyncRelativeRetryNoStatus(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1972,7 +1973,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncRelativeRetryNoStatus(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncRelativeRetryNoStatus(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusHeaders.class); } @@ -1989,7 +1990,7 @@ public ServiceCall putAsyncRelativeRetryNoStatusAsync(Product product, final Ser throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncRelativeRetryNoStatus(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2013,7 +2014,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatus() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetryNoStatusDelegate(call.execute()); } @@ -2029,7 +2030,7 @@ public ServiceCall beginPutAsyncRelativeRetryNoStatusAsync(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2054,7 +2055,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatus(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetryNoStatusDelegate(call.execute()); } @@ -2071,7 +2072,7 @@ public ServiceCall beginPutAsyncRelativeRetryNoStatusAsync(Product product, fina throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryNoStatus(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2087,7 +2088,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatusDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPutAsyncRelativeRetryNoStatusHeaders.class); @@ -2103,7 +2104,7 @@ private ServiceResponseWithHeaders putAsyncRelativeRetryNoStatusPayload() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders.class); } @@ -2119,7 +2120,7 @@ public ServiceCall putAsyncRelativeRetryNoStatusPayloadAsync(final ServiceCallba throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2144,7 +2145,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncRelativeRetryNoStatusPayload(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders.class); } @@ -2161,7 +2162,7 @@ public ServiceCall putAsyncRelativeRetryNoStatusPayloadAsync(Product product, fi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2185,7 +2186,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatusPayload() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetryNoStatusPayloadDelegate(call.execute()); } @@ -2201,7 +2202,7 @@ public ServiceCall beginPutAsyncRelativeRetryNoStatusPayloadAsync(final ServiceC throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2226,7 +2227,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatusPayload(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetryNoStatusPayloadDelegate(call.execute()); } @@ -2243,7 +2244,7 @@ public ServiceCall beginPutAsyncRelativeRetryNoStatusPayloadAsync(Product produc throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryNoStatusPayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2259,7 +2260,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncRelativeRetryNoStatusPayloadDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders.class); @@ -2274,7 +2275,7 @@ private ServiceResponseWithHeaders delete204Succeeded() throws CloudException, IOException, InterruptedException { - Response result = service.delete204Succeeded(this.client.getAcceptLanguage()).execute(); + Response result = service.delete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() { }.getType()); } @@ -2289,7 +2290,7 @@ public ServiceCall delete204SucceededAsync(final ServiceCallback serviceCa if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.delete204Succeeded(this.client.getAcceptLanguage()); + Call call = service.delete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2312,7 +2313,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse beginDelete204Succeeded() throws CloudException, IOException { - Call call = service.beginDelete204Succeeded(this.client.getAcceptLanguage()); + Call call = service.beginDelete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); return beginDelete204SucceededDelegate(call.execute()); } @@ -2327,7 +2328,7 @@ public ServiceCall beginDelete204SucceededAsync(final ServiceCallback serv if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDelete204Succeeded(this.client.getAcceptLanguage()); + Call call = service.beginDelete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2343,7 +2344,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginDelete204SucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -2358,7 +2359,7 @@ private ServiceResponse beginDelete204SucceededDelegate(Response deleteAsyncRelativeRetryNoStatus() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncRelativeRetryNoStatus(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncRelativeRetryNoStatus(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetryNoStatusHeaders.class); } @@ -2373,7 +2374,7 @@ public ServiceCall deleteAsyncRelativeRetryNoStatusAsync(final ServiceCallback call = service.deleteAsyncRelativeRetryNoStatus(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncRelativeRetryNoStatus(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2396,7 +2397,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryNoStatus() throws CloudException, IOException { - Call call = service.beginDeleteAsyncRelativeRetryNoStatus(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetryNoStatus(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncRelativeRetryNoStatusDelegate(call.execute()); } @@ -2411,7 +2412,7 @@ public ServiceCall beginDeleteAsyncRelativeRetryNoStatusAsync(final ServiceCallb if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteAsyncRelativeRetryNoStatus(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetryNoStatus(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2427,7 +2428,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryNoStatusDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsDeleteAsyncRelativeRetryNoStatusHeaders.class); @@ -2443,7 +2444,7 @@ private ServiceResponseWithHeaders post202NoLocation() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.post202NoLocation(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202NoLocationHeaders.class); } @@ -2459,7 +2460,7 @@ public ServiceCall post202NoLocationAsync(final ServiceCallback serviceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.post202NoLocation(product, this.client.getAcceptLanguage()); + Call call = service.post202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2484,7 +2485,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders post202NoLocation(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.post202NoLocation(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202NoLocationHeaders.class); } @@ -2501,7 +2502,7 @@ public ServiceCall post202NoLocationAsync(Product product, final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.post202NoLocation(product, this.client.getAcceptLanguage()); + Call call = service.post202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2525,7 +2526,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202NoLocation() throws CloudException, IOException { final Product product = null; - Call call = service.beginPost202NoLocation(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202NoLocationDelegate(call.execute()); } @@ -2541,7 +2542,7 @@ public ServiceCall beginPost202NoLocationAsync(final ServiceCallback servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPost202NoLocation(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2566,7 +2567,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202NoLocation(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPost202NoLocation(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202NoLocationDelegate(call.execute()); } @@ -2583,7 +2584,7 @@ public ServiceCall beginPost202NoLocationAsync(Product product, final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPost202NoLocation(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NoLocation(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2599,7 +2600,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPost202NoLocationDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPost202NoLocationHeaders.class); @@ -2615,7 +2616,7 @@ private ServiceResponseWithHeaders beginP */ public ServiceResponseWithHeaders postAsyncRelativeRetryNoPayload() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncRelativeRetryNoPayload(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryNoPayloadHeaders.class); } @@ -2631,7 +2632,7 @@ public ServiceCall postAsyncRelativeRetryNoPayloadAsync(final ServiceCallback call = service.postAsyncRelativeRetryNoPayload(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2656,7 +2657,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncRelativeRetryNoPayload(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncRelativeRetryNoPayload(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryNoPayloadHeaders.class); } @@ -2673,7 +2674,7 @@ public ServiceCall postAsyncRelativeRetryNoPayloadAsync(Product product, final S throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncRelativeRetryNoPayload(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2697,7 +2698,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetryNoPayload() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetryNoPayloadDelegate(call.execute()); } @@ -2713,7 +2714,7 @@ public ServiceCall beginPostAsyncRelativeRetryNoPayloadAsync(final ServiceCallba throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2738,7 +2739,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetryNoPayload(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetryNoPayloadDelegate(call.execute()); } @@ -2755,7 +2756,7 @@ public ServiceCall beginPostAsyncRelativeRetryNoPayloadAsync(Product product, fi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryNoPayload(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2771,7 +2772,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncRelativeRetryNoPayloadDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPostAsyncRelativeRetryNoPayloadHeaders.class); @@ -2787,7 +2788,7 @@ private ServiceResponseWithHeaders put200InvalidJson() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put200InvalidJson(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -2803,7 +2804,7 @@ public ServiceCall put200InvalidJsonAsync(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.put200InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.put200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2828,7 +2829,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put200InvalidJson(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put200InvalidJson(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -2845,7 +2846,7 @@ public ServiceCall put200InvalidJsonAsync(Product product, final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.put200InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.put200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2869,7 +2870,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200InvalidJson() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut200InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200InvalidJsonDelegate(call.execute()); } @@ -2885,7 +2886,7 @@ public ServiceCall beginPut200InvalidJsonAsync(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPut200InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2910,7 +2911,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200InvalidJson(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut200InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200InvalidJsonDelegate(call.execute()); } @@ -2927,7 +2928,7 @@ public ServiceCall beginPut200InvalidJsonAsync(Product product, final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut200InvalidJson(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200InvalidJson(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2943,7 +2944,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut200InvalidJsonDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -2960,7 +2961,7 @@ private ServiceResponse beginPut200InvalidJsonDelegate(Response putAsyncRelativeRetryInvalidHeader() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders.class); } @@ -2976,7 +2977,7 @@ public ServiceCall putAsyncRelativeRetryInvalidHeaderAsync(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3001,7 +3002,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncRelativeRetryInvalidHeader(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders.class); } @@ -3018,7 +3019,7 @@ public ServiceCall putAsyncRelativeRetryInvalidHeaderAsync(Product product, fina throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3042,7 +3043,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidHeader() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); } @@ -3058,7 +3059,7 @@ public ServiceCall beginPutAsyncRelativeRetryInvalidHeaderAsync(final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3083,7 +3084,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidHeader(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); } @@ -3100,7 +3101,7 @@ public ServiceCall beginPutAsyncRelativeRetryInvalidHeaderAsync(Product product, throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3116,7 +3117,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders.class); @@ -3132,7 +3133,7 @@ private ServiceResponseWithHeaders putAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders.class); } @@ -3148,7 +3149,7 @@ public ServiceCall putAsyncRelativeRetryInvalidJsonPollingAsync(final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3173,7 +3174,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncRelativeRetryInvalidJsonPolling(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders.class); } @@ -3190,7 +3191,7 @@ public ServiceCall putAsyncRelativeRetryInvalidJsonPollingAsync(Product product, throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3214,7 +3215,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); } @@ -3230,7 +3231,7 @@ public ServiceCall beginPutAsyncRelativeRetryInvalidJsonPollingAsync(final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3255,7 +3256,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidJsonPolling(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); } @@ -3272,7 +3273,7 @@ public ServiceCall beginPutAsyncRelativeRetryInvalidJsonPollingAsync(Product pro throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3288,7 +3289,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncRelativeRetryInvalidJsonPollingDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders.class); @@ -3303,7 +3304,7 @@ private ServiceResponseWithHeaders delete202RetryInvalidHeader() throws CloudException, IOException, InterruptedException { - Response result = service.delete202RetryInvalidHeader(this.client.getAcceptLanguage()).execute(); + Response result = service.delete202RetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDelete202RetryInvalidHeaderHeaders.class); } @@ -3318,7 +3319,7 @@ public ServiceCall delete202RetryInvalidHeaderAsync(final ServiceCallback if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.delete202RetryInvalidHeader(this.client.getAcceptLanguage()); + Call call = service.delete202RetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3341,7 +3342,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDelete202RetryInvalidHeader() throws CloudException, IOException { - Call call = service.beginDelete202RetryInvalidHeader(this.client.getAcceptLanguage()); + Call call = service.beginDelete202RetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); return beginDelete202RetryInvalidHeaderDelegate(call.execute()); } @@ -3356,7 +3357,7 @@ public ServiceCall beginDelete202RetryInvalidHeaderAsync(final ServiceCallback call = service.beginDelete202RetryInvalidHeader(this.client.getAcceptLanguage()); + Call call = service.beginDelete202RetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3372,7 +3373,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDelete202RetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsDelete202RetryInvalidHeaderHeaders.class); @@ -3387,7 +3388,7 @@ private ServiceResponseWithHeaders deleteAsyncRelativeRetryInvalidHeader() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncRelativeRetryInvalidHeader(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncRelativeRetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders.class); } @@ -3402,7 +3403,7 @@ public ServiceCall deleteAsyncRelativeRetryInvalidHeaderAsync(final ServiceCallb if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteAsyncRelativeRetryInvalidHeader(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncRelativeRetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3425,7 +3426,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryInvalidHeader() throws CloudException, IOException { - Call call = service.beginDeleteAsyncRelativeRetryInvalidHeader(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); } @@ -3440,7 +3441,7 @@ public ServiceCall beginDeleteAsyncRelativeRetryInvalidHeaderAsync(final Service if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteAsyncRelativeRetryInvalidHeader(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetryInvalidHeader(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3456,7 +3457,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders.class); @@ -3471,7 +3472,7 @@ private ServiceResponseWithHeaders deleteAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncRelativeRetryInvalidJsonPolling(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncRelativeRetryInvalidJsonPolling(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders.class); } @@ -3486,7 +3487,7 @@ public ServiceCall deleteAsyncRelativeRetryInvalidJsonPollingAsync(final Service if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteAsyncRelativeRetryInvalidJsonPolling(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncRelativeRetryInvalidJsonPolling(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3509,7 +3510,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException { - Call call = service.beginDeleteAsyncRelativeRetryInvalidJsonPolling(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetryInvalidJsonPolling(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); } @@ -3524,7 +3525,7 @@ public ServiceCall beginDeleteAsyncRelativeRetryInvalidJsonPollingAsync(final Se if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteAsyncRelativeRetryInvalidJsonPolling(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRelativeRetryInvalidJsonPolling(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3540,7 +3541,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncRelativeRetryInvalidJsonPollingDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders.class); @@ -3556,7 +3557,7 @@ private ServiceResponseWithHeaders post202RetryInvalidHeader() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.post202RetryInvalidHeader(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202RetryInvalidHeaderHeaders.class); } @@ -3572,7 +3573,7 @@ public ServiceCall post202RetryInvalidHeaderAsync(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.post202RetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3597,7 +3598,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders post202RetryInvalidHeader(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.post202RetryInvalidHeader(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPost202RetryInvalidHeaderHeaders.class); } @@ -3614,7 +3615,7 @@ public ServiceCall post202RetryInvalidHeaderAsync(Product product, final Service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.post202RetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3638,7 +3639,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202RetryInvalidHeader() throws CloudException, IOException { final Product product = null; - Call call = service.beginPost202RetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202RetryInvalidHeaderDelegate(call.execute()); } @@ -3654,7 +3655,7 @@ public ServiceCall beginPost202RetryInvalidHeaderAsync(final ServiceCallback call = service.beginPost202RetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3679,7 +3680,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202RetryInvalidHeader(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPost202RetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202RetryInvalidHeaderDelegate(call.execute()); } @@ -3696,7 +3697,7 @@ public ServiceCall beginPost202RetryInvalidHeaderAsync(Product product, final Se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPost202RetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3712,7 +3713,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPost202RetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPost202RetryInvalidHeaderHeaders.class); @@ -3728,7 +3729,7 @@ private ServiceResponseWithHeaders postAsyncRelativeRetryInvalidHeader() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders.class); } @@ -3744,7 +3745,7 @@ public ServiceCall postAsyncRelativeRetryInvalidHeaderAsync(final ServiceCallbac throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.postAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3769,7 +3770,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncRelativeRetryInvalidHeader(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders.class); } @@ -3786,7 +3787,7 @@ public ServiceCall postAsyncRelativeRetryInvalidHeaderAsync(Product product, fin throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3810,7 +3811,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidHeader() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); } @@ -3826,7 +3827,7 @@ public ServiceCall beginPostAsyncRelativeRetryInvalidHeaderAsync(final ServiceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3851,7 +3852,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidHeader(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetryInvalidHeaderDelegate(call.execute()); } @@ -3868,7 +3869,7 @@ public ServiceCall beginPostAsyncRelativeRetryInvalidHeaderAsync(Product product throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3884,7 +3885,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidHeaderDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders.class); @@ -3900,7 +3901,7 @@ private ServiceResponseWithHeaders postAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders.class); } @@ -3916,7 +3917,7 @@ public ServiceCall postAsyncRelativeRetryInvalidJsonPollingAsync(final ServiceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3941,7 +3942,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncRelativeRetryInvalidJsonPolling(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders.class); } @@ -3958,7 +3959,7 @@ public ServiceCall postAsyncRelativeRetryInvalidJsonPollingAsync(Product product throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3982,7 +3983,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidJsonPolling() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); } @@ -3998,7 +3999,7 @@ public ServiceCall beginPostAsyncRelativeRetryInvalidJsonPollingAsync(final Serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4023,7 +4024,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidJsonPolling(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRelativeRetryInvalidJsonPollingDelegate(call.execute()); } @@ -4040,7 +4041,7 @@ public ServiceCall beginPostAsyncRelativeRetryInvalidJsonPollingAsync(Product pr throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4056,7 +4057,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncRelativeRetryInvalidJsonPollingDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders.class); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsCustomHeaderOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeadersImpl.java similarity index 92% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsCustomHeaderOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeadersImpl.java index d5d7fa473ed3e..e6a61df99da0e 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsCustomHeaderOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LROsCustomHeadersImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.lro; +package fixtures.lro.implementation; +import retrofit2.Retrofit; +import fixtures.lro.LROsCustomHeaders; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; @@ -33,65 +35,64 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in LROsCustomHeaderOperations. + * in LROsCustomHeaders. */ -public final class LROsCustomHeaderOperationsImpl implements LROsCustomHeaderOperations { +public final class LROsCustomHeadersImpl implements LROsCustomHeaders { /** The Retrofit service to perform REST calls. */ - private LROsCustomHeaderService service; + private LROsCustomHeadersService service; /** The service client containing this operation class. */ - private AutoRestLongRunningOperationTestService client; + private AutoRestLongRunningOperationTestServiceImpl client; /** - * Initializes an instance of LROsCustomHeaderOperations. + * Initializes an instance of LROsCustomHeadersImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public LROsCustomHeaderOperationsImpl(Retrofit retrofit, AutoRestLongRunningOperationTestService client) { - this.service = retrofit.create(LROsCustomHeaderService.class); + public LROsCustomHeadersImpl(Retrofit retrofit, AutoRestLongRunningOperationTestServiceImpl client) { + this.service = retrofit.create(LROsCustomHeadersService.class); this.client = client; } /** - * The interface defining all the services for LROsCustomHeaderOperations to be + * The interface defining all the services for LROsCustomHeaders to be * used by Retrofit to perform actually REST calls. */ - interface LROsCustomHeaderService { + interface LROsCustomHeadersService { @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/customheader/putasync/retry/succeeded") - Call putAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/customheader/putasync/retry/succeeded") - Call beginPutAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/customheader/put/201/creating/succeeded/200") - Call put201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/customheader/put/201/creating/succeeded/200") - Call beginPut201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/customheader/post/202/retry/200") - Call post202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call post202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/customheader/post/202/retry/200") - Call beginPost202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPost202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/customheader/postasync/retry/succeeded") - Call postAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/customheader/postasync/retry/succeeded") - Call beginPostAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -105,7 +106,7 @@ interface LROsCustomHeaderService { */ public ServiceResponseWithHeaders putAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPutAsyncRetrySucceededHeaders.class); } @@ -121,7 +122,7 @@ public ServiceCall putAsyncRetrySucceededAsync(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -146,7 +147,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncRetrySucceeded(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPutAsyncRetrySucceededHeaders.class); } @@ -163,7 +164,7 @@ public ServiceCall putAsyncRetrySucceededAsync(Product product, final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -187,7 +188,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRetrySucceeded() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRetrySucceededDelegate(call.execute()); } @@ -203,7 +204,7 @@ public ServiceCall beginPutAsyncRetrySucceededAsync(final ServiceCallback call = service.beginPutAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -228,7 +229,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRetrySucceeded(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRetrySucceededDelegate(call.execute()); } @@ -245,7 +246,7 @@ public ServiceCall beginPutAsyncRetrySucceededAsync(Product product, final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -261,7 +262,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsCustomHeaderPutAsyncRetrySucceededHeaders.class); @@ -277,7 +278,7 @@ private ServiceResponseWithHeaders put201CreatingSucceeded200() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -293,7 +294,7 @@ public ServiceCall put201CreatingSucceeded200Async(final ServiceCallback call = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -318,7 +319,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put201CreatingSucceeded200(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -335,7 +336,7 @@ public ServiceCall put201CreatingSucceeded200Async(Product product, final Servic throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -359,7 +360,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut201CreatingSucceeded200() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut201CreatingSucceeded200Delegate(call.execute()); } @@ -375,7 +376,7 @@ public ServiceCall beginPut201CreatingSucceeded200Async(final ServiceCallback call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -400,7 +401,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut201CreatingSucceeded200(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut201CreatingSucceeded200Delegate(call.execute()); } @@ -417,7 +418,7 @@ public ServiceCall beginPut201CreatingSucceeded200Async(Product product, final S throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -433,7 +434,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut201CreatingSucceeded200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -450,7 +451,7 @@ private ServiceResponse beginPut201CreatingSucceeded200Delegate(Respons */ public ServiceResponseWithHeaders post202Retry200() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.post202Retry200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPost202Retry200Headers.class); } @@ -466,7 +467,7 @@ public ServiceCall post202Retry200Async(final ServiceCallback serviceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.post202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -491,7 +492,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders post202Retry200(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.post202Retry200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPost202Retry200Headers.class); } @@ -508,7 +509,7 @@ public ServiceCall post202Retry200Async(Product product, final ServiceCallback call = service.post202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -532,7 +533,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202Retry200() throws CloudException, IOException { final Product product = null; - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202Retry200Delegate(call.execute()); } @@ -548,7 +549,7 @@ public ServiceCall beginPost202Retry200Async(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -573,7 +574,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202Retry200(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202Retry200Delegate(call.execute()); } @@ -590,7 +591,7 @@ public ServiceCall beginPost202Retry200Async(Product product, final ServiceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -606,7 +607,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPost202Retry200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsCustomHeaderPost202Retry200Headers.class); @@ -622,7 +623,7 @@ private ServiceResponseWithHeaders */ public ServiceResponseWithHeaders postAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPostAsyncRetrySucceededHeaders.class); } @@ -638,7 +639,7 @@ public ServiceCall postAsyncRetrySucceededAsync(final ServiceCallback serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.postAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -663,7 +664,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncRetrySucceeded(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsCustomHeaderPostAsyncRetrySucceededHeaders.class); } @@ -680,7 +681,7 @@ public ServiceCall postAsyncRetrySucceededAsync(Product product, final ServiceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -704,7 +705,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRetrySucceeded() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRetrySucceededDelegate(call.execute()); } @@ -720,7 +721,7 @@ public ServiceCall beginPostAsyncRetrySucceededAsync(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPostAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -745,7 +746,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRetrySucceeded(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRetrySucceededDelegate(call.execute()); } @@ -762,7 +763,7 @@ public ServiceCall beginPostAsyncRetrySucceededAsync(Product product, final Serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -778,7 +779,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsCustomHeaderPostAsyncRetrySucceededHeaders.class); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LROsImpl.java similarity index 92% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LROsImpl.java index 6d2e6b6124a47..8e771ea5f66ff 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/LROsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.lro; +package fixtures.lro.implementation; +import retrofit2.Retrofit; +import fixtures.lro.LROs; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; @@ -56,321 +58,320 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in LROsOperations. + * in LROs. */ -public final class LROsOperationsImpl implements LROsOperations { +public final class LROsImpl implements LROs { /** The Retrofit service to perform REST calls. */ private LROsService service; /** The service client containing this operation class. */ - private AutoRestLongRunningOperationTestService client; + private AutoRestLongRunningOperationTestServiceImpl client; /** - * Initializes an instance of LROsOperations. + * Initializes an instance of LROsImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public LROsOperationsImpl(Retrofit retrofit, AutoRestLongRunningOperationTestService client) { + public LROsImpl(Retrofit retrofit, AutoRestLongRunningOperationTestServiceImpl client) { this.service = retrofit.create(LROsService.class); this.client = client; } /** - * The interface defining all the services for LROsOperations to be + * The interface defining all the services for LROs to be * used by Retrofit to perform actually REST calls. */ interface LROsService { @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/200/succeeded") - Call put200Succeeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put200Succeeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/200/succeeded") - Call beginPut200Succeeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut200Succeeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/200/succeeded/nostate") - Call put200SucceededNoState(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put200SucceededNoState(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/200/succeeded/nostate") - Call beginPut200SucceededNoState(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut200SucceededNoState(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/202/retry/200") - Call put202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/202/retry/200") - Call beginPut202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/201/creating/succeeded/200") - Call put201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/201/creating/succeeded/200") - Call beginPut201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut201CreatingSucceeded200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/200/updating/succeeded/200") - Call put200UpdatingSucceeded204(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put200UpdatingSucceeded204(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/200/updating/succeeded/200") - Call beginPut200UpdatingSucceeded204(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut200UpdatingSucceeded204(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/201/created/failed/200") - Call put201CreatingFailed200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put201CreatingFailed200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/201/created/failed/200") - Call beginPut201CreatingFailed200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut201CreatingFailed200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/200/accepted/canceled/200") - Call put200Acceptedcanceled200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call put200Acceptedcanceled200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/200/accepted/canceled/200") - Call beginPut200Acceptedcanceled200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPut200Acceptedcanceled200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/noheader/202/200") - Call putNoHeaderInRetry(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putNoHeaderInRetry(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/put/noheader/202/200") - Call beginPutNoHeaderInRetry(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutNoHeaderInRetry(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/retry/succeeded") - Call putAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/retry/succeeded") - Call beginPutAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/noretry/succeeded") - Call putAsyncNoRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncNoRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/noretry/succeeded") - Call beginPutAsyncNoRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncNoRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/retry/failed") - Call putAsyncRetryFailed(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncRetryFailed(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/retry/failed") - Call beginPutAsyncRetryFailed(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncRetryFailed(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/noretry/canceled") - Call putAsyncNoRetrycanceled(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncNoRetrycanceled(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/noretry/canceled") - Call beginPutAsyncNoRetrycanceled(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncNoRetrycanceled(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/noheader/201/200") - Call putAsyncNoHeaderInRetry(@Body Product product, @Header("accept-language") String acceptLanguage); + Call putAsyncNoHeaderInRetry(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putasync/noheader/201/200") - Call beginPutAsyncNoHeaderInRetry(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncNoHeaderInRetry(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putnonresource/202/200") - Call putNonResource(@Body Sku sku, @Header("accept-language") String acceptLanguage); + Call putNonResource(@Body Sku sku, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putnonresource/202/200") - Call beginPutNonResource(@Body Sku sku, @Header("accept-language") String acceptLanguage); + Call beginPutNonResource(@Body Sku sku, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putnonresourceasync/202/200") - Call putAsyncNonResource(@Body Sku sku, @Header("accept-language") String acceptLanguage); + Call putAsyncNonResource(@Body Sku sku, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putnonresourceasync/202/200") - Call beginPutAsyncNonResource(@Body Sku sku, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncNonResource(@Body Sku sku, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putsubresource/202/200") - Call putSubResource(@Body SubProduct product, @Header("accept-language") String acceptLanguage); + Call putSubResource(@Body SubProduct product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putsubresource/202/200") - Call beginPutSubResource(@Body SubProduct product, @Header("accept-language") String acceptLanguage); + Call beginPutSubResource(@Body SubProduct product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putsubresourceasync/202/200") - Call putAsyncSubResource(@Body SubProduct product, @Header("accept-language") String acceptLanguage); + Call putAsyncSubResource(@Body SubProduct product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("lro/putsubresourceasync/202/200") - Call beginPutAsyncSubResource(@Body SubProduct product, @Header("accept-language") String acceptLanguage); + Call beginPutAsyncSubResource(@Body SubProduct product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/provisioning/202/accepted/200/succeeded", method = "DELETE", hasBody = true) - Call deleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage); + Call deleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/provisioning/202/accepted/200/succeeded", method = "DELETE", hasBody = true) - Call beginDeleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage); + Call beginDeleteProvisioning202Accepted200Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/provisioning/202/deleting/200/failed", method = "DELETE", hasBody = true) - Call deleteProvisioning202DeletingFailed200(@Header("accept-language") String acceptLanguage); + Call deleteProvisioning202DeletingFailed200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/provisioning/202/deleting/200/failed", method = "DELETE", hasBody = true) - Call beginDeleteProvisioning202DeletingFailed200(@Header("accept-language") String acceptLanguage); + Call beginDeleteProvisioning202DeletingFailed200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/provisioning/202/deleting/200/canceled", method = "DELETE", hasBody = true) - Call deleteProvisioning202Deletingcanceled200(@Header("accept-language") String acceptLanguage); + Call deleteProvisioning202Deletingcanceled200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/provisioning/202/deleting/200/canceled", method = "DELETE", hasBody = true) - Call beginDeleteProvisioning202Deletingcanceled200(@Header("accept-language") String acceptLanguage); + Call beginDeleteProvisioning202Deletingcanceled200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/204/succeeded", method = "DELETE", hasBody = true) - Call delete204Succeeded(@Header("accept-language") String acceptLanguage); + Call delete204Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/204/succeeded", method = "DELETE", hasBody = true) - Call beginDelete204Succeeded(@Header("accept-language") String acceptLanguage); + Call beginDelete204Succeeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/202/retry/200", method = "DELETE", hasBody = true) - Call delete202Retry200(@Header("accept-language") String acceptLanguage); + Call delete202Retry200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/202/retry/200", method = "DELETE", hasBody = true) - Call beginDelete202Retry200(@Header("accept-language") String acceptLanguage); + Call beginDelete202Retry200(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/202/noretry/204", method = "DELETE", hasBody = true) - Call delete202NoRetry204(@Header("accept-language") String acceptLanguage); + Call delete202NoRetry204(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/202/noretry/204", method = "DELETE", hasBody = true) - Call beginDelete202NoRetry204(@Header("accept-language") String acceptLanguage); + Call beginDelete202NoRetry204(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/noheader", method = "DELETE", hasBody = true) - Call deleteNoHeaderInRetry(@Header("accept-language") String acceptLanguage); + Call deleteNoHeaderInRetry(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/delete/noheader", method = "DELETE", hasBody = true) - Call beginDeleteNoHeaderInRetry(@Header("accept-language") String acceptLanguage); + Call beginDeleteNoHeaderInRetry(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/noheader/202/204", method = "DELETE", hasBody = true) - Call deleteAsyncNoHeaderInRetry(@Header("accept-language") String acceptLanguage); + Call deleteAsyncNoHeaderInRetry(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/noheader/202/204", method = "DELETE", hasBody = true) - Call beginDeleteAsyncNoHeaderInRetry(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncNoHeaderInRetry(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/retry/succeeded", method = "DELETE", hasBody = true) - Call deleteAsyncRetrySucceeded(@Header("accept-language") String acceptLanguage); + Call deleteAsyncRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/retry/succeeded", method = "DELETE", hasBody = true) - Call beginDeleteAsyncRetrySucceeded(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/noretry/succeeded", method = "DELETE", hasBody = true) - Call deleteAsyncNoRetrySucceeded(@Header("accept-language") String acceptLanguage); + Call deleteAsyncNoRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/noretry/succeeded", method = "DELETE", hasBody = true) - Call beginDeleteAsyncNoRetrySucceeded(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncNoRetrySucceeded(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/retry/failed", method = "DELETE", hasBody = true) - Call deleteAsyncRetryFailed(@Header("accept-language") String acceptLanguage); + Call deleteAsyncRetryFailed(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/retry/failed", method = "DELETE", hasBody = true) - Call beginDeleteAsyncRetryFailed(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncRetryFailed(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/retry/canceled", method = "DELETE", hasBody = true) - Call deleteAsyncRetrycanceled(@Header("accept-language") String acceptLanguage); + Call deleteAsyncRetrycanceled(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "lro/deleteasync/retry/canceled", method = "DELETE", hasBody = true) - Call beginDeleteAsyncRetrycanceled(@Header("accept-language") String acceptLanguage); + Call beginDeleteAsyncRetrycanceled(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/post/payload/200") - Call post200WithPayload(@Header("accept-language") String acceptLanguage); + Call post200WithPayload(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/post/payload/200") - Call beginPost200WithPayload(@Header("accept-language") String acceptLanguage); + Call beginPost200WithPayload(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/post/202/retry/200") - Call post202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call post202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/post/202/retry/200") - Call beginPost202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPost202Retry200(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/post/202/noretry/204") - Call post202NoRetry204(@Body Product product, @Header("accept-language") String acceptLanguage); + Call post202NoRetry204(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/post/202/noretry/204") - Call beginPost202NoRetry204(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPost202NoRetry204(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/postasync/retry/succeeded") - Call postAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/postasync/retry/succeeded") - Call beginPostAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/postasync/noretry/succeeded") - Call postAsyncNoRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncNoRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/postasync/noretry/succeeded") - Call beginPostAsyncNoRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncNoRetrySucceeded(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/postasync/retry/failed") - Call postAsyncRetryFailed(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncRetryFailed(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/postasync/retry/failed") - Call beginPostAsyncRetryFailed(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncRetryFailed(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/postasync/retry/canceled") - Call postAsyncRetrycanceled(@Body Product product, @Header("accept-language") String acceptLanguage); + Call postAsyncRetrycanceled(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @POST("lro/postasync/retry/canceled") - Call beginPostAsyncRetrycanceled(@Body Product product, @Header("accept-language") String acceptLanguage); + Call beginPostAsyncRetrycanceled(@Body Product product, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -384,7 +385,7 @@ interface LROsService { */ public ServiceResponse put200Succeeded() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put200Succeeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -400,7 +401,7 @@ public ServiceCall put200SucceededAsync(final ServiceCallback serviceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.put200Succeeded(product, this.client.getAcceptLanguage()); + Call call = service.put200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -425,7 +426,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put200Succeeded(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put200Succeeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -442,7 +443,7 @@ public ServiceCall put200SucceededAsync(Product product, final ServiceCallback

call = service.put200Succeeded(product, this.client.getAcceptLanguage()); + Call call = service.put200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -466,7 +467,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200Succeeded() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut200Succeeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200SucceededDelegate(call.execute()); } @@ -482,7 +483,7 @@ public ServiceCall beginPut200SucceededAsync(final ServiceCallback serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPut200Succeeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -507,7 +508,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200Succeeded(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut200Succeeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200SucceededDelegate(call.execute()); } @@ -524,7 +525,7 @@ public ServiceCall beginPut200SucceededAsync(Product product, final ServiceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut200Succeeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200Succeeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -540,7 +541,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut200SucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -557,7 +558,7 @@ private ServiceResponse beginPut200SucceededDelegate(Response put200SucceededNoState() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put200SucceededNoState(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -573,7 +574,7 @@ public ServiceCall put200SucceededNoStateAsync(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.put200SucceededNoState(product, this.client.getAcceptLanguage()); + Call call = service.put200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -598,7 +599,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put200SucceededNoState(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put200SucceededNoState(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -615,7 +616,7 @@ public ServiceCall put200SucceededNoStateAsync(Product product, final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.put200SucceededNoState(product, this.client.getAcceptLanguage()); + Call call = service.put200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -639,7 +640,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200SucceededNoState() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut200SucceededNoState(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200SucceededNoStateDelegate(call.execute()); } @@ -655,7 +656,7 @@ public ServiceCall beginPut200SucceededNoStateAsync(final ServiceCallback call = service.beginPut200SucceededNoState(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -680,7 +681,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200SucceededNoState(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut200SucceededNoState(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200SucceededNoStateDelegate(call.execute()); } @@ -697,7 +698,7 @@ public ServiceCall beginPut200SucceededNoStateAsync(Product product, final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut200SucceededNoState(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200SucceededNoState(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -713,7 +714,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut200SucceededNoStateDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -729,7 +730,7 @@ private ServiceResponse beginPut200SucceededNoStateDelegate(Response put202Retry200() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put202Retry200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -745,7 +746,7 @@ public ServiceCall put202Retry200Async(final ServiceCallback serviceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.put202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.put202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -770,7 +771,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put202Retry200(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put202Retry200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -787,7 +788,7 @@ public ServiceCall put202Retry200Async(Product product, final ServiceCallback call = service.put202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.put202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -811,7 +812,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut202Retry200() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut202Retry200Delegate(call.execute()); } @@ -827,7 +828,7 @@ public ServiceCall beginPut202Retry200Async(final ServiceCallback servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPut202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -852,7 +853,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut202Retry200(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut202Retry200Delegate(call.execute()); } @@ -869,7 +870,7 @@ public ServiceCall beginPut202Retry200Async(Product product, final ServiceCallba throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -885,7 +886,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut202Retry200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -901,7 +902,7 @@ private ServiceResponse beginPut202Retry200Delegate(Response put201CreatingSucceeded200() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -917,7 +918,7 @@ public ServiceCall put201CreatingSucceeded200Async(final ServiceCallback call = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -942,7 +943,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put201CreatingSucceeded200(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -959,7 +960,7 @@ public ServiceCall put201CreatingSucceeded200Async(Product product, final Servic throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.put201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -983,7 +984,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut201CreatingSucceeded200() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut201CreatingSucceeded200Delegate(call.execute()); } @@ -999,7 +1000,7 @@ public ServiceCall beginPut201CreatingSucceeded200Async(final ServiceCallback call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1024,7 +1025,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut201CreatingSucceeded200(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut201CreatingSucceeded200Delegate(call.execute()); } @@ -1041,7 +1042,7 @@ public ServiceCall beginPut201CreatingSucceeded200Async(Product product, final S throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut201CreatingSucceeded200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1057,7 +1058,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut201CreatingSucceeded200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -1074,7 +1075,7 @@ private ServiceResponse beginPut201CreatingSucceeded200Delegate(Respons */ public ServiceResponse put200UpdatingSucceeded204() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put200UpdatingSucceeded204(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -1090,7 +1091,7 @@ public ServiceCall put200UpdatingSucceeded204Async(final ServiceCallback call = service.put200UpdatingSucceeded204(product, this.client.getAcceptLanguage()); + Call call = service.put200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1115,7 +1116,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put200UpdatingSucceeded204(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put200UpdatingSucceeded204(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -1132,7 +1133,7 @@ public ServiceCall put200UpdatingSucceeded204Async(Product product, final Servic throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.put200UpdatingSucceeded204(product, this.client.getAcceptLanguage()); + Call call = service.put200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1156,7 +1157,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200UpdatingSucceeded204() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut200UpdatingSucceeded204(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200UpdatingSucceeded204Delegate(call.execute()); } @@ -1172,7 +1173,7 @@ public ServiceCall beginPut200UpdatingSucceeded204Async(final ServiceCallback call = service.beginPut200UpdatingSucceeded204(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1197,7 +1198,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200UpdatingSucceeded204(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut200UpdatingSucceeded204(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200UpdatingSucceeded204Delegate(call.execute()); } @@ -1214,7 +1215,7 @@ public ServiceCall beginPut200UpdatingSucceeded204Async(Product product, final S throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut200UpdatingSucceeded204(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200UpdatingSucceeded204(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1230,7 +1231,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut200UpdatingSucceeded204Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1246,7 +1247,7 @@ private ServiceResponse beginPut200UpdatingSucceeded204Delegate(Respons */ public ServiceResponse put201CreatingFailed200() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put201CreatingFailed200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -1262,7 +1263,7 @@ public ServiceCall put201CreatingFailed200Async(final ServiceCallback s throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.put201CreatingFailed200(product, this.client.getAcceptLanguage()); + Call call = service.put201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1287,7 +1288,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put201CreatingFailed200(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put201CreatingFailed200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -1304,7 +1305,7 @@ public ServiceCall put201CreatingFailed200Async(Product product, final ServiceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.put201CreatingFailed200(product, this.client.getAcceptLanguage()); + Call call = service.put201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1328,7 +1329,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut201CreatingFailed200() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut201CreatingFailed200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut201CreatingFailed200Delegate(call.execute()); } @@ -1344,7 +1345,7 @@ public ServiceCall beginPut201CreatingFailed200Async(final ServiceCallback call = service.beginPut201CreatingFailed200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1369,7 +1370,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut201CreatingFailed200(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut201CreatingFailed200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut201CreatingFailed200Delegate(call.execute()); } @@ -1386,7 +1387,7 @@ public ServiceCall beginPut201CreatingFailed200Async(Product product, final Serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut201CreatingFailed200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut201CreatingFailed200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1402,7 +1403,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut201CreatingFailed200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -1419,7 +1420,7 @@ private ServiceResponse beginPut201CreatingFailed200Delegate(Response put200Acceptedcanceled200() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.put200Acceptedcanceled200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -1435,7 +1436,7 @@ public ServiceCall put200Acceptedcanceled200Async(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.put200Acceptedcanceled200(product, this.client.getAcceptLanguage()); + Call call = service.put200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1460,7 +1461,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse put200Acceptedcanceled200(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.put200Acceptedcanceled200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.put200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -1477,7 +1478,7 @@ public ServiceCall put200Acceptedcanceled200Async(Product product, final Service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.put200Acceptedcanceled200(product, this.client.getAcceptLanguage()); + Call call = service.put200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1501,7 +1502,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200Acceptedcanceled200() throws CloudException, IOException { final Product product = null; - Call call = service.beginPut200Acceptedcanceled200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200Acceptedcanceled200Delegate(call.execute()); } @@ -1517,7 +1518,7 @@ public ServiceCall beginPut200Acceptedcanceled200Async(final ServiceCallback call = service.beginPut200Acceptedcanceled200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1542,7 +1543,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPut200Acceptedcanceled200(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPut200Acceptedcanceled200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPut200Acceptedcanceled200Delegate(call.execute()); } @@ -1559,7 +1560,7 @@ public ServiceCall beginPut200Acceptedcanceled200Async(Product product, final Se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPut200Acceptedcanceled200(product, this.client.getAcceptLanguage()); + Call call = service.beginPut200Acceptedcanceled200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1575,7 +1576,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPut200Acceptedcanceled200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1591,7 +1592,7 @@ private ServiceResponse beginPut200Acceptedcanceled200Delegate(Response */ public ServiceResponseWithHeaders putNoHeaderInRetry() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putNoHeaderInRetry(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutNoHeaderInRetryHeaders.class); } @@ -1607,7 +1608,7 @@ public ServiceCall putNoHeaderInRetryAsync(final ServiceCallback servic throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.putNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1632,7 +1633,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putNoHeaderInRetry(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putNoHeaderInRetry(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutNoHeaderInRetryHeaders.class); } @@ -1649,7 +1650,7 @@ public ServiceCall putNoHeaderInRetryAsync(Product product, final ServiceCallbac throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.putNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1673,7 +1674,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutNoHeaderInRetry() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNoHeaderInRetryDelegate(call.execute()); } @@ -1689,7 +1690,7 @@ public ServiceCall beginPutNoHeaderInRetryAsync(final ServiceCallback s throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1714,7 +1715,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutNoHeaderInRetry(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNoHeaderInRetryDelegate(call.execute()); } @@ -1731,7 +1732,7 @@ public ServiceCall beginPutNoHeaderInRetryAsync(Product product, final ServiceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.beginPutNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1747,7 +1748,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutNoHeaderInRetryDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPutNoHeaderInRetryHeaders.class); @@ -1763,7 +1764,7 @@ private ServiceResponseWithHeaders begin */ public ServiceResponseWithHeaders putAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncRetrySucceededHeaders.class); } @@ -1779,7 +1780,7 @@ public ServiceCall putAsyncRetrySucceededAsync(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1804,7 +1805,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncRetrySucceeded(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncRetrySucceededHeaders.class); } @@ -1821,7 +1822,7 @@ public ServiceCall putAsyncRetrySucceededAsync(Product product, final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1845,7 +1846,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRetrySucceeded() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRetrySucceededDelegate(call.execute()); } @@ -1861,7 +1862,7 @@ public ServiceCall beginPutAsyncRetrySucceededAsync(final ServiceCallback call = service.beginPutAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1886,7 +1887,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRetrySucceeded(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRetrySucceededDelegate(call.execute()); } @@ -1903,7 +1904,7 @@ public ServiceCall beginPutAsyncRetrySucceededAsync(Product product, final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -1919,7 +1920,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPutAsyncRetrySucceededHeaders.class); @@ -1935,7 +1936,7 @@ private ServiceResponseWithHeaders b */ public ServiceResponseWithHeaders putAsyncNoRetrySucceeded() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoRetrySucceededHeaders.class); } @@ -1951,7 +1952,7 @@ public ServiceCall putAsyncNoRetrySucceededAsync(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -1976,7 +1977,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncNoRetrySucceeded(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoRetrySucceededHeaders.class); } @@ -1993,7 +1994,7 @@ public ServiceCall putAsyncNoRetrySucceededAsync(Product product, final ServiceC throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2017,7 +2018,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncNoRetrySucceeded() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncNoRetrySucceededDelegate(call.execute()); } @@ -2033,7 +2034,7 @@ public ServiceCall beginPutAsyncNoRetrySucceededAsync(final ServiceCallback call = service.beginPutAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2058,7 +2059,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncNoRetrySucceeded(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncNoRetrySucceededDelegate(call.execute()); } @@ -2075,7 +2076,7 @@ public ServiceCall beginPutAsyncNoRetrySucceededAsync(Product product, final Ser throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2091,7 +2092,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncNoRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPutAsyncNoRetrySucceededHeaders.class); @@ -2107,7 +2108,7 @@ private ServiceResponseWithHeaders */ public ServiceResponseWithHeaders putAsyncRetryFailed() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncRetryFailed(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncRetryFailedHeaders.class); } @@ -2123,7 +2124,7 @@ public ServiceCall putAsyncRetryFailedAsync(final ServiceCallback servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2148,7 +2149,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncRetryFailed(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncRetryFailed(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncRetryFailedHeaders.class); } @@ -2165,7 +2166,7 @@ public ServiceCall putAsyncRetryFailedAsync(Product product, final ServiceCallba throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2189,7 +2190,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRetryFailed() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRetryFailedDelegate(call.execute()); } @@ -2205,7 +2206,7 @@ public ServiceCall beginPutAsyncRetryFailedAsync(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPutAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2230,7 +2231,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncRetryFailed(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncRetryFailedDelegate(call.execute()); } @@ -2247,7 +2248,7 @@ public ServiceCall beginPutAsyncRetryFailedAsync(Product product, final ServiceC throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2263,7 +2264,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncRetryFailedDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPutAsyncRetryFailedHeaders.class); @@ -2279,7 +2280,7 @@ private ServiceResponseWithHeaders begi */ public ServiceResponseWithHeaders putAsyncNoRetrycanceled() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncNoRetrycanceled(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoRetrycanceledHeaders.class); } @@ -2295,7 +2296,7 @@ public ServiceCall putAsyncNoRetrycanceledAsync(final ServiceCallback s throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncNoRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2320,7 +2321,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncNoRetrycanceled(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncNoRetrycanceled(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoRetrycanceledHeaders.class); } @@ -2337,7 +2338,7 @@ public ServiceCall putAsyncNoRetrycanceledAsync(Product product, final ServiceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncNoRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2361,7 +2362,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncNoRetrycanceled() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncNoRetrycanceledDelegate(call.execute()); } @@ -2377,7 +2378,7 @@ public ServiceCall beginPutAsyncNoRetrycanceledAsync(final ServiceCallback call = service.beginPutAsyncNoRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2402,7 +2403,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncNoRetrycanceled(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncNoRetrycanceledDelegate(call.execute()); } @@ -2419,7 +2420,7 @@ public ServiceCall beginPutAsyncNoRetrycanceledAsync(Product product, final Serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2435,7 +2436,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncNoRetrycanceledDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPutAsyncNoRetrycanceledHeaders.class); @@ -2451,7 +2452,7 @@ private ServiceResponseWithHeaders */ public ServiceResponseWithHeaders putAsyncNoHeaderInRetry() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.putAsyncNoHeaderInRetry(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoHeaderInRetryHeaders.class); } @@ -2467,7 +2468,7 @@ public ServiceCall putAsyncNoHeaderInRetryAsync(final ServiceCallback s throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.putAsyncNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2492,7 +2493,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders putAsyncNoHeaderInRetry(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncNoHeaderInRetry(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResultWithHeaders(result, new TypeToken() { }.getType(), LROsPutAsyncNoHeaderInRetryHeaders.class); } @@ -2509,7 +2510,7 @@ public ServiceCall putAsyncNoHeaderInRetryAsync(Product product, final ServiceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2533,7 +2534,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncNoHeaderInRetry() throws CloudException, IOException { final Product product = null; - Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncNoHeaderInRetryDelegate(call.execute()); } @@ -2549,7 +2550,7 @@ public ServiceCall beginPutAsyncNoHeaderInRetryAsync(final ServiceCallback call = service.beginPutAsyncNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2574,7 +2575,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPutAsyncNoHeaderInRetry(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncNoHeaderInRetryDelegate(call.execute()); } @@ -2591,7 +2592,7 @@ public ServiceCall beginPutAsyncNoHeaderInRetryAsync(Product product, final Serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2607,7 +2608,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPutAsyncNoHeaderInRetryDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPutAsyncNoHeaderInRetryHeaders.class); @@ -2623,7 +2624,7 @@ private ServiceResponseWithHeaders */ public ServiceResponse putNonResource() throws CloudException, IOException, InterruptedException { final Sku sku = null; - Response result = service.putNonResource(sku, this.client.getAcceptLanguage()).execute(); + Response result = service.putNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -2639,7 +2640,7 @@ public ServiceCall putNonResourceAsync(final ServiceCallback serviceCallbac throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Sku sku = null; - Call call = service.putNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.putNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2664,7 +2665,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putNonResource(Sku sku) throws CloudException, IOException, InterruptedException { Validator.validate(sku); - Response result = service.putNonResource(sku, this.client.getAcceptLanguage()).execute(); + Response result = service.putNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -2681,7 +2682,7 @@ public ServiceCall putNonResourceAsync(Sku sku, final ServiceCallback servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(sku, serviceCallback); - Call call = service.putNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.putNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2705,7 +2706,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutNonResource() throws CloudException, IOException { final Sku sku = null; - Call call = service.beginPutNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.beginPutNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNonResourceDelegate(call.execute()); } @@ -2721,7 +2722,7 @@ public ServiceCall beginPutNonResourceAsync(final ServiceCallback serviceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Sku sku = null; - Call call = service.beginPutNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.beginPutNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2746,7 +2747,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutNonResource(Sku sku) throws CloudException, IOException { Validator.validate(sku); - Call call = service.beginPutNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.beginPutNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); return beginPutNonResourceDelegate(call.execute()); } @@ -2763,7 +2764,7 @@ public ServiceCall beginPutNonResourceAsync(Sku sku, final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(sku, serviceCallback); - Call call = service.beginPutNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.beginPutNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2779,7 +2780,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPutNonResourceDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -2795,7 +2796,7 @@ private ServiceResponse beginPutNonResourceDelegate(Response */ public ServiceResponse putAsyncNonResource() throws CloudException, IOException, InterruptedException { final Sku sku = null; - Response result = service.putAsyncNonResource(sku, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -2811,7 +2812,7 @@ public ServiceCall putAsyncNonResourceAsync(final ServiceCallback serviceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Sku sku = null; - Call call = service.putAsyncNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.putAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2836,7 +2837,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putAsyncNonResource(Sku sku) throws CloudException, IOException, InterruptedException { Validator.validate(sku); - Response result = service.putAsyncNonResource(sku, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -2853,7 +2854,7 @@ public ServiceCall putAsyncNonResourceAsync(Sku sku, final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(sku, serviceCallback); - Call call = service.putAsyncNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.putAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -2877,7 +2878,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutAsyncNonResource() throws CloudException, IOException { final Sku sku = null; - Call call = service.beginPutAsyncNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncNonResourceDelegate(call.execute()); } @@ -2893,7 +2894,7 @@ public ServiceCall beginPutAsyncNonResourceAsync(final ServiceCallback serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Sku sku = null; - Call call = service.beginPutAsyncNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2918,7 +2919,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutAsyncNonResource(Sku sku) throws CloudException, IOException { Validator.validate(sku); - Call call = service.beginPutAsyncNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncNonResourceDelegate(call.execute()); } @@ -2935,7 +2936,7 @@ public ServiceCall beginPutAsyncNonResourceAsync(Sku sku, final ServiceCallback< throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(sku, serviceCallback); - Call call = service.beginPutAsyncNonResource(sku, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncNonResource(sku, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -2951,7 +2952,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPutAsyncNonResourceDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -2967,7 +2968,7 @@ private ServiceResponse beginPutAsyncNonResourceDelegate(Response putSubResource() throws CloudException, IOException, InterruptedException { final SubProduct product = null; - Response result = service.putSubResource(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putSubResource(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -2983,7 +2984,7 @@ public ServiceCall putSubResourceAsync(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final SubProduct product = null; - Call call = service.putSubResource(product, this.client.getAcceptLanguage()); + Call call = service.putSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3008,7 +3009,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putSubResource(SubProduct product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putSubResource(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putSubResource(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -3025,7 +3026,7 @@ public ServiceCall putSubResourceAsync(SubProduct product, final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putSubResource(product, this.client.getAcceptLanguage()); + Call call = service.putSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3049,7 +3050,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutSubResource() throws CloudException, IOException { final SubProduct product = null; - Call call = service.beginPutSubResource(product, this.client.getAcceptLanguage()); + Call call = service.beginPutSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutSubResourceDelegate(call.execute()); } @@ -3065,7 +3066,7 @@ public ServiceCall beginPutSubResourceAsync(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final SubProduct product = null; - Call call = service.beginPutSubResource(product, this.client.getAcceptLanguage()); + Call call = service.beginPutSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3090,7 +3091,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutSubResource(SubProduct product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutSubResource(product, this.client.getAcceptLanguage()); + Call call = service.beginPutSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutSubResourceDelegate(call.execute()); } @@ -3107,7 +3108,7 @@ public ServiceCall beginPutSubResourceAsync(SubProduct product, final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutSubResource(product, this.client.getAcceptLanguage()); + Call call = service.beginPutSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3123,7 +3124,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPutSubResourceDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -3139,7 +3140,7 @@ private ServiceResponse beginPutSubResourceDelegate(Response putAsyncSubResource() throws CloudException, IOException, InterruptedException { final SubProduct product = null; - Response result = service.putAsyncSubResource(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -3155,7 +3156,7 @@ public ServiceCall putAsyncSubResourceAsync(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final SubProduct product = null; - Call call = service.putAsyncSubResource(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3180,7 +3181,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse putAsyncSubResource(SubProduct product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.putAsyncSubResource(product, this.client.getAcceptLanguage()).execute(); + Response result = service.putAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); } @@ -3197,7 +3198,7 @@ public ServiceCall putAsyncSubResourceAsync(SubProduct product, final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.putAsyncSubResource(product, this.client.getAcceptLanguage()); + Call call = service.putAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3221,7 +3222,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutAsyncSubResource() throws CloudException, IOException { final SubProduct product = null; - Call call = service.beginPutAsyncSubResource(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncSubResourceDelegate(call.execute()); } @@ -3237,7 +3238,7 @@ public ServiceCall beginPutAsyncSubResourceAsync(final ServiceCallback call = service.beginPutAsyncSubResource(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3262,7 +3263,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse beginPutAsyncSubResource(SubProduct product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPutAsyncSubResource(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPutAsyncSubResourceDelegate(call.execute()); } @@ -3279,7 +3280,7 @@ public ServiceCall beginPutAsyncSubResourceAsync(SubProduct product, final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPutAsyncSubResource(product, this.client.getAcceptLanguage()); + Call call = service.beginPutAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3295,7 +3296,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPutAsyncSubResourceDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -3310,7 +3311,7 @@ private ServiceResponse beginPutAsyncSubResourceDelegate(Response deleteProvisioning202Accepted200Succeeded() throws CloudException, IOException, InterruptedException { - Response result = service.deleteProvisioning202Accepted200Succeeded(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteProvisioning202Accepted200SucceededHeaders.class); } @@ -3325,7 +3326,7 @@ public ServiceCall deleteProvisioning202Accepted200SucceededAsync(final ServiceC if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteProvisioning202Accepted200Succeeded(this.client.getAcceptLanguage()); + Call call = service.deleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3348,7 +3349,7 @@ public void onResponse(Call call, Response response) * @return the Product object wrapped in {@link ServiceResponseWithHeaders} if successful. */ public ServiceResponseWithHeaders beginDeleteProvisioning202Accepted200Succeeded() throws CloudException, IOException { - Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteProvisioning202Accepted200SucceededDelegate(call.execute()); } @@ -3363,7 +3364,7 @@ public ServiceCall beginDeleteProvisioning202Accepted200SucceededAsync(final Ser if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteProvisioning202Accepted200Succeeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3379,7 +3380,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteProvisioning202Accepted200SucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -3395,7 +3396,7 @@ private ServiceResponseWithHeaders deleteProvisioning202DeletingFailed200() throws CloudException, IOException, InterruptedException { - Response result = service.deleteProvisioning202DeletingFailed200(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteProvisioning202DeletingFailed200(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteProvisioning202DeletingFailed200Headers.class); } @@ -3410,7 +3411,7 @@ public ServiceCall deleteProvisioning202DeletingFailed200Async(final ServiceCall if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteProvisioning202DeletingFailed200(this.client.getAcceptLanguage()); + Call call = service.deleteProvisioning202DeletingFailed200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3433,7 +3434,7 @@ public void onResponse(Call call, Response response) * @return the Product object wrapped in {@link ServiceResponseWithHeaders} if successful. */ public ServiceResponseWithHeaders beginDeleteProvisioning202DeletingFailed200() throws CloudException, IOException { - Call call = service.beginDeleteProvisioning202DeletingFailed200(this.client.getAcceptLanguage()); + Call call = service.beginDeleteProvisioning202DeletingFailed200(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteProvisioning202DeletingFailed200Delegate(call.execute()); } @@ -3448,7 +3449,7 @@ public ServiceCall beginDeleteProvisioning202DeletingFailed200Async(final Servic if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteProvisioning202DeletingFailed200(this.client.getAcceptLanguage()); + Call call = service.beginDeleteProvisioning202DeletingFailed200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3464,7 +3465,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteProvisioning202DeletingFailed200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -3480,7 +3481,7 @@ private ServiceResponseWithHeaders deleteProvisioning202Deletingcanceled200() throws CloudException, IOException, InterruptedException { - Response result = service.deleteProvisioning202Deletingcanceled200(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteProvisioning202Deletingcanceled200(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteProvisioning202Deletingcanceled200Headers.class); } @@ -3495,7 +3496,7 @@ public ServiceCall deleteProvisioning202Deletingcanceled200Async(final ServiceCa if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteProvisioning202Deletingcanceled200(this.client.getAcceptLanguage()); + Call call = service.deleteProvisioning202Deletingcanceled200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3518,7 +3519,7 @@ public void onResponse(Call call, Response response) * @return the Product object wrapped in {@link ServiceResponseWithHeaders} if successful. */ public ServiceResponseWithHeaders beginDeleteProvisioning202Deletingcanceled200() throws CloudException, IOException { - Call call = service.beginDeleteProvisioning202Deletingcanceled200(this.client.getAcceptLanguage()); + Call call = service.beginDeleteProvisioning202Deletingcanceled200(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteProvisioning202Deletingcanceled200Delegate(call.execute()); } @@ -3533,7 +3534,7 @@ public ServiceCall beginDeleteProvisioning202Deletingcanceled200Async(final Serv if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteProvisioning202Deletingcanceled200(this.client.getAcceptLanguage()); + Call call = service.beginDeleteProvisioning202Deletingcanceled200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3549,7 +3550,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteProvisioning202Deletingcanceled200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -3565,7 +3566,7 @@ private ServiceResponseWithHeaders delete204Succeeded() throws CloudException, IOException, InterruptedException { - Response result = service.delete204Succeeded(this.client.getAcceptLanguage()).execute(); + Response result = service.delete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() { }.getType()); } @@ -3580,7 +3581,7 @@ public ServiceCall delete204SucceededAsync(final ServiceCallback serviceCa if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.delete204Succeeded(this.client.getAcceptLanguage()); + Call call = service.delete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3603,7 +3604,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse beginDelete204Succeeded() throws CloudException, IOException { - Call call = service.beginDelete204Succeeded(this.client.getAcceptLanguage()); + Call call = service.beginDelete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); return beginDelete204SucceededDelegate(call.execute()); } @@ -3618,7 +3619,7 @@ public ServiceCall beginDelete204SucceededAsync(final ServiceCallback serv if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDelete204Succeeded(this.client.getAcceptLanguage()); + Call call = service.beginDelete204Succeeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3634,7 +3635,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginDelete204SucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); @@ -3649,7 +3650,7 @@ private ServiceResponse beginDelete204SucceededDelegate(Response delete202Retry200() throws CloudException, IOException, InterruptedException { - Response result = service.delete202Retry200(this.client.getAcceptLanguage()).execute(); + Response result = service.delete202Retry200(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDelete202Retry200Headers.class); } @@ -3664,7 +3665,7 @@ public ServiceCall delete202Retry200Async(final ServiceCallback service if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.delete202Retry200(this.client.getAcceptLanguage()); + Call call = service.delete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3687,7 +3688,7 @@ public void onResponse(Call call, Response response) * @return the Product object wrapped in {@link ServiceResponseWithHeaders} if successful. */ public ServiceResponseWithHeaders beginDelete202Retry200() throws CloudException, IOException { - Call call = service.beginDelete202Retry200(this.client.getAcceptLanguage()); + Call call = service.beginDelete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); return beginDelete202Retry200Delegate(call.execute()); } @@ -3702,7 +3703,7 @@ public ServiceCall beginDelete202Retry200Async(final ServiceCallback se if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDelete202Retry200(this.client.getAcceptLanguage()); + Call call = service.beginDelete202Retry200(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3718,7 +3719,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDelete202Retry200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -3734,7 +3735,7 @@ private ServiceResponseWithHeaders beginD * @return the Product object wrapped in ServiceResponseWithHeaders if successful. */ public ServiceResponseWithHeaders delete202NoRetry204() throws CloudException, IOException, InterruptedException { - Response result = service.delete202NoRetry204(this.client.getAcceptLanguage()).execute(); + Response result = service.delete202NoRetry204(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDelete202NoRetry204Headers.class); } @@ -3749,7 +3750,7 @@ public ServiceCall delete202NoRetry204Async(final ServiceCallback servi if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.delete202NoRetry204(this.client.getAcceptLanguage()); + Call call = service.delete202NoRetry204(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3772,7 +3773,7 @@ public void onResponse(Call call, Response response) * @return the Product object wrapped in {@link ServiceResponseWithHeaders} if successful. */ public ServiceResponseWithHeaders beginDelete202NoRetry204() throws CloudException, IOException { - Call call = service.beginDelete202NoRetry204(this.client.getAcceptLanguage()); + Call call = service.beginDelete202NoRetry204(this.client.acceptLanguage(), this.client.userAgent()); return beginDelete202NoRetry204Delegate(call.execute()); } @@ -3787,7 +3788,7 @@ public ServiceCall beginDelete202NoRetry204Async(final ServiceCallback if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDelete202NoRetry204(this.client.getAcceptLanguage()); + Call call = service.beginDelete202NoRetry204(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3803,7 +3804,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDelete202NoRetry204Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -3819,7 +3820,7 @@ private ServiceResponseWithHeaders begi * @return the ServiceResponseWithHeaders object if successful. */ public ServiceResponseWithHeaders deleteNoHeaderInRetry() throws CloudException, IOException, InterruptedException { - Response result = service.deleteNoHeaderInRetry(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteNoHeaderInRetryHeaders.class); } @@ -3834,7 +3835,7 @@ public ServiceCall deleteNoHeaderInRetryAsync(final ServiceCallback servic if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteNoHeaderInRetry(this.client.getAcceptLanguage()); + Call call = service.deleteNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3857,7 +3858,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteNoHeaderInRetry() throws CloudException, IOException { - Call call = service.beginDeleteNoHeaderInRetry(this.client.getAcceptLanguage()); + Call call = service.beginDeleteNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteNoHeaderInRetryDelegate(call.execute()); } @@ -3872,7 +3873,7 @@ public ServiceCall beginDeleteNoHeaderInRetryAsync(final ServiceCallback s if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteNoHeaderInRetry(this.client.getAcceptLanguage()); + Call call = service.beginDeleteNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3888,7 +3889,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteNoHeaderInRetryDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -3904,7 +3905,7 @@ private ServiceResponseWithHeaders begin * @return the ServiceResponseWithHeaders object if successful. */ public ServiceResponseWithHeaders deleteAsyncNoHeaderInRetry() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncNoHeaderInRetry(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncNoHeaderInRetryHeaders.class); } @@ -3919,7 +3920,7 @@ public ServiceCall deleteAsyncNoHeaderInRetryAsync(final ServiceCallback s if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteAsyncNoHeaderInRetry(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -3942,7 +3943,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncNoHeaderInRetry() throws CloudException, IOException { - Call call = service.beginDeleteAsyncNoHeaderInRetry(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncNoHeaderInRetryDelegate(call.execute()); } @@ -3957,7 +3958,7 @@ public ServiceCall beginDeleteAsyncNoHeaderInRetryAsync(final ServiceCallback call = service.beginDeleteAsyncNoHeaderInRetry(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncNoHeaderInRetry(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -3973,7 +3974,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncNoHeaderInRetryDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -3989,7 +3990,7 @@ private ServiceResponseWithHeaders * @return the ServiceResponseWithHeaders object if successful. */ public ServiceResponseWithHeaders deleteAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncRetrySucceeded(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncRetrySucceededHeaders.class); } @@ -4004,7 +4005,7 @@ public ServiceCall deleteAsyncRetrySucceededAsync(final ServiceCallback se if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteAsyncRetrySucceeded(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4027,7 +4028,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncRetrySucceeded() throws CloudException, IOException { - Call call = service.beginDeleteAsyncRetrySucceeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncRetrySucceededDelegate(call.execute()); } @@ -4042,7 +4043,7 @@ public ServiceCall beginDeleteAsyncRetrySucceededAsync(final ServiceCallback call = service.beginDeleteAsyncRetrySucceeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4058,7 +4059,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsDeleteAsyncRetrySucceededHeaders.class); @@ -4073,7 +4074,7 @@ private ServiceResponseWithHeaders b * @return the ServiceResponseWithHeaders object if successful. */ public ServiceResponseWithHeaders deleteAsyncNoRetrySucceeded() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncNoRetrySucceeded(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncNoRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncNoRetrySucceededHeaders.class); } @@ -4088,7 +4089,7 @@ public ServiceCall deleteAsyncNoRetrySucceededAsync(final ServiceCallback if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteAsyncNoRetrySucceeded(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncNoRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4111,7 +4112,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncNoRetrySucceeded() throws CloudException, IOException { - Call call = service.beginDeleteAsyncNoRetrySucceeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncNoRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncNoRetrySucceededDelegate(call.execute()); } @@ -4126,7 +4127,7 @@ public ServiceCall beginDeleteAsyncNoRetrySucceededAsync(final ServiceCallback call = service.beginDeleteAsyncNoRetrySucceeded(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncNoRetrySucceeded(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4142,7 +4143,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncNoRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsDeleteAsyncNoRetrySucceededHeaders.class); @@ -4157,7 +4158,7 @@ private ServiceResponseWithHeaders * @return the ServiceResponseWithHeaders object if successful. */ public ServiceResponseWithHeaders deleteAsyncRetryFailed() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncRetryFailed(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncRetryFailed(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncRetryFailedHeaders.class); } @@ -4172,7 +4173,7 @@ public ServiceCall deleteAsyncRetryFailedAsync(final ServiceCallback servi if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteAsyncRetryFailed(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncRetryFailed(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4195,7 +4196,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncRetryFailed() throws CloudException, IOException { - Call call = service.beginDeleteAsyncRetryFailed(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRetryFailed(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncRetryFailedDelegate(call.execute()); } @@ -4210,7 +4211,7 @@ public ServiceCall beginDeleteAsyncRetryFailedAsync(final ServiceCallback if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginDeleteAsyncRetryFailed(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRetryFailed(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4226,7 +4227,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncRetryFailedDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsDeleteAsyncRetryFailedHeaders.class); @@ -4241,7 +4242,7 @@ private ServiceResponseWithHeaders begi * @return the ServiceResponseWithHeaders object if successful. */ public ServiceResponseWithHeaders deleteAsyncRetrycanceled() throws CloudException, IOException, InterruptedException { - Response result = service.deleteAsyncRetrycanceled(this.client.getAcceptLanguage()).execute(); + Response result = service.deleteAsyncRetrycanceled(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsDeleteAsyncRetrycanceledHeaders.class); } @@ -4256,7 +4257,7 @@ public ServiceCall deleteAsyncRetrycanceledAsync(final ServiceCallback ser if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.deleteAsyncRetrycanceled(this.client.getAcceptLanguage()); + Call call = service.deleteAsyncRetrycanceled(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4279,7 +4280,7 @@ public void onResponse(Call call, Response response) * @return the {@link ServiceResponseWithHeaders} object if successful. */ public ServiceResponseWithHeaders beginDeleteAsyncRetrycanceled() throws CloudException, IOException { - Call call = service.beginDeleteAsyncRetrycanceled(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRetrycanceled(this.client.acceptLanguage(), this.client.userAgent()); return beginDeleteAsyncRetrycanceledDelegate(call.execute()); } @@ -4294,7 +4295,7 @@ public ServiceCall beginDeleteAsyncRetrycanceledAsync(final ServiceCallback call = service.beginDeleteAsyncRetrycanceled(this.client.getAcceptLanguage()); + Call call = service.beginDeleteAsyncRetrycanceled(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4310,7 +4311,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginDeleteAsyncRetrycanceledDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsDeleteAsyncRetrycanceledHeaders.class); @@ -4325,7 +4326,7 @@ private ServiceResponseWithHeaders be * @return the Sku object wrapped in ServiceResponse if successful. */ public ServiceResponse post200WithPayload() throws CloudException, IOException, InterruptedException { - Response result = service.post200WithPayload(this.client.getAcceptLanguage()).execute(); + Response result = service.post200WithPayload(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() { }.getType()); } @@ -4340,7 +4341,7 @@ public ServiceCall post200WithPayloadAsync(final ServiceCallback serviceCal if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.post200WithPayload(this.client.getAcceptLanguage()); + Call call = service.post200WithPayload(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4363,7 +4364,7 @@ public void onResponse(Call call, Response response) * @return the Sku object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse beginPost200WithPayload() throws CloudException, IOException { - Call call = service.beginPost200WithPayload(this.client.getAcceptLanguage()); + Call call = service.beginPost200WithPayload(this.client.acceptLanguage(), this.client.userAgent()); return beginPost200WithPayloadDelegate(call.execute()); } @@ -4378,7 +4379,7 @@ public ServiceCall beginPost200WithPayloadAsync(final ServiceCallback servi if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.beginPost200WithPayload(this.client.getAcceptLanguage()); + Call call = service.beginPost200WithPayload(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4394,7 +4395,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse beginPost200WithPayloadDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -4411,7 +4412,7 @@ private ServiceResponse beginPost200WithPayloadDelegate(Response post202Retry200() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.post202Retry200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPost202Retry200Headers.class); } @@ -4427,7 +4428,7 @@ public ServiceCall post202Retry200Async(final ServiceCallback serviceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.post202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4452,7 +4453,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders post202Retry200(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.post202Retry200(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPost202Retry200Headers.class); } @@ -4469,7 +4470,7 @@ public ServiceCall post202Retry200Async(Product product, final ServiceCallback call = service.post202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4493,7 +4494,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202Retry200() throws CloudException, IOException { final Product product = null; - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202Retry200Delegate(call.execute()); } @@ -4509,7 +4510,7 @@ public ServiceCall beginPost202Retry200Async(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4534,7 +4535,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202Retry200(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202Retry200Delegate(call.execute()); } @@ -4551,7 +4552,7 @@ public ServiceCall beginPost202Retry200Async(Product product, final ServiceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202Retry200(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4567,7 +4568,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPost202Retry200Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPost202Retry200Headers.class); @@ -4583,7 +4584,7 @@ private ServiceResponseWithHeaders beginPost20 */ public ServiceResponseWithHeaders post202NoRetry204() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.post202NoRetry204(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPost202NoRetry204Headers.class); } @@ -4599,7 +4600,7 @@ public ServiceCall post202NoRetry204Async(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.post202NoRetry204(product, this.client.getAcceptLanguage()); + Call call = service.post202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4624,7 +4625,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders post202NoRetry204(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.post202NoRetry204(product, this.client.getAcceptLanguage()).execute(); + Response result = service.post202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPost202NoRetry204Headers.class); } @@ -4641,7 +4642,7 @@ public ServiceCall post202NoRetry204Async(Product product, final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.post202NoRetry204(product, this.client.getAcceptLanguage()); + Call call = service.post202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4665,7 +4666,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202NoRetry204() throws CloudException, IOException { final Product product = null; - Call call = service.beginPost202NoRetry204(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202NoRetry204Delegate(call.execute()); } @@ -4681,7 +4682,7 @@ public ServiceCall beginPost202NoRetry204Async(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPost202NoRetry204(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4706,7 +4707,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPost202NoRetry204(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPost202NoRetry204(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPost202NoRetry204Delegate(call.execute()); } @@ -4723,7 +4724,7 @@ public ServiceCall beginPost202NoRetry204Async(Product product, final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPost202NoRetry204(product, this.client.getAcceptLanguage()); + Call call = service.beginPost202NoRetry204(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4739,7 +4740,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPost202NoRetry204Delegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPost202NoRetry204Headers.class); @@ -4755,7 +4756,7 @@ private ServiceResponseWithHeaders beginP */ public ServiceResponseWithHeaders postAsyncRetrySucceeded() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetrySucceededHeaders.class); } @@ -4771,7 +4772,7 @@ public ServiceCall postAsyncRetrySucceededAsync(final ServiceCallback s throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.postAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4796,7 +4797,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncRetrySucceeded(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetrySucceededHeaders.class); } @@ -4813,7 +4814,7 @@ public ServiceCall postAsyncRetrySucceededAsync(Product product, final ServiceCa throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4837,7 +4838,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRetrySucceeded() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRetrySucceededDelegate(call.execute()); } @@ -4853,7 +4854,7 @@ public ServiceCall beginPostAsyncRetrySucceededAsync(final ServiceCallback call = service.beginPostAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4878,7 +4879,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRetrySucceeded(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRetrySucceededDelegate(call.execute()); } @@ -4895,7 +4896,7 @@ public ServiceCall beginPostAsyncRetrySucceededAsync(Product product, final Serv throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -4911,7 +4912,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -4928,7 +4929,7 @@ private ServiceResponseWithHeaders */ public ServiceResponseWithHeaders postAsyncNoRetrySucceeded() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncNoRetrySucceededHeaders.class); } @@ -4944,7 +4945,7 @@ public ServiceCall postAsyncNoRetrySucceededAsync(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.postAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -4969,7 +4970,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncNoRetrySucceeded(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncNoRetrySucceededHeaders.class); } @@ -4986,7 +4987,7 @@ public ServiceCall postAsyncNoRetrySucceededAsync(Product product, final Service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -5010,7 +5011,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncNoRetrySucceeded() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncNoRetrySucceededDelegate(call.execute()); } @@ -5026,7 +5027,7 @@ public ServiceCall beginPostAsyncNoRetrySucceededAsync(final ServiceCallback call = service.beginPostAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -5051,7 +5052,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncNoRetrySucceeded(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncNoRetrySucceededDelegate(call.execute()); } @@ -5068,7 +5069,7 @@ public ServiceCall beginPostAsyncNoRetrySucceededAsync(Product product, final Se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -5084,7 +5085,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncNoRetrySucceededDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -5101,7 +5102,7 @@ private ServiceResponseWithHeaders postAsyncRetryFailed() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncRetryFailed(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetryFailedHeaders.class); } @@ -5117,7 +5118,7 @@ public ServiceCall postAsyncRetryFailedAsync(final ServiceCallback service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.postAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -5142,7 +5143,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncRetryFailed(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncRetryFailed(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetryFailedHeaders.class); } @@ -5159,7 +5160,7 @@ public ServiceCall postAsyncRetryFailedAsync(Product product, final ServiceCallb throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -5183,7 +5184,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRetryFailed() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRetryFailedDelegate(call.execute()); } @@ -5199,7 +5200,7 @@ public ServiceCall beginPostAsyncRetryFailedAsync(final ServiceCallback se throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPostAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -5224,7 +5225,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRetryFailed(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRetryFailedDelegate(call.execute()); } @@ -5241,7 +5242,7 @@ public ServiceCall beginPostAsyncRetryFailedAsync(Product product, final Service throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncRetryFailed(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetryFailed(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -5257,7 +5258,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncRetryFailedDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPostAsyncRetryFailedHeaders.class); @@ -5273,7 +5274,7 @@ private ServiceResponseWithHeaders beginP */ public ServiceResponseWithHeaders postAsyncRetrycanceled() throws CloudException, IOException, InterruptedException { final Product product = null; - Response result = service.postAsyncRetrycanceled(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetrycanceledHeaders.class); } @@ -5289,7 +5290,7 @@ public ServiceCall postAsyncRetrycanceledAsync(final ServiceCallback servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.postAsyncRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -5314,7 +5315,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders postAsyncRetrycanceled(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); - Response result = service.postAsyncRetrycanceled(product, this.client.getAcceptLanguage()).execute(); + Response result = service.postAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken() { }.getType(), LROsPostAsyncRetrycanceledHeaders.class); } @@ -5331,7 +5332,7 @@ public ServiceCall postAsyncRetrycanceledAsync(Product product, final ServiceCal throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.postAsyncRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.postAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new Callback() { @Override @@ -5355,7 +5356,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRetrycanceled() throws CloudException, IOException { final Product product = null; - Call call = service.beginPostAsyncRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRetrycanceledDelegate(call.execute()); } @@ -5371,7 +5372,7 @@ public ServiceCall beginPostAsyncRetrycanceledAsync(final ServiceCallback throw new IllegalArgumentException("ServiceCallback is required for async calls."); } final Product product = null; - Call call = service.beginPostAsyncRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -5396,7 +5397,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponseWithHeaders beginPostAsyncRetrycanceled(Product product) throws CloudException, IOException { Validator.validate(product); - Call call = service.beginPostAsyncRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); return beginPostAsyncRetrycanceledDelegate(call.execute()); } @@ -5413,7 +5414,7 @@ public ServiceCall beginPostAsyncRetrycanceledAsync(Product product, final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(product, serviceCallback); - Call call = service.beginPostAsyncRetrycanceled(product, this.client.getAcceptLanguage()); + Call call = service.beginPostAsyncRetrycanceled(product, this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -5429,7 +5430,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders beginPostAsyncRetrycanceledDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .buildWithHeaders(response, LROsPostAsyncRetrycanceledHeaders.class); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/package-info.java new file mode 100644 index 0000000000000..8f0b083f871d1 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestLongRunningOperationTestService. + * Long-running Operation for AutoRest. + */ +package fixtures.lro.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDelete202Retry200Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDelete202Retry200Headers.java index fbe012727f649..3c7d371828004 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDelete202Retry200Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDelete202Retry200Headers.java @@ -35,7 +35,7 @@ public class LRORetrysDelete202Retry200Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LRORetrysDelete202Retry200Headers object itself. */ - public void setLocation(String location) { + public LRORetrysDelete202Retry200Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LRORetrysDelete202Retry200Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LRORetrysDelete202Retry200Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDeleteAsyncRelativeRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDeleteAsyncRelativeRetrySucceededHeaders.java index ad3b87ed3c7d1..e94ae9dd44abb 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDeleteAsyncRelativeRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDeleteAsyncRelativeRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LRORetrysDeleteAsyncRelativeRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LRORetrysDeleteAsyncRelativeRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LRORetrysDeleteAsyncRelativeRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LRORetrysDeleteAsyncRelativeRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LRORetrysDeleteAsyncRelativeRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LRORetrysDeleteAsyncRelativeRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LRORetrysDeleteAsyncRelativeRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDeleteProvisioning202Accepted200SucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDeleteProvisioning202Accepted200SucceededHeaders.java index fb7129e31b18d..418b001d1e844 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDeleteProvisioning202Accepted200SucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysDeleteProvisioning202Accepted200SucceededHeaders.java @@ -35,7 +35,7 @@ public class LRORetrysDeleteProvisioning202Accepted200SucceededHeaders { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LRORetrysDeleteProvisioning202Accepted200SucceededHeaders object itself. */ - public void setLocation(String location) { + public LRORetrysDeleteProvisioning202Accepted200SucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LRORetrysDeleteProvisioning202Accepted200SucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LRORetrysDeleteProvisioning202Accepted200SucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPost202Retry200Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPost202Retry200Headers.java index cff994aa2f6f1..3ab66a681f8c0 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPost202Retry200Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPost202Retry200Headers.java @@ -35,7 +35,7 @@ public class LRORetrysPost202Retry200Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LRORetrysPost202Retry200Headers object itself. */ - public void setLocation(String location) { + public LRORetrysPost202Retry200Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LRORetrysPost202Retry200Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LRORetrysPost202Retry200Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPostAsyncRelativeRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPostAsyncRelativeRetrySucceededHeaders.java index bfdf6943d5736..fbd30f949b4dd 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPostAsyncRelativeRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPostAsyncRelativeRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LRORetrysPostAsyncRelativeRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LRORetrysPostAsyncRelativeRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LRORetrysPostAsyncRelativeRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LRORetrysPostAsyncRelativeRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LRORetrysPostAsyncRelativeRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LRORetrysPostAsyncRelativeRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LRORetrysPostAsyncRelativeRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPutAsyncRelativeRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPutAsyncRelativeRetrySucceededHeaders.java index f6170a35eb2b8..0a09c66602eb7 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPutAsyncRelativeRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LRORetrysPutAsyncRelativeRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LRORetrysPutAsyncRelativeRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LRORetrysPutAsyncRelativeRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LRORetrysPutAsyncRelativeRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LRORetrysPutAsyncRelativeRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LRORetrysPutAsyncRelativeRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LRORetrysPutAsyncRelativeRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LRORetrysPutAsyncRelativeRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDelete202NonRetry400Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDelete202NonRetry400Headers.java index 516e107ae3489..36bc4a52a11dc 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDelete202NonRetry400Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDelete202NonRetry400Headers.java @@ -35,7 +35,7 @@ public class LROSADsDelete202NonRetry400Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsDelete202NonRetry400Headers object itself. */ - public void setLocation(String location) { + public LROSADsDelete202NonRetry400Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsDelete202NonRetry400Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsDelete202NonRetry400Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDelete202RetryInvalidHeaderHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDelete202RetryInvalidHeaderHeaders.java index 0f62ec9e68fd5..f3d063dcb2e75 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDelete202RetryInvalidHeaderHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDelete202RetryInvalidHeaderHeaders.java @@ -34,7 +34,7 @@ public class LROSADsDelete202RetryInvalidHeaderHeaders { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -42,9 +42,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsDelete202RetryInvalidHeaderHeaders object itself. */ - public void setLocation(String location) { + public LROSADsDelete202RetryInvalidHeaderHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -52,7 +54,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -60,9 +62,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsDelete202RetryInvalidHeaderHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsDelete202RetryInvalidHeaderHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetry400Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetry400Headers.java index 8f79c69002477..e731b70bfe1c0 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetry400Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetry400Headers.java @@ -42,7 +42,7 @@ public class LROSADsDeleteAsyncRelativeRetry400Headers { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsDeleteAsyncRelativeRetry400Headers object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsDeleteAsyncRelativeRetry400Headers withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsDeleteAsyncRelativeRetry400Headers object itself. */ - public void setLocation(String location) { + public LROSADsDeleteAsyncRelativeRetry400Headers withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteAsyncRelativeRetry400Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsDeleteAsyncRelativeRetry400Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders.java index eb4d2cf34ae06..bcb7e3561f91f 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders.java @@ -40,7 +40,7 @@ public class LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -48,9 +48,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -58,7 +60,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -66,9 +68,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders object itself. */ - public void setLocation(String location) { + public LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -76,7 +80,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -84,9 +88,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsDeleteAsyncRelativeRetryInvalidHeaderHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders.java index 1f3c1513f3d06..54c3802ce83a9 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders.java @@ -42,7 +42,7 @@ public class LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders object itself. */ - public void setLocation(String location) { + public LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsDeleteAsyncRelativeRetryInvalidJsonPollingHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryNoStatusHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryNoStatusHeaders.java index 283e487025b4a..819de51de2cfa 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryNoStatusHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteAsyncRelativeRetryNoStatusHeaders.java @@ -42,7 +42,7 @@ public class LROSADsDeleteAsyncRelativeRetryNoStatusHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsDeleteAsyncRelativeRetryNoStatusHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsDeleteAsyncRelativeRetryNoStatusHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsDeleteAsyncRelativeRetryNoStatusHeaders object itself. */ - public void setLocation(String location) { + public LROSADsDeleteAsyncRelativeRetryNoStatusHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteAsyncRelativeRetryNoStatusHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsDeleteAsyncRelativeRetryNoStatusHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteNonRetry400Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteNonRetry400Headers.java index b9257577fbabf..ccb27c5e67e80 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteNonRetry400Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsDeleteNonRetry400Headers.java @@ -35,7 +35,7 @@ public class LROSADsDeleteNonRetry400Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsDeleteNonRetry400Headers object itself. */ - public void setLocation(String location) { + public LROSADsDeleteNonRetry400Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsDeleteNonRetry400Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsDeleteNonRetry400Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202NoLocationHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202NoLocationHeaders.java index 244af1089634e..e879a4615b5e4 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202NoLocationHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202NoLocationHeaders.java @@ -34,7 +34,7 @@ public class LROSADsPost202NoLocationHeaders { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -42,9 +42,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPost202NoLocationHeaders object itself. */ - public void setLocation(String location) { + public LROSADsPost202NoLocationHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -52,7 +54,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -60,9 +62,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPost202NoLocationHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPost202NoLocationHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202NonRetry400Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202NonRetry400Headers.java index c11b8c4fd47bd..b4aa84c010432 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202NonRetry400Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202NonRetry400Headers.java @@ -35,7 +35,7 @@ public class LROSADsPost202NonRetry400Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPost202NonRetry400Headers object itself. */ - public void setLocation(String location) { + public LROSADsPost202NonRetry400Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPost202NonRetry400Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPost202NonRetry400Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202RetryInvalidHeaderHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202RetryInvalidHeaderHeaders.java index 7f0b77a5fa893..79ff95cb2e321 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202RetryInvalidHeaderHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPost202RetryInvalidHeaderHeaders.java @@ -34,7 +34,7 @@ public class LROSADsPost202RetryInvalidHeaderHeaders { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -42,9 +42,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPost202RetryInvalidHeaderHeaders object itself. */ - public void setLocation(String location) { + public LROSADsPost202RetryInvalidHeaderHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -52,7 +54,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -60,9 +62,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPost202RetryInvalidHeaderHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPost202RetryInvalidHeaderHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetry400Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetry400Headers.java index b869a9079d6d2..d2be9bba76d5e 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetry400Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetry400Headers.java @@ -42,7 +42,7 @@ public class LROSADsPostAsyncRelativeRetry400Headers { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPostAsyncRelativeRetry400Headers object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsPostAsyncRelativeRetry400Headers withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPostAsyncRelativeRetry400Headers object itself. */ - public void setLocation(String location) { + public LROSADsPostAsyncRelativeRetry400Headers withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPostAsyncRelativeRetry400Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPostAsyncRelativeRetry400Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders.java index 530b31a91d850..936d3791b0232 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders.java @@ -40,7 +40,7 @@ public class LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -48,9 +48,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -58,7 +60,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -66,9 +68,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders object itself. */ - public void setLocation(String location) { + public LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -76,7 +80,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -84,9 +88,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPostAsyncRelativeRetryInvalidHeaderHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders.java index fa098dbd9d0f8..b40ab763e19f2 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders.java @@ -42,7 +42,7 @@ public class LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders object itself. */ - public void setLocation(String location) { + public LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryNoPayloadHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryNoPayloadHeaders.java index f808d1e11b6dd..c2295f65a8c42 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryNoPayloadHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostAsyncRelativeRetryNoPayloadHeaders.java @@ -42,7 +42,7 @@ public class LROSADsPostAsyncRelativeRetryNoPayloadHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPostAsyncRelativeRetryNoPayloadHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsPostAsyncRelativeRetryNoPayloadHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPostAsyncRelativeRetryNoPayloadHeaders object itself. */ - public void setLocation(String location) { + public LROSADsPostAsyncRelativeRetryNoPayloadHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPostAsyncRelativeRetryNoPayloadHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPostAsyncRelativeRetryNoPayloadHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostNonRetry400Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostNonRetry400Headers.java index 31b521094e949..be98f46cd2bff 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostNonRetry400Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPostNonRetry400Headers.java @@ -35,7 +35,7 @@ public class LROSADsPostNonRetry400Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPostNonRetry400Headers object itself. */ - public void setLocation(String location) { + public LROSADsPostNonRetry400Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPostNonRetry400Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPostNonRetry400Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetry400Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetry400Headers.java index e9127c5871bd6..9a26a8a484a75 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetry400Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetry400Headers.java @@ -42,7 +42,7 @@ public class LROSADsPutAsyncRelativeRetry400Headers { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetry400Headers object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsPutAsyncRelativeRetry400Headers withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetry400Headers object itself. */ - public void setLocation(String location) { + public LROSADsPutAsyncRelativeRetry400Headers withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetry400Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPutAsyncRelativeRetry400Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders.java index 677eebf8988a3..70ede9e6fb9b1 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders.java @@ -42,7 +42,7 @@ public class LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders object itself. */ - public void setLocation(String location) { + public LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders.java index 177101fa3df73..a7f2a942268df 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders.java @@ -42,7 +42,7 @@ public class LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders object itself. */ - public void setLocation(String location) { + public LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryNoStatusHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryNoStatusHeaders.java index 4b38f26668bd4..c2f7f6ae35dc2 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryNoStatusHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryNoStatusHeaders.java @@ -42,7 +42,7 @@ public class LROSADsPutAsyncRelativeRetryNoStatusHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsPutAsyncRelativeRetryNoStatusHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusHeaders object itself. */ - public void setLocation(String location) { + public LROSADsPutAsyncRelativeRetryNoStatusHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPutAsyncRelativeRetryNoStatusHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders.java index 842b4e99f06bb..2bba977204619 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders.java @@ -42,7 +42,7 @@ public class LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders object itself. */ - public void setLocation(String location) { + public LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROSADsPutAsyncRelativeRetryNoStatusPayloadHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPost202Retry200Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPost202Retry200Headers.java index 88e72fe819b83..986cdb7bd5b09 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPost202Retry200Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPost202Retry200Headers.java @@ -35,7 +35,7 @@ public class LROsCustomHeaderPost202Retry200Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsCustomHeaderPost202Retry200Headers object itself. */ - public void setLocation(String location) { + public LROsCustomHeaderPost202Retry200Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsCustomHeaderPost202Retry200Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsCustomHeaderPost202Retry200Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPostAsyncRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPostAsyncRetrySucceededHeaders.java index 88a65fd3ca4a1..d99e03a53e3b6 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPostAsyncRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPostAsyncRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LROsCustomHeaderPostAsyncRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsCustomHeaderPostAsyncRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsCustomHeaderPostAsyncRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsCustomHeaderPostAsyncRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LROsCustomHeaderPostAsyncRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsCustomHeaderPostAsyncRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsCustomHeaderPostAsyncRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPutAsyncRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPutAsyncRetrySucceededHeaders.java index 95817141f0fe2..665f64b746cc8 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPutAsyncRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsCustomHeaderPutAsyncRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LROsCustomHeaderPutAsyncRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsCustomHeaderPutAsyncRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsCustomHeaderPutAsyncRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsCustomHeaderPutAsyncRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LROsCustomHeaderPutAsyncRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsCustomHeaderPutAsyncRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsCustomHeaderPutAsyncRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDelete202NoRetry204Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDelete202NoRetry204Headers.java index 09fefefac22e7..89424b94eb757 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDelete202NoRetry204Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDelete202NoRetry204Headers.java @@ -35,7 +35,7 @@ public class LROsDelete202NoRetry204Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDelete202NoRetry204Headers object itself. */ - public void setLocation(String location) { + public LROsDelete202NoRetry204Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsDelete202NoRetry204Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsDelete202NoRetry204Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDelete202Retry200Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDelete202Retry200Headers.java index 63da1ff3fbafa..7b2d86e2bc5c0 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDelete202Retry200Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDelete202Retry200Headers.java @@ -35,7 +35,7 @@ public class LROsDelete202Retry200Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDelete202Retry200Headers object itself. */ - public void setLocation(String location) { + public LROsDelete202Retry200Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsDelete202Retry200Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsDelete202Retry200Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncNoHeaderInRetryHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncNoHeaderInRetryHeaders.java index b8307f2e3f1df..a135261c3b6fb 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncNoHeaderInRetryHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncNoHeaderInRetryHeaders.java @@ -28,7 +28,7 @@ public class LROsDeleteAsyncNoHeaderInRetryHeaders { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -36,9 +36,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDeleteAsyncNoHeaderInRetryHeaders object itself. */ - public void setLocation(String location) { + public LROsDeleteAsyncNoHeaderInRetryHeaders withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncNoRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncNoRetrySucceededHeaders.java index b8238579669c7..1aff4b9d5e74d 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncNoRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncNoRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LROsDeleteAsyncNoRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsDeleteAsyncNoRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsDeleteAsyncNoRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDeleteAsyncNoRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LROsDeleteAsyncNoRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsDeleteAsyncNoRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsDeleteAsyncNoRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetryFailedHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetryFailedHeaders.java index a798f3ab6b745..b2bdd9b800e05 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetryFailedHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetryFailedHeaders.java @@ -42,7 +42,7 @@ public class LROsDeleteAsyncRetryFailedHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsDeleteAsyncRetryFailedHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsDeleteAsyncRetryFailedHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDeleteAsyncRetryFailedHeaders object itself. */ - public void setLocation(String location) { + public LROsDeleteAsyncRetryFailedHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsDeleteAsyncRetryFailedHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsDeleteAsyncRetryFailedHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetrySucceededHeaders.java index 3d2873884ef04..bf74e5f1e31b4 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LROsDeleteAsyncRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsDeleteAsyncRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsDeleteAsyncRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDeleteAsyncRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LROsDeleteAsyncRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsDeleteAsyncRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsDeleteAsyncRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetrycanceledHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetrycanceledHeaders.java index 6c436384e56d9..bd68732898922 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetrycanceledHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteAsyncRetrycanceledHeaders.java @@ -42,7 +42,7 @@ public class LROsDeleteAsyncRetrycanceledHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsDeleteAsyncRetrycanceledHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsDeleteAsyncRetrycanceledHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDeleteAsyncRetrycanceledHeaders object itself. */ - public void setLocation(String location) { + public LROsDeleteAsyncRetrycanceledHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsDeleteAsyncRetrycanceledHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsDeleteAsyncRetrycanceledHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteNoHeaderInRetryHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteNoHeaderInRetryHeaders.java index 26dbc9080ec09..6e91a79cad4d2 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteNoHeaderInRetryHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteNoHeaderInRetryHeaders.java @@ -28,7 +28,7 @@ public class LROsDeleteNoHeaderInRetryHeaders { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -36,9 +36,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDeleteNoHeaderInRetryHeaders object itself. */ - public void setLocation(String location) { + public LROsDeleteNoHeaderInRetryHeaders withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202Accepted200SucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202Accepted200SucceededHeaders.java index faeef4aa9d036..f72291acb0e7c 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202Accepted200SucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202Accepted200SucceededHeaders.java @@ -35,7 +35,7 @@ public class LROsDeleteProvisioning202Accepted200SucceededHeaders { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDeleteProvisioning202Accepted200SucceededHeaders object itself. */ - public void setLocation(String location) { + public LROsDeleteProvisioning202Accepted200SucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsDeleteProvisioning202Accepted200SucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsDeleteProvisioning202Accepted200SucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202DeletingFailed200Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202DeletingFailed200Headers.java index 451de87110662..bac22b1dce938 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202DeletingFailed200Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202DeletingFailed200Headers.java @@ -35,7 +35,7 @@ public class LROsDeleteProvisioning202DeletingFailed200Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDeleteProvisioning202DeletingFailed200Headers object itself. */ - public void setLocation(String location) { + public LROsDeleteProvisioning202DeletingFailed200Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsDeleteProvisioning202DeletingFailed200Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsDeleteProvisioning202DeletingFailed200Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202Deletingcanceled200Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202Deletingcanceled200Headers.java index ef9c474910987..97abe3169c7ce 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202Deletingcanceled200Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsDeleteProvisioning202Deletingcanceled200Headers.java @@ -35,7 +35,7 @@ public class LROsDeleteProvisioning202Deletingcanceled200Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsDeleteProvisioning202Deletingcanceled200Headers object itself. */ - public void setLocation(String location) { + public LROsDeleteProvisioning202Deletingcanceled200Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsDeleteProvisioning202Deletingcanceled200Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsDeleteProvisioning202Deletingcanceled200Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPost202NoRetry204Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPost202NoRetry204Headers.java index cc6cc0d422bb3..a9279588f0f1c 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPost202NoRetry204Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPost202NoRetry204Headers.java @@ -35,7 +35,7 @@ public class LROsPost202NoRetry204Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPost202NoRetry204Headers object itself. */ - public void setLocation(String location) { + public LROsPost202NoRetry204Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsPost202NoRetry204Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsPost202NoRetry204Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPost202Retry200Headers.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPost202Retry200Headers.java index 1c02f7f73b876..a7084d73735b9 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPost202Retry200Headers.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPost202Retry200Headers.java @@ -35,7 +35,7 @@ public class LROsPost202Retry200Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -43,9 +43,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPost202Retry200Headers object itself. */ - public void setLocation(String location) { + public LROsPost202Retry200Headers withLocation(String location) { this.location = location; + return this; } /** @@ -53,7 +55,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -61,9 +63,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsPost202Retry200Headers object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsPost202Retry200Headers withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncNoRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncNoRetrySucceededHeaders.java index 0d19217e213fc..3e68af1796336 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncNoRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncNoRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LROsPostAsyncNoRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPostAsyncNoRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsPostAsyncNoRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPostAsyncNoRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LROsPostAsyncNoRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsPostAsyncNoRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsPostAsyncNoRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetryFailedHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetryFailedHeaders.java index 3c79cebfe14f4..2abb9f7de3960 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetryFailedHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetryFailedHeaders.java @@ -42,7 +42,7 @@ public class LROsPostAsyncRetryFailedHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPostAsyncRetryFailedHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsPostAsyncRetryFailedHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPostAsyncRetryFailedHeaders object itself. */ - public void setLocation(String location) { + public LROsPostAsyncRetryFailedHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsPostAsyncRetryFailedHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsPostAsyncRetryFailedHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetrySucceededHeaders.java index 52560e880e74d..0b98246e9ed02 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LROsPostAsyncRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPostAsyncRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsPostAsyncRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPostAsyncRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LROsPostAsyncRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsPostAsyncRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsPostAsyncRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetrycanceledHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetrycanceledHeaders.java index 75f2a81c5b95b..6f9980b611536 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetrycanceledHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPostAsyncRetrycanceledHeaders.java @@ -42,7 +42,7 @@ public class LROsPostAsyncRetrycanceledHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPostAsyncRetrycanceledHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsPostAsyncRetrycanceledHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPostAsyncRetrycanceledHeaders object itself. */ - public void setLocation(String location) { + public LROsPostAsyncRetrycanceledHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsPostAsyncRetrycanceledHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsPostAsyncRetrycanceledHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoHeaderInRetryHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoHeaderInRetryHeaders.java index d4c53d4ba837f..4ebca3fca1638 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoHeaderInRetryHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoHeaderInRetryHeaders.java @@ -27,7 +27,7 @@ public class LROsPutAsyncNoHeaderInRetryHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -35,9 +35,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncNoHeaderInRetryHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsPutAsyncNoHeaderInRetryHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoRetrySucceededHeaders.java index 8efed82bed237..7521606c303c8 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoRetrySucceededHeaders.java @@ -35,7 +35,7 @@ public class LROsPutAsyncNoRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -43,9 +43,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncNoRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsPutAsyncNoRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -53,7 +55,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -61,9 +63,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPutAsyncNoRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LROsPutAsyncNoRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoRetrycanceledHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoRetrycanceledHeaders.java index a5cda13fff69a..9c8b2f6d39183 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoRetrycanceledHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncNoRetrycanceledHeaders.java @@ -35,7 +35,7 @@ public class LROsPutAsyncNoRetrycanceledHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -43,9 +43,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncNoRetrycanceledHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsPutAsyncNoRetrycanceledHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -53,7 +55,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -61,9 +63,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPutAsyncNoRetrycanceledHeaders object itself. */ - public void setLocation(String location) { + public LROsPutAsyncNoRetrycanceledHeaders withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncRetryFailedHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncRetryFailedHeaders.java index 8ea0f4d0e6183..296acac3b64d0 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncRetryFailedHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncRetryFailedHeaders.java @@ -42,7 +42,7 @@ public class LROsPutAsyncRetryFailedHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncRetryFailedHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsPutAsyncRetryFailedHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPutAsyncRetryFailedHeaders object itself. */ - public void setLocation(String location) { + public LROsPutAsyncRetryFailedHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsPutAsyncRetryFailedHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsPutAsyncRetryFailedHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncRetrySucceededHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncRetrySucceededHeaders.java index b594d1b85c874..c46927462e3d6 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncRetrySucceededHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutAsyncRetrySucceededHeaders.java @@ -42,7 +42,7 @@ public class LROsPutAsyncRetrySucceededHeaders { * * @return the azureAsyncOperation value */ - public String getAzureAsyncOperation() { + public String azureAsyncOperation() { return this.azureAsyncOperation; } @@ -50,9 +50,11 @@ public String getAzureAsyncOperation() { * Set the azureAsyncOperation value. * * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LROsPutAsyncRetrySucceededHeaders object itself. */ - public void setAzureAsyncOperation(String azureAsyncOperation) { + public LROsPutAsyncRetrySucceededHeaders withAzureAsyncOperation(String azureAsyncOperation) { this.azureAsyncOperation = azureAsyncOperation; + return this; } /** @@ -60,7 +62,7 @@ public void setAzureAsyncOperation(String azureAsyncOperation) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -68,9 +70,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPutAsyncRetrySucceededHeaders object itself. */ - public void setLocation(String location) { + public LROsPutAsyncRetrySucceededHeaders withLocation(String location) { this.location = location; + return this; } /** @@ -78,7 +82,7 @@ public void setLocation(String location) { * * @return the retryAfter value */ - public Integer getRetryAfter() { + public Integer retryAfter() { return this.retryAfter; } @@ -86,9 +90,11 @@ public Integer getRetryAfter() { * Set the retryAfter value. * * @param retryAfter the retryAfter value to set + * @return the LROsPutAsyncRetrySucceededHeaders object itself. */ - public void setRetryAfter(Integer retryAfter) { + public LROsPutAsyncRetrySucceededHeaders withRetryAfter(Integer retryAfter) { this.retryAfter = retryAfter; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutNoHeaderInRetryHeaders.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutNoHeaderInRetryHeaders.java index 5198a56e1d3be..1a50a5919ee55 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutNoHeaderInRetryHeaders.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/LROsPutNoHeaderInRetryHeaders.java @@ -26,7 +26,7 @@ public class LROsPutNoHeaderInRetryHeaders { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -34,9 +34,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the LROsPutNoHeaderInRetryHeaders object itself. */ - public void setLocation(String location) { + public LROsPutNoHeaderInRetryHeaders withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/OperationResult.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/OperationResult.java index 88cc75b805e86..683cac8ace4f9 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/OperationResult.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/OperationResult.java @@ -32,7 +32,7 @@ public class OperationResult { * * @return the status value */ - public String getStatus() { + public String status() { return this.status; } @@ -40,9 +40,11 @@ public String getStatus() { * Set the status value. * * @param status the status value to set + * @return the OperationResult object itself. */ - public void setStatus(String status) { + public OperationResult withStatus(String status) { this.status = status; + return this; } /** @@ -50,7 +52,7 @@ public void setStatus(String status) { * * @return the error value */ - public OperationResultError getError() { + public OperationResultError error() { return this.error; } @@ -58,9 +60,11 @@ public OperationResultError getError() { * Set the error value. * * @param error the error value to set + * @return the OperationResult object itself. */ - public void setError(OperationResultError error) { + public OperationResult withError(OperationResultError error) { this.error = error; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/OperationResultError.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/OperationResultError.java index 82e0b5d97f0e3..bdf6bd20defca 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/OperationResultError.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/OperationResultError.java @@ -30,7 +30,7 @@ public class OperationResultError { * * @return the code value */ - public Integer getCode() { + public Integer code() { return this.code; } @@ -38,9 +38,11 @@ public Integer getCode() { * Set the code value. * * @param code the code value to set + * @return the OperationResultError object itself. */ - public void setCode(Integer code) { + public OperationResultError withCode(Integer code) { this.code = code; + return this; } /** @@ -48,7 +50,7 @@ public void setCode(Integer code) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the OperationResultError object itself. */ - public void setMessage(String message) { + public OperationResultError withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/Product.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/Product.java index 13f364d5678ae..3d9afb514bdd7 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/Product.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/Product.java @@ -38,7 +38,7 @@ public class Product extends Resource { * * @return the provisioningState value */ - public String getProvisioningState() { + public String provisioningState() { return this.provisioningState; } @@ -46,9 +46,11 @@ public String getProvisioningState() { * Set the provisioningState value. * * @param provisioningState the provisioningState value to set + * @return the Product object itself. */ - public void setProvisioningState(String provisioningState) { + public Product withProvisioningState(String provisioningState) { this.provisioningState = provisioningState; + return this; } /** @@ -56,7 +58,7 @@ public void setProvisioningState(String provisioningState) { * * @return the provisioningStateValues value */ - public String getProvisioningStateValues() { + public String provisioningStateValues() { return this.provisioningStateValues; } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/Sku.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/Sku.java index 26832247edf15..717c766b71ca6 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/Sku.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/Sku.java @@ -30,7 +30,7 @@ public class Sku { * * @return the name value */ - public String getName() { + public String name() { return this.name; } @@ -38,9 +38,11 @@ public String getName() { * Set the name value. * * @param name the name value to set + * @return the Sku object itself. */ - public void setName(String name) { + public Sku withName(String name) { this.name = name; + return this; } /** @@ -48,7 +50,7 @@ public void setName(String name) { * * @return the id value */ - public String getId() { + public String id() { return this.id; } @@ -56,9 +58,11 @@ public String getId() { * Set the id value. * * @param id the id value to set + * @return the Sku object itself. */ - public void setId(String id) { + public Sku withId(String id) { this.id = id; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/SubProduct.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/SubProduct.java index fbd4bd6d52da0..3e9fbdc383943 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/SubProduct.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/SubProduct.java @@ -38,7 +38,7 @@ public class SubProduct extends SubResource { * * @return the provisioningState value */ - public String getProvisioningState() { + public String provisioningState() { return this.provisioningState; } @@ -46,9 +46,11 @@ public String getProvisioningState() { * Set the provisioningState value. * * @param provisioningState the provisioningState value to set + * @return the SubProduct object itself. */ - public void setProvisioningState(String provisioningState) { + public SubProduct withProvisioningState(String provisioningState) { this.provisioningState = provisioningState; + return this; } /** @@ -56,7 +58,7 @@ public void setProvisioningState(String provisioningState) { * * @return the provisioningStateValues value */ - public String getProvisioningStateValues() { + public String provisioningStateValues() { return this.provisioningStateValues; } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/package-info.java index 732029d0c4ec3..9ae664df14dac 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestLongRunningOperationTestService. + * This package contains the models classes for AutoRestLongRunningOperationTestService. * Long-running Operation for AutoRest. */ package fixtures.lro.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/AutoRestPagingTestService.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/AutoRestPagingTestService.java index 39f0fb4722738..37b3cc7b74765 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/AutoRestPagingTestService.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/AutoRestPagingTestService.java @@ -11,44 +11,18 @@ package fixtures.paging; import com.microsoft.azure.AzureClient; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; +import com.microsoft.azure.RestClient; /** * The interface for AutoRestPagingTestService class. */ public interface AutoRestPagingTestService { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -57,58 +31,61 @@ public interface AutoRestPagingTestService { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + AutoRestPagingTestService withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + AutoRestPagingTestService withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + AutoRestPagingTestService withGenerateClientRequestId(boolean generateClientRequestId); /** - * Gets the PagingOperations object to access its operations. - * @return the PagingOperations object. + * Gets the Pagings object to access its operations. + * @return the Pagings object. */ - PagingOperations getPagingOperations(); + Pagings pagings(); } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/PagingOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/Pagings.java similarity index 99% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/PagingOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/Pagings.java index 297900251adf6..3a40984e93974 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/PagingOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/Pagings.java @@ -26,9 +26,9 @@ /** * An instance of this class provides access to all the operations defined - * in PagingOperations. + * in Pagings. */ -public interface PagingOperations { +public interface Pagings { /** * A paging operation that finishes on the first call without a nextlink. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java similarity index 58% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java index 75c85093f090e..94fc3c5be97f6 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/AutoRestPagingTestServiceImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/implementation/AutoRestPagingTestServiceImpl.java @@ -8,35 +8,22 @@ * regenerated. */ -package fixtures.paging; +package fixtures.paging.implementation; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.CustomHeaderInterceptor; -import com.microsoft.rest.AutoRestBaseUrl; +import com.microsoft.azure.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; -import java.util.UUID; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; +import fixtures.paging.AutoRestPagingTestService; +import fixtures.paging.Pagings; /** - * Initializes a new instance of the AutoRestPagingTestService class. + * Initializes a new instance of the AutoRestPagingTestServiceImpl class. */ public final class AutoRestPagingTestServiceImpl extends AzureServiceClient implements AutoRestPagingTestService { - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - /** * Gets the {@link AzureClient} used for long running operations. * @return the azure client; @@ -45,18 +32,6 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - /** Gets or sets the preferred language for the response. */ private String acceptLanguage; @@ -65,7 +40,7 @@ public ServiceClientCredentials getCredentials() { * * @return the acceptLanguage value. */ - public String getAcceptLanguage() { + public String acceptLanguage() { return this.acceptLanguage; } @@ -73,9 +48,11 @@ public String getAcceptLanguage() { * Sets Gets or sets the preferred language for the response. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - public void setAcceptLanguage(String acceptLanguage) { + public AutoRestPagingTestServiceImpl withAcceptLanguage(String acceptLanguage) { this.acceptLanguage = acceptLanguage; + return this; } /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ @@ -86,7 +63,7 @@ public void setAcceptLanguage(String acceptLanguage) { * * @return the longRunningOperationRetryTimeout value. */ - public int getLongRunningOperationRetryTimeout() { + public int longRunningOperationRetryTimeout() { return this.longRunningOperationRetryTimeout; } @@ -94,9 +71,11 @@ public int getLongRunningOperationRetryTimeout() { * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public AutoRestPagingTestServiceImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; } /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ @@ -107,7 +86,7 @@ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTim * * @return the generateClientRequestId value. */ - public boolean getGenerateClientRequestId() { + public boolean generateClientRequestId() { return this.generateClientRequestId; } @@ -115,17 +94,24 @@ public boolean getGenerateClientRequestId() { * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { + public AutoRestPagingTestServiceImpl withGenerateClientRequestId(boolean generateClientRequestId) { this.generateClientRequestId = generateClientRequestId; + return this; } /** - * Gets the PagingOperations object to access its operations. - * @return the PagingOperations object. + * The Pagings object to access its operations. + */ + private Pagings pagings; + + /** + * Gets the Pagings object to access its operations. + * @return the Pagings object. */ - public PagingOperations getPagingOperations() { - return new PagingOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Pagings pagings() { + return this.pagings; } /** @@ -144,39 +130,39 @@ public AutoRestPagingTestServiceImpl(ServiceClientCredentials credentials) { * @param credentials the management credentials for Azure */ public AutoRestPagingTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } /** * Initializes an instance of AutoRestPagingTestService client. * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param restClient the REST client to connect to Azure. */ - public AutoRestPagingTestServiceImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; + public AutoRestPagingTestServiceImpl(RestClient restClient) { + super(restClient); initialize(); } - @Override protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); + this.pagings = new PagingsImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "AutoRestPagingTestService, 1.0.0"); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/PagingOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/implementation/PagingsImpl.java similarity index 91% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/PagingOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/implementation/PagingsImpl.java index 1dc01736a4803..c7e5d3f9d17df 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/PagingOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/implementation/PagingsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.paging; +package fixtures.paging.implementation; +import retrofit2.Retrofit; +import fixtures.paging.Pagings; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; @@ -37,105 +39,104 @@ import retrofit2.http.Path; import retrofit2.http.Url; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in PagingOperations. + * in Pagings. */ -public final class PagingOperationsImpl implements PagingOperations { +public final class PagingsImpl implements Pagings { /** The Retrofit service to perform REST calls. */ - private PagingService service; + private PagingsService service; /** The service client containing this operation class. */ - private AutoRestPagingTestService client; + private AutoRestPagingTestServiceImpl client; /** - * Initializes an instance of PagingOperations. + * Initializes an instance of PagingsImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PagingOperationsImpl(Retrofit retrofit, AutoRestPagingTestService client) { - this.service = retrofit.create(PagingService.class); + public PagingsImpl(Retrofit retrofit, AutoRestPagingTestServiceImpl client) { + this.service = retrofit.create(PagingsService.class); this.client = client; } /** - * The interface defining all the services for PagingOperations to be + * The interface defining all the services for Pagings to be * used by Retrofit to perform actually REST calls. */ - interface PagingService { + interface PagingsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("paging/single") - Call getSinglePages(@Header("accept-language") String acceptLanguage); + Call getSinglePages(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("paging/multiple") - Call getMultiplePages(@Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout); + Call getMultiplePages(@Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("paging/multiple/odata") - Call getOdataMultiplePages(@Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout); + Call getOdataMultiplePages(@Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("paging/multiple/withpath/{offset}") - Call getMultiplePagesWithOffset(@Path("offset") int offset, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout); + Call getMultiplePagesWithOffset(@Path("offset") int offset, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("paging/multiple/retryfirst") - Call getMultiplePagesRetryFirst(@Header("accept-language") String acceptLanguage); + Call getMultiplePagesRetryFirst(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("paging/multiple/retrysecond") - Call getMultiplePagesRetrySecond(@Header("accept-language") String acceptLanguage); + Call getMultiplePagesRetrySecond(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("paging/single/failure") - Call getSinglePagesFailure(@Header("accept-language") String acceptLanguage); + Call getSinglePagesFailure(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("paging/multiple/failure") - Call getMultiplePagesFailure(@Header("accept-language") String acceptLanguage); + Call getMultiplePagesFailure(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("paging/multiple/failureuri") - Call getMultiplePagesFailureUri(@Header("accept-language") String acceptLanguage); + Call getMultiplePagesFailureUri(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET - Call getSinglePagesNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage); + Call getSinglePagesNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET - Call getMultiplePagesNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout); + Call getMultiplePagesNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET - Call getOdataMultiplePagesNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout); + Call getOdataMultiplePagesNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET - Call getMultiplePagesWithOffsetNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout); + Call getMultiplePagesWithOffsetNext(@Url String nextPageLink, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET - Call getMultiplePagesRetryFirstNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage); + Call getMultiplePagesRetryFirstNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET - Call getMultiplePagesRetrySecondNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage); + Call getMultiplePagesRetrySecondNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET - Call getSinglePagesFailureNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage); + Call getSinglePagesFailureNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET - Call getMultiplePagesFailureNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage); + Call getMultiplePagesFailureNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET - Call getMultiplePagesFailureUriNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage); + Call getMultiplePagesFailureUriNext(@Url String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -147,7 +148,7 @@ interface PagingService { * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse> getSinglePages() throws CloudException, IOException { - Call call = service.getSinglePages(this.client.getAcceptLanguage()); + Call call = service.getSinglePages(this.client.acceptLanguage(), this.client.userAgent()); ServiceResponse> response = getSinglePagesDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -169,7 +170,7 @@ public ServiceCall getSinglePagesAsync(final ListOperationCallback serv if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.getSinglePages(this.client.getAcceptLanguage()); + Call call = service.getSinglePages(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -192,7 +193,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getSinglePagesDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -210,7 +211,7 @@ public ServiceResponse> getMultiplePages() throws CloudExcept final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions = null; Integer maxresults = null; Integer timeout = null; - Call call = service.getMultiplePages(clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); ServiceResponse> response = getMultiplePagesDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -236,7 +237,7 @@ public ServiceCall getMultiplePagesAsync(final ListOperationCallback se final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions = null; Integer maxresults = null; Integer timeout = null; - Call call = service.getMultiplePages(clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -271,13 +272,13 @@ public ServiceResponse> getMultiplePages(final String clientR Validator.validate(pagingGetMultiplePagesOptions); Integer maxresults = null; if (pagingGetMultiplePagesOptions != null) { - maxresults = pagingGetMultiplePagesOptions.getMaxresults(); + maxresults = pagingGetMultiplePagesOptions.maxresults(); } Integer timeout = null; if (pagingGetMultiplePagesOptions != null) { - timeout = pagingGetMultiplePagesOptions.getTimeout(); + timeout = pagingGetMultiplePagesOptions.timeout(); } - Call call = service.getMultiplePages(clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); ServiceResponse> response = getMultiplePagesDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -304,13 +305,13 @@ public ServiceCall getMultiplePagesAsync(final String clientRequestId, final Pag Validator.validate(pagingGetMultiplePagesOptions, serviceCallback); Integer maxresults = null; if (pagingGetMultiplePagesOptions != null) { - maxresults = pagingGetMultiplePagesOptions.getMaxresults(); + maxresults = pagingGetMultiplePagesOptions.maxresults(); } Integer timeout = null; if (pagingGetMultiplePagesOptions != null) { - timeout = pagingGetMultiplePagesOptions.getTimeout(); + timeout = pagingGetMultiplePagesOptions.timeout(); } - Call call = service.getMultiplePages(clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -333,7 +334,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -351,7 +352,7 @@ public ServiceResponse> getOdataMultiplePages() throws CloudE final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions = null; Integer maxresults = null; Integer timeout = null; - Call call = service.getOdataMultiplePages(clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); ServiceResponse> response = getOdataMultiplePagesDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -377,7 +378,7 @@ public ServiceCall getOdataMultiplePagesAsync(final ListOperationCallback call = service.getOdataMultiplePages(clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -412,13 +413,13 @@ public ServiceResponse> getOdataMultiplePages(final String cl Validator.validate(pagingGetOdataMultiplePagesOptions); Integer maxresults = null; if (pagingGetOdataMultiplePagesOptions != null) { - maxresults = pagingGetOdataMultiplePagesOptions.getMaxresults(); + maxresults = pagingGetOdataMultiplePagesOptions.maxresults(); } Integer timeout = null; if (pagingGetOdataMultiplePagesOptions != null) { - timeout = pagingGetOdataMultiplePagesOptions.getTimeout(); + timeout = pagingGetOdataMultiplePagesOptions.timeout(); } - Call call = service.getOdataMultiplePages(clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); ServiceResponse> response = getOdataMultiplePagesDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -445,13 +446,13 @@ public ServiceCall getOdataMultiplePagesAsync(final String clientRequestId, fina Validator.validate(pagingGetOdataMultiplePagesOptions, serviceCallback); Integer maxresults = null; if (pagingGetOdataMultiplePagesOptions != null) { - maxresults = pagingGetOdataMultiplePagesOptions.getMaxresults(); + maxresults = pagingGetOdataMultiplePagesOptions.maxresults(); } Integer timeout = null; if (pagingGetOdataMultiplePagesOptions != null) { - timeout = pagingGetOdataMultiplePagesOptions.getTimeout(); + timeout = pagingGetOdataMultiplePagesOptions.timeout(); } - Call call = service.getOdataMultiplePages(clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -474,7 +475,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getOdataMultiplePagesDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -495,17 +496,17 @@ public ServiceResponse> getMultiplePagesWithOffset(final Pagi } Validator.validate(pagingGetMultiplePagesWithOffsetOptions); final String clientRequestId = null; - Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.getMaxresults(); - int offset = pagingGetMultiplePagesWithOffsetOptions.getOffset(); - Integer timeout = pagingGetMultiplePagesWithOffsetOptions.getTimeout(); - Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults(); + int offset = pagingGetMultiplePagesWithOffsetOptions.offset(); + Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout(); + Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); ServiceResponse> response = getMultiplePagesWithOffsetDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override public Page nextPage(String nextPageLink) throws CloudException, IOException { PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions(); - pagingGetMultiplePagesWithOffsetNextOptions.setMaxresults(pagingGetMultiplePagesWithOffsetOptions.getMaxresults()); - pagingGetMultiplePagesWithOffsetNextOptions.setTimeout(pagingGetMultiplePagesWithOffsetOptions.getTimeout()); + pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults()); + pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout()); return getMultiplePagesWithOffsetNext(nextPageLink, null, null).getBody(); } }; @@ -530,10 +531,10 @@ public ServiceCall getMultiplePagesWithOffsetAsync(final PagingGetMultiplePagesW } Validator.validate(pagingGetMultiplePagesWithOffsetOptions, serviceCallback); final String clientRequestId = null; - Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.getMaxresults(); - int offset = pagingGetMultiplePagesWithOffsetOptions.getOffset(); - Integer timeout = pagingGetMultiplePagesWithOffsetOptions.getTimeout(); - Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults(); + int offset = pagingGetMultiplePagesWithOffsetOptions.offset(); + Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout(); + Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -544,8 +545,8 @@ public void onResponse(Call call, Response response) if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions(); - pagingGetMultiplePagesWithOffsetNextOptions.setMaxresults(pagingGetMultiplePagesWithOffsetOptions.getMaxresults()); - pagingGetMultiplePagesWithOffsetNextOptions.setTimeout(pagingGetMultiplePagesWithOffsetOptions.getTimeout()); + pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults()); + pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout()); getMultiplePagesWithOffsetNextAsync(result.getBody().getNextPageLink(), null, null, serviceCall, serviceCallback); } else { serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); @@ -573,17 +574,17 @@ public ServiceResponse> getMultiplePagesWithOffset(final Pagi throw new IllegalArgumentException("Parameter pagingGetMultiplePagesWithOffsetOptions is required and cannot be null."); } Validator.validate(pagingGetMultiplePagesWithOffsetOptions); - Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.getMaxresults(); - int offset = pagingGetMultiplePagesWithOffsetOptions.getOffset(); - Integer timeout = pagingGetMultiplePagesWithOffsetOptions.getTimeout(); - Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults(); + int offset = pagingGetMultiplePagesWithOffsetOptions.offset(); + Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout(); + Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); ServiceResponse> response = getMultiplePagesWithOffsetDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override public Page nextPage(String nextPageLink) throws CloudException, IOException { PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions(); - pagingGetMultiplePagesWithOffsetNextOptions.setMaxresults(pagingGetMultiplePagesWithOffsetOptions.getMaxresults()); - pagingGetMultiplePagesWithOffsetNextOptions.setTimeout(pagingGetMultiplePagesWithOffsetOptions.getTimeout()); + pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults()); + pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout()); return getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions).getBody(); } }; @@ -608,10 +609,10 @@ public ServiceCall getMultiplePagesWithOffsetAsync(final PagingGetMultiplePagesW return null; } Validator.validate(pagingGetMultiplePagesWithOffsetOptions, serviceCallback); - Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.getMaxresults(); - int offset = pagingGetMultiplePagesWithOffsetOptions.getOffset(); - Integer timeout = pagingGetMultiplePagesWithOffsetOptions.getTimeout(); - Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults(); + int offset = pagingGetMultiplePagesWithOffsetOptions.offset(); + Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout(); + Call call = service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -622,8 +623,8 @@ public void onResponse(Call call, Response response) if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) { PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions(); - pagingGetMultiplePagesWithOffsetNextOptions.setMaxresults(pagingGetMultiplePagesWithOffsetOptions.getMaxresults()); - pagingGetMultiplePagesWithOffsetNextOptions.setTimeout(pagingGetMultiplePagesWithOffsetOptions.getTimeout()); + pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults()); + pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout()); getMultiplePagesWithOffsetNextAsync(result.getBody().getNextPageLink(), clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions, serviceCall, serviceCallback); } else { serviceCallback.success(new ServiceResponse<>(serviceCallback.get(), result.getResponse())); @@ -637,7 +638,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesWithOffsetDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -651,7 +652,7 @@ private ServiceResponse> getMultiplePagesWithOffsetDelegate(Re * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse> getMultiplePagesRetryFirst() throws CloudException, IOException { - Call call = service.getMultiplePagesRetryFirst(this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesRetryFirst(this.client.acceptLanguage(), this.client.userAgent()); ServiceResponse> response = getMultiplePagesRetryFirstDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -673,7 +674,7 @@ public ServiceCall getMultiplePagesRetryFirstAsync(final ListOperationCallback

call = service.getMultiplePagesRetryFirst(this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesRetryFirst(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -696,7 +697,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesRetryFirstDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -710,7 +711,7 @@ private ServiceResponse> getMultiplePagesRetryFirstDelegate(Re * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse> getMultiplePagesRetrySecond() throws CloudException, IOException { - Call call = service.getMultiplePagesRetrySecond(this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesRetrySecond(this.client.acceptLanguage(), this.client.userAgent()); ServiceResponse> response = getMultiplePagesRetrySecondDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -732,7 +733,7 @@ public ServiceCall getMultiplePagesRetrySecondAsync(final ListOperationCallback< if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.getMultiplePagesRetrySecond(this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesRetrySecond(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -755,7 +756,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesRetrySecondDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -769,7 +770,7 @@ private ServiceResponse> getMultiplePagesRetrySecondDelegate(R * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse> getSinglePagesFailure() throws CloudException, IOException { - Call call = service.getSinglePagesFailure(this.client.getAcceptLanguage()); + Call call = service.getSinglePagesFailure(this.client.acceptLanguage(), this.client.userAgent()); ServiceResponse> response = getSinglePagesFailureDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -791,7 +792,7 @@ public ServiceCall getSinglePagesFailureAsync(final ListOperationCallback call = service.getSinglePagesFailure(this.client.getAcceptLanguage()); + Call call = service.getSinglePagesFailure(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -814,7 +815,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getSinglePagesFailureDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -828,7 +829,7 @@ private ServiceResponse> getSinglePagesFailureDelegate(Respons * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse> getMultiplePagesFailure() throws CloudException, IOException { - Call call = service.getMultiplePagesFailure(this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesFailure(this.client.acceptLanguage(), this.client.userAgent()); ServiceResponse> response = getMultiplePagesFailureDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -850,7 +851,7 @@ public ServiceCall getMultiplePagesFailureAsync(final ListOperationCallback call = service.getMultiplePagesFailure(this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesFailure(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -873,7 +874,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesFailureDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -887,7 +888,7 @@ private ServiceResponse> getMultiplePagesFailureDelegate(Respo * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse> getMultiplePagesFailureUri() throws CloudException, IOException { - Call call = service.getMultiplePagesFailureUri(this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesFailureUri(this.client.acceptLanguage(), this.client.userAgent()); ServiceResponse> response = getMultiplePagesFailureUriDelegate(call.execute()); PagedList result = new PagedList(response.getBody()) { @Override @@ -909,7 +910,7 @@ public ServiceCall getMultiplePagesFailureUriAsync(final ListOperationCallback

call = service.getMultiplePagesFailureUri(this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesFailureUri(this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -932,7 +933,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesFailureUriDelegate(Response response) throws CloudException, IOException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -951,7 +952,7 @@ public ServiceResponse> getSinglePagesNext(final String nextPa if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } - Call call = service.getSinglePagesNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getSinglePagesNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); return getSinglePagesNextDelegate(call.execute()); } @@ -972,7 +973,7 @@ public ServiceCall getSinglePagesNextAsync(final String nextPageLink, final Serv serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } - Call call = service.getSinglePagesNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getSinglePagesNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -995,7 +996,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getSinglePagesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1018,7 +1019,7 @@ public ServiceResponse> getMultiplePagesNext(final String next final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions = null; Integer maxresults = null; Integer timeout = null; - Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); return getMultiplePagesNextDelegate(call.execute()); } @@ -1043,7 +1044,7 @@ public ServiceCall getMultiplePagesNextAsync(final String nextPageLink, final Se final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions = null; Integer maxresults = null; Integer timeout = null; - Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1083,13 +1084,13 @@ public ServiceResponse> getMultiplePagesNext(final String next Validator.validate(pagingGetMultiplePagesOptions); Integer maxresults = null; if (pagingGetMultiplePagesOptions != null) { - maxresults = pagingGetMultiplePagesOptions.getMaxresults(); + maxresults = pagingGetMultiplePagesOptions.maxresults(); } Integer timeout = null; if (pagingGetMultiplePagesOptions != null) { - timeout = pagingGetMultiplePagesOptions.getTimeout(); + timeout = pagingGetMultiplePagesOptions.timeout(); } - Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); return getMultiplePagesNextDelegate(call.execute()); } @@ -1115,13 +1116,13 @@ public ServiceCall getMultiplePagesNextAsync(final String nextPageLink, final St Validator.validate(pagingGetMultiplePagesOptions, serviceCallback); Integer maxresults = null; if (pagingGetMultiplePagesOptions != null) { - maxresults = pagingGetMultiplePagesOptions.getMaxresults(); + maxresults = pagingGetMultiplePagesOptions.maxresults(); } Integer timeout = null; if (pagingGetMultiplePagesOptions != null) { - timeout = pagingGetMultiplePagesOptions.getTimeout(); + timeout = pagingGetMultiplePagesOptions.timeout(); } - Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1144,7 +1145,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1167,7 +1168,7 @@ public ServiceResponse> getOdataMultiplePagesNext(final Strin final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions = null; Integer maxresults = null; Integer timeout = null; - Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); return getOdataMultiplePagesNextDelegate(call.execute()); } @@ -1192,7 +1193,7 @@ public ServiceCall getOdataMultiplePagesNextAsync(final String nextPageLink, fin final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions = null; Integer maxresults = null; Integer timeout = null; - Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1232,13 +1233,13 @@ public ServiceResponse> getOdataMultiplePagesNext(final Strin Validator.validate(pagingGetOdataMultiplePagesOptions); Integer maxresults = null; if (pagingGetOdataMultiplePagesOptions != null) { - maxresults = pagingGetOdataMultiplePagesOptions.getMaxresults(); + maxresults = pagingGetOdataMultiplePagesOptions.maxresults(); } Integer timeout = null; if (pagingGetOdataMultiplePagesOptions != null) { - timeout = pagingGetOdataMultiplePagesOptions.getTimeout(); + timeout = pagingGetOdataMultiplePagesOptions.timeout(); } - Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); return getOdataMultiplePagesNextDelegate(call.execute()); } @@ -1264,13 +1265,13 @@ public ServiceCall getOdataMultiplePagesNextAsync(final String nextPageLink, fin Validator.validate(pagingGetOdataMultiplePagesOptions, serviceCallback); Integer maxresults = null; if (pagingGetOdataMultiplePagesOptions != null) { - maxresults = pagingGetOdataMultiplePagesOptions.getMaxresults(); + maxresults = pagingGetOdataMultiplePagesOptions.maxresults(); } Integer timeout = null; if (pagingGetOdataMultiplePagesOptions != null) { - timeout = pagingGetOdataMultiplePagesOptions.getTimeout(); + timeout = pagingGetOdataMultiplePagesOptions.timeout(); } - Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Call call = service.getOdataMultiplePagesNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1293,7 +1294,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getOdataMultiplePagesNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1314,9 +1315,9 @@ public ServiceResponse> getMultiplePagesWithOffsetNext(final S } final String clientRequestId = null; final PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = null; - Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.getMaxresults(); - Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.getTimeout(); - Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.maxresults(); + Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.timeout(); + Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); return getMultiplePagesWithOffsetNextDelegate(call.execute()); } @@ -1339,9 +1340,9 @@ public ServiceCall getMultiplePagesWithOffsetNextAsync(final String nextPageLink } final String clientRequestId = null; final PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = null; - Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.getMaxresults(); - Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.getTimeout(); - Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.maxresults(); + Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.timeout(); + Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1379,9 +1380,9 @@ public ServiceResponse> getMultiplePagesWithOffsetNext(final S throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Validator.validate(pagingGetMultiplePagesWithOffsetNextOptions); - Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.getMaxresults(); - Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.getTimeout(); - Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.maxresults(); + Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.timeout(); + Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); return getMultiplePagesWithOffsetNextDelegate(call.execute()); } @@ -1405,9 +1406,9 @@ public ServiceCall getMultiplePagesWithOffsetNextAsync(final String nextPageLink return null; } Validator.validate(pagingGetMultiplePagesWithOffsetNextOptions, serviceCallback); - Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.getMaxresults(); - Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.getTimeout(); - Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.getAcceptLanguage(), maxresults, timeout); + Integer maxresults = pagingGetMultiplePagesWithOffsetNextOptions.maxresults(); + Integer timeout = pagingGetMultiplePagesWithOffsetNextOptions.timeout(); + Call call = service.getMultiplePagesWithOffsetNext(nextPageLink, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1430,7 +1431,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesWithOffsetNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1449,7 +1450,7 @@ public ServiceResponse> getMultiplePagesRetryFirstNext(final S if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } - Call call = service.getMultiplePagesRetryFirstNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesRetryFirstNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); return getMultiplePagesRetryFirstNextDelegate(call.execute()); } @@ -1470,7 +1471,7 @@ public ServiceCall getMultiplePagesRetryFirstNextAsync(final String nextPageLink serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } - Call call = service.getMultiplePagesRetryFirstNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesRetryFirstNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1493,7 +1494,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesRetryFirstNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1512,7 +1513,7 @@ public ServiceResponse> getMultiplePagesRetrySecondNext(final if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } - Call call = service.getMultiplePagesRetrySecondNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesRetrySecondNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); return getMultiplePagesRetrySecondNextDelegate(call.execute()); } @@ -1533,7 +1534,7 @@ public ServiceCall getMultiplePagesRetrySecondNextAsync(final String nextPageLin serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } - Call call = service.getMultiplePagesRetrySecondNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesRetrySecondNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1556,7 +1557,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesRetrySecondNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1575,7 +1576,7 @@ public ServiceResponse> getSinglePagesFailureNext(final String if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } - Call call = service.getSinglePagesFailureNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getSinglePagesFailureNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); return getSinglePagesFailureNextDelegate(call.execute()); } @@ -1596,7 +1597,7 @@ public ServiceCall getSinglePagesFailureNextAsync(final String nextPageLink, fin serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } - Call call = service.getSinglePagesFailureNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getSinglePagesFailureNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1619,7 +1620,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getSinglePagesFailureNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1638,7 +1639,7 @@ public ServiceResponse> getMultiplePagesFailureNext(final Stri if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } - Call call = service.getMultiplePagesFailureNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesFailureNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); return getMultiplePagesFailureNextDelegate(call.execute()); } @@ -1659,7 +1660,7 @@ public ServiceCall getMultiplePagesFailureNextAsync(final String nextPageLink, f serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } - Call call = service.getMultiplePagesFailureNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesFailureNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1682,7 +1683,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesFailureNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); @@ -1701,7 +1702,7 @@ public ServiceResponse> getMultiplePagesFailureUriNext(final S if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } - Call call = service.getMultiplePagesFailureUriNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesFailureUriNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); return getMultiplePagesFailureUriNextDelegate(call.execute()); } @@ -1722,7 +1723,7 @@ public ServiceCall getMultiplePagesFailureUriNextAsync(final String nextPageLink serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } - Call call = service.getMultiplePagesFailureUriNext(nextPageLink, this.client.getAcceptLanguage()); + Call call = service.getMultiplePagesFailureUriNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()); serviceCall.newCall(call); call.enqueue(new ServiceResponseCallback>(serviceCallback) { @Override @@ -1745,7 +1746,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getMultiplePagesFailureUriNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/implementation/package-info.java new file mode 100644 index 0000000000000..2a185d97351ec --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestPagingTestService. + * Long-running Operation for AutoRest. + */ +package fixtures.paging.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/OperationResult.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/OperationResult.java index c1e1d9071fe5a..a321ff2fab674 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/OperationResult.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/OperationResult.java @@ -27,7 +27,7 @@ public class OperationResult { * * @return the status value */ - public String getStatus() { + public String status() { return this.status; } @@ -35,9 +35,11 @@ public String getStatus() { * Set the status value. * * @param status the status value to set + * @return the OperationResult object itself. */ - public void setStatus(String status) { + public OperationResult withStatus(String status) { this.status = status; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PageImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PageImpl.java index 814bd75c8098a..cfa3468c72586 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PageImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PageImpl.java @@ -52,4 +52,26 @@ public String getNextPageLink() { public List getItems() { return items; } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PageImpl1.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PageImpl1.java index 36a6f23b9d5da..95f50f55be826 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PageImpl1.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PageImpl1.java @@ -52,4 +52,26 @@ public String getNextPageLink() { public List getItems() { return items; } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesOptions.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesOptions.java index 0ce6b1680d2f3..557dfed39a398 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesOptions.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesOptions.java @@ -34,7 +34,7 @@ public class PagingGetMultiplePagesOptions { * * @return the maxresults value */ - public Integer getMaxresults() { + public Integer maxresults() { return this.maxresults; } @@ -42,9 +42,11 @@ public Integer getMaxresults() { * Set the maxresults value. * * @param maxresults the maxresults value to set + * @return the PagingGetMultiplePagesOptions object itself. */ - public void setMaxresults(Integer maxresults) { + public PagingGetMultiplePagesOptions withMaxresults(Integer maxresults) { this.maxresults = maxresults; + return this; } /** @@ -52,7 +54,7 @@ public void setMaxresults(Integer maxresults) { * * @return the timeout value */ - public Integer getTimeout() { + public Integer timeout() { return this.timeout; } @@ -60,9 +62,11 @@ public Integer getTimeout() { * Set the timeout value. * * @param timeout the timeout value to set + * @return the PagingGetMultiplePagesOptions object itself. */ - public void setTimeout(Integer timeout) { + public PagingGetMultiplePagesOptions withTimeout(Integer timeout) { this.timeout = timeout; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesWithOffsetNextOptions.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesWithOffsetNextOptions.java index 11960b2802066..87fe890c8965c 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesWithOffsetNextOptions.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesWithOffsetNextOptions.java @@ -34,7 +34,7 @@ public class PagingGetMultiplePagesWithOffsetNextOptions { * * @return the maxresults value */ - public Integer getMaxresults() { + public Integer maxresults() { return this.maxresults; } @@ -42,9 +42,11 @@ public Integer getMaxresults() { * Set the maxresults value. * * @param maxresults the maxresults value to set + * @return the PagingGetMultiplePagesWithOffsetNextOptions object itself. */ - public void setMaxresults(Integer maxresults) { + public PagingGetMultiplePagesWithOffsetNextOptions withMaxresults(Integer maxresults) { this.maxresults = maxresults; + return this; } /** @@ -52,7 +54,7 @@ public void setMaxresults(Integer maxresults) { * * @return the timeout value */ - public Integer getTimeout() { + public Integer timeout() { return this.timeout; } @@ -60,9 +62,11 @@ public Integer getTimeout() { * Set the timeout value. * * @param timeout the timeout value to set + * @return the PagingGetMultiplePagesWithOffsetNextOptions object itself. */ - public void setTimeout(Integer timeout) { + public PagingGetMultiplePagesWithOffsetNextOptions withTimeout(Integer timeout) { this.timeout = timeout; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesWithOffsetOptions.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesWithOffsetOptions.java index 1cff9918a4fee..ab5d74626b597 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesWithOffsetOptions.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetMultiplePagesWithOffsetOptions.java @@ -40,7 +40,7 @@ public class PagingGetMultiplePagesWithOffsetOptions { * * @return the maxresults value */ - public Integer getMaxresults() { + public Integer maxresults() { return this.maxresults; } @@ -48,9 +48,11 @@ public Integer getMaxresults() { * Set the maxresults value. * * @param maxresults the maxresults value to set + * @return the PagingGetMultiplePagesWithOffsetOptions object itself. */ - public void setMaxresults(Integer maxresults) { + public PagingGetMultiplePagesWithOffsetOptions withMaxresults(Integer maxresults) { this.maxresults = maxresults; + return this; } /** @@ -58,7 +60,7 @@ public void setMaxresults(Integer maxresults) { * * @return the offset value */ - public int getOffset() { + public int offset() { return this.offset; } @@ -66,9 +68,11 @@ public int getOffset() { * Set the offset value. * * @param offset the offset value to set + * @return the PagingGetMultiplePagesWithOffsetOptions object itself. */ - public void setOffset(int offset) { + public PagingGetMultiplePagesWithOffsetOptions withOffset(int offset) { this.offset = offset; + return this; } /** @@ -76,7 +80,7 @@ public void setOffset(int offset) { * * @return the timeout value */ - public Integer getTimeout() { + public Integer timeout() { return this.timeout; } @@ -84,9 +88,11 @@ public Integer getTimeout() { * Set the timeout value. * * @param timeout the timeout value to set + * @return the PagingGetMultiplePagesWithOffsetOptions object itself. */ - public void setTimeout(Integer timeout) { + public PagingGetMultiplePagesWithOffsetOptions withTimeout(Integer timeout) { this.timeout = timeout; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetOdataMultiplePagesOptions.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetOdataMultiplePagesOptions.java index ecd41d0316b51..f6d24931414cd 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetOdataMultiplePagesOptions.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/PagingGetOdataMultiplePagesOptions.java @@ -34,7 +34,7 @@ public class PagingGetOdataMultiplePagesOptions { * * @return the maxresults value */ - public Integer getMaxresults() { + public Integer maxresults() { return this.maxresults; } @@ -42,9 +42,11 @@ public Integer getMaxresults() { * Set the maxresults value. * * @param maxresults the maxresults value to set + * @return the PagingGetOdataMultiplePagesOptions object itself. */ - public void setMaxresults(Integer maxresults) { + public PagingGetOdataMultiplePagesOptions withMaxresults(Integer maxresults) { this.maxresults = maxresults; + return this; } /** @@ -52,7 +54,7 @@ public void setMaxresults(Integer maxresults) { * * @return the timeout value */ - public Integer getTimeout() { + public Integer timeout() { return this.timeout; } @@ -60,9 +62,11 @@ public Integer getTimeout() { * Set the timeout value. * * @param timeout the timeout value to set + * @return the PagingGetOdataMultiplePagesOptions object itself. */ - public void setTimeout(Integer timeout) { + public PagingGetOdataMultiplePagesOptions withTimeout(Integer timeout) { this.timeout = timeout; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/Product.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/Product.java index 90ea3a44897a2..d325f65337cde 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/Product.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/Product.java @@ -25,7 +25,7 @@ public class Product { * * @return the properties value */ - public ProductProperties getProperties() { + public ProductProperties properties() { return this.properties; } @@ -33,9 +33,11 @@ public ProductProperties getProperties() { * Set the properties value. * * @param properties the properties value to set + * @return the Product object itself. */ - public void setProperties(ProductProperties properties) { + public Product withProperties(ProductProperties properties) { this.properties = properties; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/ProductProperties.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/ProductProperties.java index 1911041bc9ebd..a6f194bdaf36a 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/ProductProperties.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/ProductProperties.java @@ -30,7 +30,7 @@ public class ProductProperties { * * @return the id value */ - public Integer getId() { + public Integer id() { return this.id; } @@ -38,9 +38,11 @@ public Integer getId() { * Set the id value. * * @param id the id value to set + * @return the ProductProperties object itself. */ - public void setId(Integer id) { + public ProductProperties withId(Integer id) { this.id = id; + return this; } /** @@ -48,7 +50,7 @@ public void setId(Integer id) { * * @return the name value */ - public String getName() { + public String name() { return this.name; } @@ -56,9 +58,11 @@ public String getName() { * Set the name value. * * @param name the name value to set + * @return the ProductProperties object itself. */ - public void setName(String name) { + public ProductProperties withName(String name) { this.name = name; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/package-info.java index bf9a75b0e2a5c..1ce439d6183a4 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/paging/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestPagingTestService. + * This package contains the models classes for AutoRestPagingTestService. * Long-running Operation for AutoRest. */ package fixtures.paging.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/GroupOperations.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/Groups.java similarity index 97% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/GroupOperations.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/Groups.java index 6f9629dbc5dc3..9226899ca7138 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/GroupOperations.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/Groups.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in GroupOperations. + * in Groups. */ -public interface GroupOperations { +public interface Groups { /** * Provides a resouce group with name 'testgroup101' and location 'West US'. * diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/MicrosoftAzureTestUrl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/MicrosoftAzureTestUrl.java index ea6df57ccddb1..908204991662f 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/MicrosoftAzureTestUrl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/MicrosoftAzureTestUrl.java @@ -11,44 +11,18 @@ package fixtures.subscriptionidapiversion; import com.microsoft.azure.AzureClient; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; +import com.microsoft.azure.RestClient; /** * The interface for MicrosoftAzureTestUrl class. */ public interface MicrosoftAzureTestUrl { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + * @return the {@link RestClient} object. + */ + RestClient restClient(); /** * Gets the {@link AzureClient} used for long running operations. @@ -57,79 +31,83 @@ public interface MicrosoftAzureTestUrl { AzureClient getAzureClient(); /** - * Gets Credentials needed for the client to connect to Azure.. + * Gets the User-Agent header for the client. * - * @return the credentials value. + * @return the user agent string. */ - ServiceClientCredentials getCredentials(); + String userAgent(); /** * Gets Subscription Id.. * * @return the subscriptionId value. */ - String getSubscriptionId(); + String subscriptionId(); /** * Sets Subscription Id.. * * @param subscriptionId the subscriptionId value. + * @return the service client itself */ - void setSubscriptionId(String subscriptionId); + MicrosoftAzureTestUrl withSubscriptionId(String subscriptionId); /** * Gets API Version with value '2014-04-01-preview'.. * * @return the apiVersion value. */ - String getApiVersion(); + String apiVersion(); /** * Gets Gets or sets the preferred language for the response.. * * @return the acceptLanguage value. */ - String getAcceptLanguage(); + String acceptLanguage(); /** * Sets Gets or sets the preferred language for the response.. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - void setAcceptLanguage(String acceptLanguage); + MicrosoftAzureTestUrl withAcceptLanguage(String acceptLanguage); /** * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @return the longRunningOperationRetryTimeout value. */ - int getLongRunningOperationRetryTimeout(); + int longRunningOperationRetryTimeout(); /** * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + MicrosoftAzureTestUrl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @return the generateClientRequestId value. */ - boolean getGenerateClientRequestId(); + boolean generateClientRequestId(); /** * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - void setGenerateClientRequestId(boolean generateClientRequestId); + MicrosoftAzureTestUrl withGenerateClientRequestId(boolean generateClientRequestId); /** - * Gets the GroupOperations object to access its operations. - * @return the GroupOperations object. + * Gets the Groups object to access its operations. + * @return the Groups object. */ - GroupOperations getGroupOperations(); + Groups groups(); } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/GroupOperationsImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/GroupsImpl.java similarity index 78% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/GroupOperationsImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/GroupsImpl.java index 3445c4932ddc4..0889259a4b81b 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/GroupOperationsImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/GroupsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.subscriptionidapiversion; +package fixtures.subscriptionidapiversion.implementation; +import retrofit2.Retrofit; +import fixtures.subscriptionidapiversion.Groups; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.rest.ServiceCall; @@ -27,37 +29,36 @@ import retrofit2.http.Path; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in GroupOperations. + * in Groups. */ -public final class GroupOperationsImpl implements GroupOperations { +public final class GroupsImpl implements Groups { /** The Retrofit service to perform REST calls. */ - private GroupService service; + private GroupsService service; /** The service client containing this operation class. */ - private MicrosoftAzureTestUrl client; + private MicrosoftAzureTestUrlImpl client; /** - * Initializes an instance of GroupOperations. + * Initializes an instance of GroupsImpl. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public GroupOperationsImpl(Retrofit retrofit, MicrosoftAzureTestUrl client) { - this.service = retrofit.create(GroupService.class); + public GroupsImpl(Retrofit retrofit, MicrosoftAzureTestUrlImpl client) { + this.service = retrofit.create(GroupsService.class); this.client = client; } /** - * The interface defining all the services for GroupOperations to be + * The interface defining all the services for Groups to be * used by Retrofit to perform actually REST calls. */ - interface GroupService { + interface GroupsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") - Call getSampleResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + Call getSampleResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -71,16 +72,16 @@ interface GroupService { * @return the SampleResourceGroup object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse getSampleResourceGroup(String resourceGroupName) throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - if (this.client.getApiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Call call = service.getSampleResourceGroup(this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getSampleResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return getSampleResourceGroupDelegate(call.execute()); } @@ -96,19 +97,19 @@ public ServiceCall getSampleResourceGroupAsync(String resourceGroupName, final S if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); return null; } if (resourceGroupName == null) { serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } - if (this.client.getApiVersion() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + if (this.client.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); return null; } - Call call = service.getSampleResourceGroup(this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), this.client.getAcceptLanguage()); + Call call = service.getSampleResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -124,7 +125,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getSampleResourceGroupDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/MicrosoftAzureTestUrlImpl.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/MicrosoftAzureTestUrlImpl.java similarity index 60% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/MicrosoftAzureTestUrlImpl.java rename to AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/MicrosoftAzureTestUrlImpl.java index 6a4e4f5a46909..268446844b2d5 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/MicrosoftAzureTestUrlImpl.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/MicrosoftAzureTestUrlImpl.java @@ -8,35 +8,22 @@ * regenerated. */ -package fixtures.subscriptionidapiversion; +package fixtures.subscriptionidapiversion.implementation; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.CustomHeaderInterceptor; -import com.microsoft.rest.AutoRestBaseUrl; +import com.microsoft.azure.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; -import java.util.UUID; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; +import fixtures.subscriptionidapiversion.Groups; +import fixtures.subscriptionidapiversion.MicrosoftAzureTestUrl; /** - * Initializes a new instance of the MicrosoftAzureTestUrl class. + * Initializes a new instance of the MicrosoftAzureTestUrlImpl class. */ public final class MicrosoftAzureTestUrlImpl extends AzureServiceClient implements MicrosoftAzureTestUrl { - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - /** * Gets the {@link AzureClient} used for long running operations. * @return the azure client; @@ -45,18 +32,6 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Credentials needed for the client to connect to Azure. */ - private ServiceClientCredentials credentials; - - /** - * Gets Credentials needed for the client to connect to Azure. - * - * @return the credentials value. - */ - public ServiceClientCredentials getCredentials() { - return this.credentials; - } - /** Subscription Id. */ private String subscriptionId; @@ -65,7 +40,7 @@ public ServiceClientCredentials getCredentials() { * * @return the subscriptionId value. */ - public String getSubscriptionId() { + public String subscriptionId() { return this.subscriptionId; } @@ -73,9 +48,11 @@ public String getSubscriptionId() { * Sets Subscription Id. * * @param subscriptionId the subscriptionId value. + * @return the service client itself */ - public void setSubscriptionId(String subscriptionId) { + public MicrosoftAzureTestUrlImpl withSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; + return this; } /** API Version with value '2014-04-01-preview'. */ @@ -86,7 +63,7 @@ public void setSubscriptionId(String subscriptionId) { * * @return the apiVersion value. */ - public String getApiVersion() { + public String apiVersion() { return this.apiVersion; } @@ -98,7 +75,7 @@ public String getApiVersion() { * * @return the acceptLanguage value. */ - public String getAcceptLanguage() { + public String acceptLanguage() { return this.acceptLanguage; } @@ -106,9 +83,11 @@ public String getAcceptLanguage() { * Sets Gets or sets the preferred language for the response. * * @param acceptLanguage the acceptLanguage value. + * @return the service client itself */ - public void setAcceptLanguage(String acceptLanguage) { + public MicrosoftAzureTestUrlImpl withAcceptLanguage(String acceptLanguage) { this.acceptLanguage = acceptLanguage; + return this; } /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ @@ -119,7 +98,7 @@ public void setAcceptLanguage(String acceptLanguage) { * * @return the longRunningOperationRetryTimeout value. */ - public int getLongRunningOperationRetryTimeout() { + public int longRunningOperationRetryTimeout() { return this.longRunningOperationRetryTimeout; } @@ -127,9 +106,11 @@ public int getLongRunningOperationRetryTimeout() { * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public MicrosoftAzureTestUrlImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; } /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ @@ -140,7 +121,7 @@ public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTim * * @return the generateClientRequestId value. */ - public boolean getGenerateClientRequestId() { + public boolean generateClientRequestId() { return this.generateClientRequestId; } @@ -148,17 +129,24 @@ public boolean getGenerateClientRequestId() { * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself */ - public void setGenerateClientRequestId(boolean generateClientRequestId) { + public MicrosoftAzureTestUrlImpl withGenerateClientRequestId(boolean generateClientRequestId) { this.generateClientRequestId = generateClientRequestId; + return this; } /** - * Gets the GroupOperations object to access its operations. - * @return the GroupOperations object. + * The Groups object to access its operations. + */ + private Groups groups; + + /** + * Gets the Groups object to access its operations. + * @return the Groups object. */ - public GroupOperations getGroupOperations() { - return new GroupOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Groups groups() { + return this.groups; } /** @@ -177,40 +165,40 @@ public MicrosoftAzureTestUrlImpl(ServiceClientCredentials credentials) { * @param credentials the management credentials for Azure */ public MicrosoftAzureTestUrlImpl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } /** * Initializes an instance of MicrosoftAzureTestUrl client. * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param restClient the REST client to connect to Azure. */ - public MicrosoftAzureTestUrlImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; + public MicrosoftAzureTestUrlImpl(RestClient restClient) { + super(restClient); initialize(); } - @Override protected void initialize() { this.apiVersion = "2014-04-01-preview"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.clientBuilder.interceptors().add(new CustomHeaderInterceptor("x-ms-client-request-id", UUID.randomUUID().toString())); - if (this.credentials != null) { - this.credentials.applyCredentialsFilter(clientBuilder); - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - this.retrofitBuilder.baseUrl(baseUrl); + this.groups = new GroupsImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "MicrosoftAzureTestUrl, 2014-04-01-preview"); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/package-info.java new file mode 100644 index 0000000000000..c4f55dd890a9d --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for MicrosoftAzureTestUrl. + * Some cool documentation. + */ +package fixtures.subscriptionidapiversion.implementation; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/Error.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/Error.java index 891b91ab2c370..86b11119dc496 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/Error.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the code value */ - public Integer getCode() { + public Integer code() { return this.code; } @@ -38,9 +38,11 @@ public Integer getCode() { * Set the code value. * * @param code the code value to set + * @return the Error object itself. */ - public void setCode(Integer code) { + public Error withCode(Integer code) { this.code = code; + return this; } /** @@ -48,7 +50,7 @@ public void setCode(Integer code) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/ErrorException.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/ErrorException.java index 09c1a224d610c..83a31b05f482b 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/ErrorException.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.subscriptionidapiversion.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/SampleResourceGroup.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/SampleResourceGroup.java index 86541e5a3e876..c3439f4286b05 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/SampleResourceGroup.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/SampleResourceGroup.java @@ -30,7 +30,7 @@ public class SampleResourceGroup { * * @return the name value */ - public String getName() { + public String name() { return this.name; } @@ -38,9 +38,11 @@ public String getName() { * Set the name value. * * @param name the name value to set + * @return the SampleResourceGroup object itself. */ - public void setName(String name) { + public SampleResourceGroup withName(String name) { this.name = name; + return this; } /** @@ -48,7 +50,7 @@ public void setName(String name) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -56,9 +58,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the SampleResourceGroup object itself. */ - public void setLocation(String location) { + public SampleResourceGroup withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/package-info.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/package-info.java index e6528f5a3d1a4..bf0d22d96efe3 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/package-info.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/subscriptionidapiversion/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for MicrosoftAzureTestUrl. + * This package contains the models classes for MicrosoftAzureTestUrl. * Some cool documentation. */ package fixtures.subscriptionidapiversion.models; diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurecustombaseuri/AzureCustomBaseUriTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurecustombaseuri/AzureCustomBaseUriTests.java index b6007f1d8195e..f5606435a3674 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurecustombaseuri/AzureCustomBaseUriTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurecustombaseuri/AzureCustomBaseUriTests.java @@ -9,11 +9,10 @@ import java.net.UnknownHostException; import java.util.UUID; -import fixtures.custombaseuri.AutoRestParameterizedHostTestClient; -import fixtures.custombaseuri.AutoRestParameterizedHostTestClientImpl; +import fixtures.custombaseuri.implementation.AutoRestParameterizedHostTestClientImpl; public class AzureCustomBaseUriTests { - private static AutoRestParameterizedHostTestClient client; + private static AutoRestParameterizedHostTestClientImpl client; @BeforeClass public static void setup() { @@ -23,14 +22,14 @@ public static void setup() { // Positive test case @Test public void getEmptyWithValidCustomUri() throws Exception { - client.setHost("host:3000"); - Assert.assertTrue(client.getPathsOperations().getEmpty("local").getResponse().isSuccess()); + client.withHost("host:3000"); + Assert.assertTrue(client.paths().getEmpty("local").getResponse().isSuccessful()); } @Test public void getEmptyWithInvalidCustomUriAccountName() throws Exception { try { - client.getPathsOperations().getEmpty("bad"); + client.paths().getEmpty("bad"); Assert.assertTrue(false); } catch (UnknownHostException e) { @@ -41,22 +40,22 @@ public void getEmptyWithInvalidCustomUriAccountName() throws Exception { @Test public void getEmptyWithInvalidCustomUriHostName() throws Exception { try { - client.setHost("badhost"); - client.getPathsOperations().getEmpty("local"); + client.withHost("badhost"); + client.paths().getEmpty("local"); Assert.assertTrue(false); } catch (UnknownHostException e) { Assert.assertTrue(true); } finally { - client.setHost("host:3000"); + client.withHost("host:3000"); } } @Test public void getEmptyWithEmptyCustomUriAccountName() throws Exception { try { - client.getPathsOperations().getEmpty(null); + client.paths().getEmpty(null); Assert.assertTrue(false); } catch (IllegalArgumentException e) { diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azureparametergrouping/ParameterGroupingTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azureparametergrouping/ParameterGroupingTests.java index 9ff05df067532..0ae62ed7ae139 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azureparametergrouping/ParameterGroupingTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azureparametergrouping/ParameterGroupingTests.java @@ -5,13 +5,14 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.azureparametergrouping.implementation.AutoRestParameterGroupingTestServiceImpl; import fixtures.azureparametergrouping.models.FirstParameterGroup; import fixtures.azureparametergrouping.models.ParameterGroupingPostMultiParamGroupsSecondParamGroup; import fixtures.azureparametergrouping.models.ParameterGroupingPostOptionalParameters; import fixtures.azureparametergrouping.models.ParameterGroupingPostRequiredParameters; public class ParameterGroupingTests { - private static AutoRestParameterGroupingTestService client; + private static AutoRestParameterGroupingTestServiceImpl client; @BeforeClass public static void setup() { @@ -21,37 +22,37 @@ public static void setup() { @Test public void postRequired() throws Exception { ParameterGroupingPostRequiredParameters params = new ParameterGroupingPostRequiredParameters(); - params.setBody(1234); - params.setPath("path"); - params.setQuery(21); - params.setCustomHeader("header"); - ServiceResponse group = client.getParameterGroupingOperations().postRequired(params); + params.withBody(1234); + params.withPath("path"); + params.withQuery(21); + params.withCustomHeader("header"); + ServiceResponse group = client.parameterGroupings().postRequired(params); } @Test public void postOptional() throws Exception { ParameterGroupingPostOptionalParameters params = new ParameterGroupingPostOptionalParameters(); - params.setQuery(21); - params.setCustomHeader("header"); - ServiceResponse group = client.getParameterGroupingOperations().postOptional(params); + params.withQuery(21); + params.withCustomHeader("header"); + ServiceResponse group = client.parameterGroupings().postOptional(params); } @Test public void postMultipleParameterGroups() throws Exception { FirstParameterGroup first = new FirstParameterGroup(); - first.setQueryOne(21); - first.setHeaderOne("header"); + first.withQueryOne(21); + first.withHeaderOne("header"); ParameterGroupingPostMultiParamGroupsSecondParamGroup second = new ParameterGroupingPostMultiParamGroupsSecondParamGroup(); - second.setHeaderTwo("header2"); - second.setQueryTwo(42); - ServiceResponse group = client.getParameterGroupingOperations().postMultiParamGroups(first, second); + second.withHeaderTwo("header2"); + second.withQueryTwo(42); + ServiceResponse group = client.parameterGroupings().postMultiParamGroups(first, second); } @Test public void postParameterGroupWithSharedParameter() throws Exception { FirstParameterGroup first = new FirstParameterGroup(); - first.setQueryOne(21); - first.setHeaderOne("header"); - ServiceResponse group = client.getParameterGroupingOperations().postSharedParameterGroupObject(first); + first.withQueryOne(21); + first.withHeaderOne("header"); + ServiceResponse group = client.parameterGroupings().postSharedParameterGroupObject(first); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurereport/CoverageReporter.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurereport/CoverageReporter.java index 45bbede036b53..89eebfb07d165 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurereport/CoverageReporter.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurereport/CoverageReporter.java @@ -4,8 +4,10 @@ import java.util.List; import java.util.Map; +import fixtures.azurereport.implementation.AutoRestReportServiceForAzureImpl; + public final class CoverageReporter { - private static AutoRestReportServiceForAzure client = new AutoRestReportServiceForAzureImpl("http://localhost:3000", null); + private static AutoRestReportServiceForAzureImpl client = new AutoRestReportServiceForAzureImpl("http://localhost:3000", null); private CoverageReporter() { } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/ApiVersionDefaultTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/ApiVersionDefaultTests.java index 13ca2858f3920..1c563f0a8cc3c 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/ApiVersionDefaultTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/ApiVersionDefaultTests.java @@ -5,8 +5,10 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + public class ApiVersionDefaultTests { - private static AutoRestAzureSpecialParametersTestClient client; + private static AutoRestAzureSpecialParametersTestClientImpl client; @BeforeClass public static void setup() { @@ -15,25 +17,25 @@ public static void setup() { @Test public void getMethodGlobalValid() throws Exception { - ServiceResponse response = client.getApiVersionDefaultOperations().getMethodGlobalValid(); + ServiceResponse response = client.apiVersionDefaults().getMethodGlobalValid(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void getMethodGlobalNotProvidedValid() throws Exception { - ServiceResponse response = client.getApiVersionDefaultOperations().getMethodGlobalNotProvidedValid(); + ServiceResponse response = client.apiVersionDefaults().getMethodGlobalNotProvidedValid(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void getPathGlobalValid() throws Exception { - ServiceResponse response = client.getApiVersionDefaultOperations().getPathGlobalValid(); + ServiceResponse response = client.apiVersionDefaults().getPathGlobalValid(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void getSwaggerGlobalValid() throws Exception { - ServiceResponse response = client.getApiVersionDefaultOperations().getSwaggerGlobalValid(); + ServiceResponse response = client.apiVersionDefaults().getSwaggerGlobalValid(); Assert.assertEquals(200, response.getResponse().code()); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/ApiVersionLocalTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/ApiVersionLocalTests.java index 0e400589ca4bc..299175d963155 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/ApiVersionLocalTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/ApiVersionLocalTests.java @@ -5,8 +5,10 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + public class ApiVersionLocalTests { - private static AutoRestAzureSpecialParametersTestClient client; + private static AutoRestAzureSpecialParametersTestClientImpl client; @BeforeClass public static void setup() { @@ -15,25 +17,25 @@ public static void setup() { @Test public void getMethodLocalValid() throws Exception { - ServiceResponse response = client.getApiVersionLocalOperations().getMethodLocalValid(); + ServiceResponse response = client.apiVersionLocals().getMethodLocalValid(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void getMethodGlobalNotProvidedValid() throws Exception { - ServiceResponse response = client.getApiVersionLocalOperations().getMethodLocalNull(null); + ServiceResponse response = client.apiVersionLocals().getMethodLocalNull(null); Assert.assertEquals(200, response.getResponse().code()); } @Test public void getPathGlobalValid() throws Exception { - ServiceResponse response = client.getApiVersionLocalOperations().getPathLocalValid(); + ServiceResponse response = client.apiVersionLocals().getPathLocalValid(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void getSwaggerGlobalValid() throws Exception { - ServiceResponse response = client.getApiVersionLocalOperations().getSwaggerLocalValid(); + ServiceResponse response = client.apiVersionLocals().getSwaggerLocalValid(); Assert.assertEquals(200, response.getResponse().code()); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/HeaderOperationsTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/HeaderOperationsTests.java index 5362f829bbbb5..48dd3b6cd538d 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/HeaderOperationsTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/HeaderOperationsTests.java @@ -1,6 +1,8 @@ package fixtures.azurespecials; import com.microsoft.rest.ServiceResponseWithHeaders; + +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; import fixtures.azurespecials.models.HeaderCustomNamedRequestIdHeaders; import fixtures.azurespecials.models.HeaderCustomNamedRequestIdParamGroupingHeaders; import fixtures.azurespecials.models.HeaderCustomNamedRequestIdParamGroupingParameters; @@ -9,7 +11,7 @@ import org.junit.Test; public class HeaderOperationsTests { - private static AutoRestAzureSpecialParametersTestClient client; + private static AutoRestAzureSpecialParametersTestClientImpl client; @BeforeClass public static void setup() { @@ -18,17 +20,17 @@ public static void setup() { @Test public void customNamedRequestId() throws Exception { - ServiceResponseWithHeaders response = client.getHeaderOperations().customNamedRequestId("9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); + ServiceResponseWithHeaders response = client.headers().customNamedRequestId("9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("123", response.getHeaders().getFooRequestId()); + Assert.assertEquals("123", response.getHeaders().fooRequestId()); } @Test public void customNamedRequestIdParamGrouping() throws Exception { HeaderCustomNamedRequestIdParamGroupingParameters group = new HeaderCustomNamedRequestIdParamGroupingParameters(); - group.setFooClientRequestId("9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); - ServiceResponseWithHeaders response = client.getHeaderOperations().customNamedRequestIdParamGrouping(group); + group.withFooClientRequestId("9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); + ServiceResponseWithHeaders response = client.headers().customNamedRequestIdParamGrouping(group); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("123", response.getHeaders().getFooRequestId()); + Assert.assertEquals("123", response.getHeaders().fooRequestId()); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SkipUrlEncodingTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SkipUrlEncodingTests.java index ecc46c3d6ca94..1ea7456cf0583 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SkipUrlEncodingTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SkipUrlEncodingTests.java @@ -1,10 +1,13 @@ package fixtures.azurespecials; import com.microsoft.rest.ServiceResponse; + import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + public class SkipUrlEncodingTests { private static final int OK_STATUS_CODE = 200; private static final int NOT_FOUND_STATUS_CODE = 404; @@ -13,11 +16,11 @@ public class SkipUrlEncodingTests { private static String unencodedPath = "path1/path2/path3"; private static String unencodedQuery = "value1&q2=value2&q3=value3"; - private static SkipUrlEncodingOperations client; + private static SkipUrlEncodings client; @BeforeClass public static void setup() { - client = new AutoRestAzureSpecialParametersTestClientImpl(baseUrl, null).getSkipUrlEncodingOperations(); + client = new AutoRestAzureSpecialParametersTestClientImpl(baseUrl, null).skipUrlEncodings(); } @Ignore("wait for this release -- https://github.com/square/retrofit/commit/2ea70568bd057fa9235ae5183cebbde1659af84d") diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SubscriptionInCredentialsTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SubscriptionInCredentialsTests.java index efc1c77f7fbd3..6a8397cf86fbe 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SubscriptionInCredentialsTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SubscriptionInCredentialsTests.java @@ -1,43 +1,53 @@ package fixtures.azurespecials; +import com.microsoft.azure.RequestIdHeaderInterceptor; +import com.microsoft.azure.RestClient; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.credentials.TokenCredentials; + import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import java.util.UUID; +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + public class SubscriptionInCredentialsTests { - private static AutoRestAzureSpecialParametersTestClient client; + private static AutoRestAzureSpecialParametersTestClientImpl client; @BeforeClass public static void setup() { - client = new AutoRestAzureSpecialParametersTestClientImpl("http://localhost:3000", new TokenCredentials(null, UUID.randomUUID().toString())); - client.setSubscriptionId("1234-5678-9012-3456"); + RestClient restClient = new RestClient.Builder() + .withBaseUrl("http://localhost:3000") + .withCredentials(new TokenCredentials(null, UUID.randomUUID().toString())) + .withInterceptor(new RequestIdHeaderInterceptor()) + .build(); + client = new AutoRestAzureSpecialParametersTestClientImpl(restClient); + client.withSubscriptionId("1234-5678-9012-3456"); } @Test public void postMethodGlobalValid() throws Exception { - ServiceResponse response = client.getSubscriptionInCredentialsOperations().postMethodGlobalValid(); + ServiceResponse response = client.subscriptionInCredentials().postMethodGlobalValid(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void postMethodGlobalNotProvidedValid() throws Exception { - ServiceResponse response = client.getSubscriptionInCredentialsOperations().postMethodGlobalNotProvidedValid(); + ServiceResponse response = client.subscriptionInCredentials().postMethodGlobalNotProvidedValid(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void postPathGlobalValid() throws Exception { - ServiceResponse response = client.getSubscriptionInCredentialsOperations().postPathGlobalValid(); + ServiceResponse response = client.subscriptionInCredentials().postPathGlobalValid(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void postSwaggerGlobalValid() throws Exception { - ServiceResponse response = client.getSubscriptionInCredentialsOperations().postSwaggerGlobalValid(); + ServiceResponse response = client.subscriptionInCredentials().postSwaggerGlobalValid(); Assert.assertEquals(200, response.getResponse().code()); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SubscriptionInMethodTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SubscriptionInMethodTests.java index dc7c0834fec0f..94a835318b306 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SubscriptionInMethodTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/SubscriptionInMethodTests.java @@ -1,34 +1,44 @@ package fixtures.azurespecials; +import com.microsoft.azure.RequestIdHeaderInterceptor; +import com.microsoft.azure.RestClient; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.credentials.TokenCredentials; + import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import java.util.UUID; +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + import static org.junit.Assert.fail; public class SubscriptionInMethodTests { - private static AutoRestAzureSpecialParametersTestClient client; + private static AutoRestAzureSpecialParametersTestClientImpl client; @BeforeClass public static void setup() { - client = new AutoRestAzureSpecialParametersTestClientImpl("http://localhost:3000", new TokenCredentials(null, UUID.randomUUID().toString())); - client.setSubscriptionId("1234-5678-9012-3456"); + RestClient restClient = new RestClient.Builder() + .withBaseUrl("http://localhost:3000") + .withCredentials(new TokenCredentials(null, UUID.randomUUID().toString())) + .withInterceptor(new RequestIdHeaderInterceptor()) + .build(); + client = new AutoRestAzureSpecialParametersTestClientImpl(restClient); + client.withSubscriptionId("1234-5678-9012-3456"); } @Test public void postMethodLocalValid() throws Exception { - ServiceResponse response = client.getSubscriptionInMethodOperations().postMethodLocalValid("1234-5678-9012-3456"); + ServiceResponse response = client.subscriptionInMethods().postMethodLocalValid("1234-5678-9012-3456"); Assert.assertEquals(200, response.getResponse().code()); } @Test public void postMethodLocalNull() throws Exception { try { - ServiceResponse response = client.getSubscriptionInMethodOperations().postMethodLocalNull(null); + ServiceResponse response = client.subscriptionInMethods().postMethodLocalNull(null); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter subscriptionId is required")); @@ -37,13 +47,13 @@ public void postMethodLocalNull() throws Exception { @Test public void postPathLocalValid() throws Exception { - ServiceResponse response = client.getSubscriptionInMethodOperations().postPathLocalValid("1234-5678-9012-3456"); + ServiceResponse response = client.subscriptionInMethods().postPathLocalValid("1234-5678-9012-3456"); Assert.assertEquals(200, response.getResponse().code()); } @Test public void postSwaggerLocalValid() throws Exception { - ServiceResponse response = client.getSubscriptionInMethodOperations().postSwaggerLocalValid("1234-5678-9012-3456"); + ServiceResponse response = client.subscriptionInMethods().postSwaggerLocalValid("1234-5678-9012-3456"); Assert.assertEquals(200, response.getResponse().code()); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/XMsClientRequestIdTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/XMsClientRequestIdTests.java index e0d1466a6d865..b01e7e721f936 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/XMsClientRequestIdTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/azurespecials/XMsClientRequestIdTests.java @@ -1,46 +1,38 @@ package fixtures.azurespecials; -import com.microsoft.azure.CustomHeaderInterceptor; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.credentials.TokenCredentials; -import okhttp3.Interceptor; + import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import java.util.UUID; +import fixtures.azurespecials.implementation.AutoRestAzureSpecialParametersTestClientImpl; + public class XMsClientRequestIdTests { - private static AutoRestAzureSpecialParametersTestClient client; + private static AutoRestAzureSpecialParametersTestClientImpl client; @BeforeClass public static void setup() { client = new AutoRestAzureSpecialParametersTestClientImpl("http://localhost:3000", new TokenCredentials(null, UUID.randomUUID().toString())); - client.setSubscriptionId("1234-5678-9012-3456"); + client.withSubscriptionId("1234-5678-9012-3456"); } @Test public void get() throws Exception { - for (Interceptor i : client.getClientInterceptors()) { - if (i instanceof CustomHeaderInterceptor) { - ((CustomHeaderInterceptor) i).removeHeader("x-ms-client-request-id"); - } - } - CustomHeaderInterceptor interceptor = new CustomHeaderInterceptor("x-ms-client-request-id", "9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); - client.getClientInterceptors().add(interceptor); - ServiceResponse response = client.getXMsClientRequestIdOperations().get(); - client.getClientInterceptors().remove(interceptor); + client.restClient().headers().removeHeader("x-ms-client-request-id"); + client.restClient().headers().addHeader("x-ms-client-request-id", "9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); + ServiceResponse response = client.xMsClientRequestIds().get(); + client.restClient().headers().removeHeader("x-ms-client-request-id"); Assert.assertEquals(200, response.getResponse().code()); } @Test public void paramGet() throws Exception { - for (Interceptor i : client.getClientInterceptors()) { - if (i instanceof CustomHeaderInterceptor) { - ((CustomHeaderInterceptor) i).removeHeader("x-ms-client-request-id"); - } - } - ServiceResponse response = client.getXMsClientRequestIdOperations().paramGet("9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); + client.restClient().headers().removeHeader("x-ms-client-request-id"); + ServiceResponse response = client.xMsClientRequestIds().paramGet("9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); Assert.assertEquals(200, response.getResponse().code()); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/head/HttpSuccessTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/head/HttpSuccessTests.java index 14a5145583958..74f07c15967ec 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/head/HttpSuccessTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/head/HttpSuccessTests.java @@ -4,8 +4,10 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.head.implementation.AutoRestHeadTestServiceImpl; + public class HttpSuccessTests { - private static AutoRestHeadTestService client; + private static AutoRestHeadTestServiceImpl client; @BeforeClass public static void setup() { @@ -14,16 +16,16 @@ public static void setup() { @Test public void head200() throws Exception { - Assert.assertTrue(client.getHttpSuccessOperations().head200().getBody()); + Assert.assertTrue(client.httpSuccess().head200().getBody()); } @Test public void head204() throws Exception { - Assert.assertTrue(client.getHttpSuccessOperations().head204().getBody()); + Assert.assertTrue(client.httpSuccess().head204().getBody()); } @Test public void head404() throws Exception { - Assert.assertFalse(client.getHttpSuccessOperations().head404().getBody()); + Assert.assertFalse(client.httpSuccess().head404().getBody()); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/headexceptions/HeadExceptionTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/headexceptions/HeadExceptionTests.java index e99bc8e667b24..6e6e741c2de00 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/headexceptions/HeadExceptionTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/headexceptions/HeadExceptionTests.java @@ -4,8 +4,10 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.headexceptions.implementation.AutoRestHeadExceptionTestServiceImpl; + public class HeadExceptionTests { - private static AutoRestHeadExceptionTestService client; + private static AutoRestHeadExceptionTestServiceImpl client; @BeforeClass public static void setup() { @@ -14,16 +16,16 @@ public static void setup() { @Test public void headException200() throws Exception { - client.getHeadExceptionOperations().head200(); + client.headExceptions().head200(); } @Test public void headException204() throws Exception { - client.getHeadExceptionOperations().head204(); + client.headExceptions().head204(); } @Test(expected = ServiceException.class) public void headException404() throws Exception { - client.getHeadExceptionOperations().head404(); + client.headExceptions().head404(); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LRORetrysTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LRORetrysTests.java index 6540a30494385..7258da351cf1d 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LRORetrysTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LRORetrysTests.java @@ -6,67 +6,68 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.lro.implementation.AutoRestLongRunningOperationTestServiceImpl; import fixtures.lro.models.Product; public class LRORetrysTests { - private static AutoRestLongRunningOperationTestService client; + private static AutoRestLongRunningOperationTestServiceImpl client; @BeforeClass public static void setup() { client = new AutoRestLongRunningOperationTestServiceImpl("http://localhost:3000", null); - client.getAzureClient().setLongRunningOperationRetryTimeout(0); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); } @Test public void put201CreatingSucceeded200() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLRORetrysOperations().put201CreatingSucceeded200(product); + product.withLocation("West US"); + ServiceResponse response = client.lRORetrys().put201CreatingSucceeded200(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void putAsyncRelativeRetrySucceeded() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLRORetrysOperations().putAsyncRelativeRetrySucceeded(product); + product.withLocation("West US"); + ServiceResponse response = client.lRORetrys().putAsyncRelativeRetrySucceeded(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void deleteProvisioning202Accepted200Succeeded() throws Exception { - ServiceResponse response = client.getLRORetrysOperations().deleteProvisioning202Accepted200Succeeded(); + ServiceResponse response = client.lRORetrys().deleteProvisioning202Accepted200Succeeded(); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void delete202Retry200() throws Exception { - ServiceResponse response = client.getLRORetrysOperations().delete202Retry200(); + ServiceResponse response = client.lRORetrys().delete202Retry200(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void deleteAsyncRelativeRetrySucceeded() throws Exception { - ServiceResponse response = client.getLRORetrysOperations().deleteAsyncRelativeRetrySucceeded(); + ServiceResponse response = client.lRORetrys().deleteAsyncRelativeRetrySucceeded(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void post202Retry200() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLRORetrysOperations().post202Retry200(product); + product.withLocation("West US"); + ServiceResponse response = client.lRORetrys().post202Retry200(product); Assert.assertEquals(200, response.getResponse().code()); } @Test public void postAsyncRelativeRetrySucceeded() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLRORetrysOperations().postAsyncRelativeRetrySucceeded(product); + product.withLocation("West US"); + ServiceResponse response = client.lRORetrys().postAsyncRelativeRetrySucceeded(product); Assert.assertEquals(200, response.getResponse().code()); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROSADsTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROSADsTests.java index e74c56ec19d2a..53f1ea6261025 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROSADsTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROSADsTests.java @@ -10,25 +10,26 @@ import java.net.MalformedURLException; +import fixtures.lro.implementation.AutoRestLongRunningOperationTestServiceImpl; import fixtures.lro.models.Product; import static org.junit.Assert.fail; public class LROSADsTests { - private static AutoRestLongRunningOperationTestService client; + private static AutoRestLongRunningOperationTestServiceImpl client; @BeforeClass public static void setup() { client = new AutoRestLongRunningOperationTestServiceImpl("http://localhost:3000", null); - client.getAzureClient().setLongRunningOperationRetryTimeout(0); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); } @Test public void putNonRetry400() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().putNonRetry400(product); + ServiceResponse response = client.lROSADs().putNonRetry400(product); fail(); } catch (CloudException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -38,9 +39,9 @@ public void putNonRetry400() throws Exception { @Test public void putNonRetry201Creating400() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().putNonRetry201Creating400(product); + ServiceResponse response = client.lROSADs().putNonRetry201Creating400(product); fail(); } catch (CloudException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -50,9 +51,9 @@ public void putNonRetry201Creating400() throws Exception { @Test public void putAsyncRelativeRetry400() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().putAsyncRelativeRetry400(product); + ServiceResponse response = client.lROSADs().putAsyncRelativeRetry400(product); fail(); } catch (CloudException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -62,7 +63,7 @@ public void putAsyncRelativeRetry400() throws Exception { @Test public void deleteNonRetry400() throws Exception { try { - ServiceResponse response = client.getLROSADsOperations().deleteNonRetry400(); + ServiceResponse response = client.lROSADs().deleteNonRetry400(); fail(); } catch (CloudException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -72,7 +73,7 @@ public void deleteNonRetry400() throws Exception { @Test public void delete202NonRetry400() throws Exception { try { - ServiceResponse response = client.getLROSADsOperations().delete202NonRetry400(); + ServiceResponse response = client.lROSADs().delete202NonRetry400(); fail(); } catch (CloudException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -82,7 +83,7 @@ public void delete202NonRetry400() throws Exception { @Test public void deleteAsyncRelativeRetry400() throws Exception { try { - ServiceResponse response = client.getLROSADsOperations().deleteAsyncRelativeRetry400(); + ServiceResponse response = client.lROSADs().deleteAsyncRelativeRetry400(); fail(); } catch (CloudException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -92,9 +93,9 @@ public void deleteAsyncRelativeRetry400() throws Exception { @Test public void postNonRetry400() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().postNonRetry400(product); + ServiceResponse response = client.lROSADs().postNonRetry400(product); fail(); } catch (CloudException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -104,9 +105,9 @@ public void postNonRetry400() throws Exception { @Test public void post202NonRetry400() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().post202NonRetry400(product); + ServiceResponse response = client.lROSADs().post202NonRetry400(product); fail(); } catch (CloudException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -116,9 +117,9 @@ public void post202NonRetry400() throws Exception { @Test public void postAsyncRelativeRetry400() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().postAsyncRelativeRetry400(product); + ServiceResponse response = client.lROSADs().postAsyncRelativeRetry400(product); fail(); } catch (CloudException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -128,9 +129,9 @@ public void postAsyncRelativeRetry400() throws Exception { @Test public void putError201NoProvisioningStatePayload() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().putError201NoProvisioningStatePayload(product); + ServiceResponse response = client.lROSADs().putError201NoProvisioningStatePayload(product); fail(); } catch (CloudException ex) { Assert.assertEquals(200, ex.getResponse().code()); @@ -141,9 +142,9 @@ public void putError201NoProvisioningStatePayload() throws Exception { @Test public void putAsyncRelativeRetryNoStatus() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().putAsyncRelativeRetryNoStatus(product); + ServiceResponse response = client.lROSADs().putAsyncRelativeRetryNoStatus(product); fail(); } catch (CloudException ex) { Assert.assertEquals(200, ex.getResponse().code()); @@ -154,9 +155,9 @@ public void putAsyncRelativeRetryNoStatus() throws Exception { @Test public void putAsyncRelativeRetryNoStatusPayload() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().putAsyncRelativeRetryNoStatusPayload(product); + ServiceResponse response = client.lROSADs().putAsyncRelativeRetryNoStatusPayload(product); fail(); } catch (CloudException ex) { Assert.assertEquals(200, ex.getResponse().code()); @@ -166,14 +167,14 @@ public void putAsyncRelativeRetryNoStatusPayload() throws Exception { @Test public void delete204Succeeded() throws Exception { - ServiceResponse response = client.getLROSADsOperations().delete204Succeeded(); + ServiceResponse response = client.lROSADs().delete204Succeeded(); Assert.assertEquals(204, response.getResponse().code()); } @Test public void deleteAsyncRelativeRetryNoStatus() throws Exception { try { - ServiceResponse response = client.getLROSADsOperations().deleteAsyncRelativeRetryNoStatus(); + ServiceResponse response = client.lROSADs().deleteAsyncRelativeRetryNoStatus(); fail(); } catch (CloudException ex) { Assert.assertEquals(200, ex.getResponse().code()); @@ -184,9 +185,9 @@ public void deleteAsyncRelativeRetryNoStatus() throws Exception { @Test public void post202NoLocation() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().post202NoLocation(product); + ServiceResponse response = client.lROSADs().post202NoLocation(product); fail(); } catch (CloudException ex) { Assert.assertEquals(202, ex.getResponse().code()); @@ -197,9 +198,9 @@ public void post202NoLocation() throws Exception { @Test public void postAsyncRelativeRetryNoPayload() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().postAsyncRelativeRetryNoPayload(product); + ServiceResponse response = client.lROSADs().postAsyncRelativeRetryNoPayload(product); fail(); } catch (CloudException ex) { Assert.assertEquals(200, ex.getResponse().code()); @@ -210,9 +211,9 @@ public void postAsyncRelativeRetryNoPayload() throws Exception { @Test public void put200InvalidJson() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().put200InvalidJson(product); + ServiceResponse response = client.lROSADs().put200InvalidJson(product); fail(); } catch (JsonParseException ex) { Assert.assertTrue(ex.getMessage().contains("Unexpected end-of-input")); @@ -222,9 +223,9 @@ public void put200InvalidJson() throws Exception { @Test public void putAsyncRelativeRetryInvalidHeader() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().putAsyncRelativeRetryInvalidHeader(product); + ServiceResponse response = client.lROSADs().putAsyncRelativeRetryInvalidHeader(product); fail(); } catch (MalformedURLException ex) { Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); @@ -234,9 +235,9 @@ public void putAsyncRelativeRetryInvalidHeader() throws Exception { @Test public void putAsyncRelativeRetryInvalidJsonPolling() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().putAsyncRelativeRetryInvalidJsonPolling(product); + ServiceResponse response = client.lROSADs().putAsyncRelativeRetryInvalidJsonPolling(product); fail(); } catch (JsonParseException ex) { Assert.assertTrue(ex.getMessage().contains("Unexpected end-of-input")); @@ -246,7 +247,7 @@ public void putAsyncRelativeRetryInvalidJsonPolling() throws Exception { @Test public void delete202RetryInvalidHeader() throws Exception { try { - ServiceResponse response = client.getLROSADsOperations().delete202RetryInvalidHeader(); + ServiceResponse response = client.lROSADs().delete202RetryInvalidHeader(); fail(); } catch (MalformedURLException ex) { Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); @@ -256,7 +257,7 @@ public void delete202RetryInvalidHeader() throws Exception { @Test public void deleteAsyncRelativeRetryInvalidHeader() throws Exception { try { - ServiceResponse response = client.getLROSADsOperations().deleteAsyncRelativeRetryInvalidHeader(); + ServiceResponse response = client.lROSADs().deleteAsyncRelativeRetryInvalidHeader(); fail(); } catch (MalformedURLException ex) { Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); @@ -266,7 +267,7 @@ public void deleteAsyncRelativeRetryInvalidHeader() throws Exception { @Test public void deleteAsyncRelativeRetryInvalidJsonPolling() throws Exception { try { - ServiceResponse response = client.getLROSADsOperations().deleteAsyncRelativeRetryInvalidJsonPolling(); + ServiceResponse response = client.lROSADs().deleteAsyncRelativeRetryInvalidJsonPolling(); fail(); } catch (JsonParseException ex) { Assert.assertTrue(ex.getMessage().contains("Unexpected end-of-input")); @@ -276,9 +277,9 @@ public void deleteAsyncRelativeRetryInvalidJsonPolling() throws Exception { @Test public void post202RetryInvalidHeader() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().post202RetryInvalidHeader(product); + ServiceResponse response = client.lROSADs().post202RetryInvalidHeader(product); fail(); } catch (MalformedURLException ex) { Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); @@ -288,9 +289,9 @@ public void post202RetryInvalidHeader() throws Exception { @Test public void postAsyncRelativeRetryInvalidHeader() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().postAsyncRelativeRetryInvalidHeader(product); + ServiceResponse response = client.lROSADs().postAsyncRelativeRetryInvalidHeader(product); fail(); } catch (MalformedURLException ex) { Assert.assertTrue(ex.getMessage().contains("no protocol: /foo")); @@ -300,9 +301,9 @@ public void postAsyncRelativeRetryInvalidHeader() throws Exception { @Test public void postAsyncRelativeRetryInvalidJsonPolling() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROSADsOperations().postAsyncRelativeRetryInvalidJsonPolling(product); + ServiceResponse response = client.lROSADs().postAsyncRelativeRetryInvalidJsonPolling(product); fail(); } catch (JsonParseException ex) { Assert.assertTrue(ex.getMessage().contains("Unexpected end-of-input")); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROsCustomHeaderTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROsCustomHeaderTests.java index c146da0a8dede..28b378c57b624 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROsCustomHeaderTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROsCustomHeaderTests.java @@ -8,68 +8,59 @@ import org.junit.BeforeClass; import org.junit.Test; -import java.util.HashMap; import java.util.Map; +import fixtures.lro.implementation.AutoRestLongRunningOperationTestServiceImpl; import fixtures.lro.models.Product; -import okhttp3.OkHttpClient; -import okhttp3.logging.HttpLoggingInterceptor; -import retrofit2.Retrofit; public class LROsCustomHeaderTests { - private static AutoRestLongRunningOperationTestService client; + private static AutoRestLongRunningOperationTestServiceImpl client; private static Map customHeaders; private static CustomHeaderInterceptor customHeaderInterceptor; @BeforeClass public static void setup() { - OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); - customHeaders = new HashMap<>(); - customHeaders.put("x-ms-client-request-id", "9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); - customHeaderInterceptor = new CustomHeaderInterceptor().addHeaderMap(customHeaders); - - client = new AutoRestLongRunningOperationTestServiceImpl("http://localhost:3000", null, clientBuilder, new Retrofit.Builder()); - client.getClientInterceptors().add(customHeaderInterceptor); - client.getAzureClient().setLongRunningOperationRetryTimeout(0); - client.setLogLevel(HttpLoggingInterceptor.Level.BODY); + client = new AutoRestLongRunningOperationTestServiceImpl("http://localhost:3000", null); + client.restClient().headers().addHeader("x-ms-client-request-id", "9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); } @AfterClass public static void cleanup() { - client.getClientInterceptors().remove(customHeaderInterceptor); + client.restClient().headers().removeHeader("x-ms-client-request-id"); } @Test public void putAsyncRetrySucceeded() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsCustomHeaderOperations().putAsyncRetrySucceeded(product); + product.withLocation("West US"); + ServiceResponse response = client.lROsCustomHeaders().putAsyncRetrySucceeded(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void put201CreatingSucceeded200() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsCustomHeaderOperations().put201CreatingSucceeded200(product); + product.withLocation("West US"); + ServiceResponse response = client.lROsCustomHeaders().put201CreatingSucceeded200(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void post202Retry200() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsCustomHeaderOperations().post202Retry200(product); + product.withLocation("West US"); + ServiceResponse response = client.lROsCustomHeaders().post202Retry200(product); Assert.assertEquals(200, response.getResponse().code()); } @Test public void postAsyncRetrySucceeded() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsCustomHeaderOperations().postAsyncRetrySucceeded(product); + product.withLocation("West US"); + ServiceResponse response = client.lROsCustomHeaders().postAsyncRetrySucceeded(product); Assert.assertEquals(200, response.getResponse().code()); } } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROsTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROsTests.java index 4991e4af329fe..41d54498867b2 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROsTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/lro/LROsTests.java @@ -3,6 +3,8 @@ import com.microsoft.azure.CloudException; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; + +import fixtures.lro.implementation.AutoRestLongRunningOperationTestServiceImpl; import fixtures.lro.models.Product; import fixtures.lro.models.Sku; import fixtures.lro.models.SubProduct; @@ -17,39 +19,39 @@ import static org.junit.Assert.fail; public class LROsTests { - private static AutoRestLongRunningOperationTestService client; + private static AutoRestLongRunningOperationTestServiceImpl client; @BeforeClass public static void setup() { client = new AutoRestLongRunningOperationTestServiceImpl("http://localhost:3000", null); - client.getAzureClient().setLongRunningOperationRetryTimeout(0); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); } @Test public void put200Succeeded() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().put200Succeeded(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put200Succeeded(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void put200SucceededNoState() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().put200SucceededNoState(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put200SucceededNoState(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("100", response.getBody().getId()); + Assert.assertEquals("100", response.getBody().id()); } @Test public void put202Retry200() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().put202Retry200(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put202Retry200(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("100", response.getBody().getId()); + Assert.assertEquals("100", response.getBody().id()); } @Ignore("Can cause flakiness - only run manually") @@ -58,9 +60,9 @@ public void put202Retry200Async() throws Exception { long startTime = System.currentTimeMillis(); final long[] callbackTime = new long[1]; Product product = new Product(); - product.setLocation("West US"); - client.getAzureClient().setLongRunningOperationRetryTimeout(1); - client.getLROsOperations().put202Retry200Async(product, new ServiceCallback() { + product.withLocation("West US"); + client.getAzureClient().withLongRunningOperationRetryTimeout(1); + client.lROs().put202Retry200Async(product, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -69,7 +71,7 @@ public void failure(Throwable t) { @Override public void success(ServiceResponse result) { Assert.assertEquals(200, result.getResponse().code()); - Assert.assertEquals("100", result.getBody().getId()); + Assert.assertEquals("100", result.getBody().id()); callbackTime[0] = System.currentTimeMillis(); lock.countDown(); } @@ -77,34 +79,34 @@ public void success(ServiceResponse result) { long endTime = System.currentTimeMillis(); Assert.assertTrue(500 > endTime - startTime); Assert.assertTrue(lock.await(3000, TimeUnit.MILLISECONDS)); - client.getAzureClient().setLongRunningOperationRetryTimeout(0); + client.getAzureClient().withLongRunningOperationRetryTimeout(0); Assert.assertTrue(1000 < callbackTime[0] - startTime); } @Test public void put201CreatingSucceeded200() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().put201CreatingSucceeded200(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put201CreatingSucceeded200(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void put200UpdatingSucceeded204() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().put200UpdatingSucceeded204(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().put200UpdatingSucceeded204(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void put201CreatingFailed200() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROsOperations().put201CreatingFailed200(product); + ServiceResponse response = client.lROs().put201CreatingFailed200(product); fail(); } catch (CloudException e) { Assert.assertEquals("Async operation failed", e.getMessage()); @@ -114,9 +116,9 @@ public void put201CreatingFailed200() throws Exception { @Test public void put200Acceptedcanceled200() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROsOperations().put200Acceptedcanceled200(product); + ServiceResponse response = client.lROs().put200Acceptedcanceled200(product); fail(); } catch (CloudException e) { Assert.assertEquals("Async operation failed", e.getMessage()); @@ -126,36 +128,36 @@ public void put200Acceptedcanceled200() throws Exception { @Test public void putNoHeaderInRetry() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().putNoHeaderInRetry(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().putNoHeaderInRetry(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void putAsyncRetrySucceeded() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().putAsyncRetrySucceeded(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().putAsyncRetrySucceeded(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void putAsyncNoRetrySucceeded() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().putAsyncNoRetrySucceeded(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().putAsyncNoRetrySucceeded(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void putAsyncRetryFailed() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROsOperations().putAsyncRetryFailed(product); + ServiceResponse response = client.lROs().putAsyncRetryFailed(product); fail(); } catch (CloudException e) { Assert.assertEquals("Async operation failed", e.getMessage()); @@ -165,9 +167,9 @@ public void putAsyncRetryFailed() throws Exception { @Test public void putAsyncNoRetrycanceled() throws Exception { Product product = new Product(); - product.setLocation("West US"); + product.withLocation("West US"); try { - ServiceResponse response = client.getLROsOperations().putAsyncNoRetrycanceled(product); + ServiceResponse response = client.lROs().putAsyncNoRetrycanceled(product); fail(); } catch (CloudException e) { Assert.assertEquals("Async operation failed", e.getMessage()); @@ -177,111 +179,111 @@ public void putAsyncNoRetrycanceled() throws Exception { @Test public void putAsyncNoHeaderInRetry() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().putAsyncNoHeaderInRetry(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().putAsyncNoHeaderInRetry(product); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void putNonResource() throws Exception { Sku sku = new Sku(); - ServiceResponse response = client.getLROsOperations().putNonResource(sku); + ServiceResponse response = client.lROs().putNonResource(sku); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("100", response.getBody().getId()); + Assert.assertEquals("100", response.getBody().id()); } @Test public void putAsyncNonResource() throws Exception { Sku sku = new Sku(); - ServiceResponse response = client.getLROsOperations().putAsyncNonResource(sku); + ServiceResponse response = client.lROs().putAsyncNonResource(sku); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("100", response.getBody().getId()); + Assert.assertEquals("100", response.getBody().id()); } @Test public void putSubResource() throws Exception { SubProduct subProduct = new SubProduct(); - ServiceResponse response = client.getLROsOperations().putSubResource(subProduct); + ServiceResponse response = client.lROs().putSubResource(subProduct); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void putAsyncSubResource() throws Exception { SubProduct subProduct = new SubProduct(); - ServiceResponse response = client.getLROsOperations().putAsyncSubResource(subProduct); + ServiceResponse response = client.lROs().putAsyncSubResource(subProduct); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void deleteProvisioning202Accepted200Succeeded() throws Exception { - ServiceResponse response = client.getLROsOperations().deleteProvisioning202Accepted200Succeeded(); + ServiceResponse response = client.lROs().deleteProvisioning202Accepted200Succeeded(); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Succeeded", response.getBody().getProvisioningState()); + Assert.assertEquals("Succeeded", response.getBody().provisioningState()); } @Test public void deleteProvisioning202DeletingFailed200() throws Exception { - ServiceResponse response = client.getLROsOperations().deleteProvisioning202DeletingFailed200(); + ServiceResponse response = client.lROs().deleteProvisioning202DeletingFailed200(); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Failed", response.getBody().getProvisioningState()); + Assert.assertEquals("Failed", response.getBody().provisioningState()); } @Test public void deleteProvisioning202Deletingcanceled200() throws Exception { - ServiceResponse response = client.getLROsOperations().deleteProvisioning202Deletingcanceled200(); + ServiceResponse response = client.lROs().deleteProvisioning202Deletingcanceled200(); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("Canceled", response.getBody().getProvisioningState()); + Assert.assertEquals("Canceled", response.getBody().provisioningState()); } @Test public void delete204Succeeded() throws Exception { - ServiceResponse response = client.getLROsOperations().delete204Succeeded(); + ServiceResponse response = client.lROs().delete204Succeeded(); Assert.assertEquals(204, response.getResponse().code()); } @Test public void delete202Retry200() throws Exception { - ServiceResponse response = client.getLROsOperations().delete202Retry200(); + ServiceResponse response = client.lROs().delete202Retry200(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void delete202NoRetry204() throws Exception { - ServiceResponse response = client.getLROsOperations().delete202NoRetry204(); + ServiceResponse response = client.lROs().delete202NoRetry204(); Assert.assertEquals(204, response.getResponse().code()); } @Test public void deleteNoHeaderInRetry() throws Exception { - ServiceResponse response = client.getLROsOperations().deleteNoHeaderInRetry(); + ServiceResponse response = client.lROs().deleteNoHeaderInRetry(); Assert.assertEquals(204, response.getResponse().code()); } @Test public void deleteAsyncNoHeaderInRetry() throws Exception { - ServiceResponse response = client.getLROsOperations().deleteAsyncNoHeaderInRetry(); + ServiceResponse response = client.lROs().deleteAsyncNoHeaderInRetry(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void deleteAsyncRetrySucceeded() throws Exception { - ServiceResponse response = client.getLROsOperations().deleteAsyncRetrySucceeded(); + ServiceResponse response = client.lROs().deleteAsyncRetrySucceeded(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void deleteAsyncNoRetrySucceeded() throws Exception { - ServiceResponse response = client.getLROsOperations().deleteAsyncNoRetrySucceeded(); + ServiceResponse response = client.lROs().deleteAsyncNoRetrySucceeded(); Assert.assertEquals(200, response.getResponse().code()); } @Test public void deleteAsyncRetryFailed() throws Exception { try { - ServiceResponse response = client.getLROsOperations().deleteAsyncRetryFailed(); + ServiceResponse response = client.lROs().deleteAsyncRetryFailed(); fail(); } catch (CloudException e) { Assert.assertEquals("Async operation failed", e.getMessage()); @@ -291,7 +293,7 @@ public void deleteAsyncRetryFailed() throws Exception { @Test public void deleteAsyncRetrycanceled() throws Exception { try { - ServiceResponse response = client.getLROsOperations().deleteAsyncRetrycanceled(); + ServiceResponse response = client.lROs().deleteAsyncRetrycanceled(); fail(); } catch (CloudException e) { Assert.assertEquals("Async operation failed", e.getMessage()); @@ -300,40 +302,40 @@ public void deleteAsyncRetrycanceled() throws Exception { @Test public void post200WithPayload() throws Exception { - ServiceResponse response = client.getLROsOperations().post200WithPayload(); + ServiceResponse response = client.lROs().post200WithPayload(); Assert.assertEquals(200, response.getResponse().code()); - Assert.assertEquals("1", response.getBody().getId()); + Assert.assertEquals("1", response.getBody().id()); } @Test public void post202Retry200() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().post202Retry200(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().post202Retry200(product); Assert.assertEquals(200, response.getResponse().code()); } @Test public void post202NoRetry204() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().post202NoRetry204(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().post202NoRetry204(product); Assert.assertEquals(204, response.getResponse().code()); } @Test public void postAsyncRetrySucceeded() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().postAsyncRetrySucceeded(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().postAsyncRetrySucceeded(product); Assert.assertEquals(200, response.getResponse().code()); } @Test public void postAsyncNoRetrySucceeded() throws Exception { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().postAsyncNoRetrySucceeded(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().postAsyncNoRetrySucceeded(product); Assert.assertEquals(200, response.getResponse().code()); } @@ -341,8 +343,8 @@ public void postAsyncNoRetrySucceeded() throws Exception { public void postAsyncRetryFailed() throws Exception { try { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().postAsyncRetryFailed(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().postAsyncRetryFailed(product); fail(); } catch (CloudException e) { Assert.assertEquals("Async operation failed", e.getMessage()); @@ -353,8 +355,8 @@ public void postAsyncRetryFailed() throws Exception { public void postAsyncRetrycanceled() throws Exception { try { Product product = new Product(); - product.setLocation("West US"); - ServiceResponse response = client.getLROsOperations().postAsyncRetrycanceled(product); + product.withLocation("West US"); + ServiceResponse response = client.lROs().postAsyncRetrycanceled(product); fail(); } catch (CloudException e) { Assert.assertEquals("Async operation failed", e.getMessage()); diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/paging/PagingTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/paging/PagingTests.java index 1d8a1b9ec098b..b1c6f223e95bd 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/paging/PagingTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/paging/PagingTests.java @@ -4,8 +4,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.rest.ServiceResponse; +import fixtures.paging.implementation.AutoRestPagingTestServiceImpl; import fixtures.paging.models.ProductProperties; -import okhttp3.logging.HttpLoggingInterceptor; import fixtures.paging.models.PagingGetMultiplePagesWithOffsetOptions; import fixtures.paging.models.Product; import org.junit.Assert; @@ -21,29 +21,28 @@ import static org.junit.Assert.fail; public class PagingTests { - private static AutoRestPagingTestService client; + private static AutoRestPagingTestServiceImpl client; @BeforeClass public static void setup() { client = new AutoRestPagingTestServiceImpl("http://localhost:3000", null); - client.setLogLevel(HttpLoggingInterceptor.Level.BASIC); } @Test public void getSinglePages() throws Exception { - List response = client.getPagingOperations().getSinglePages().getBody(); + List response = client.pagings().getSinglePages().getBody(); Assert.assertEquals(1, response.size()); } @Test public void getMultiplePages() throws Exception { - List response = client.getPagingOperations().getMultiplePages().getBody(); + List response = client.pagings().getMultiplePages().getBody(); Product p1 = new Product(); - p1.setProperties(new ProductProperties()); + p1.withProperties(new ProductProperties()); response.add(p1); response.get(3); Product p4 = new Product(); - p4.setProperties(new ProductProperties()); + p4.withProperties(new ProductProperties()); response.add(p4); int i = 0; for (Product p : response) { @@ -59,23 +58,23 @@ public void getMultiplePages() throws Exception { @Test public void getOdataMultiplePages() throws Exception { - List response = client.getPagingOperations().getOdataMultiplePages().getBody(); + List response = client.pagings().getOdataMultiplePages().getBody(); Assert.assertEquals(10, response.size()); } @Test public void getMultiplePagesWithOffset() throws Exception { PagingGetMultiplePagesWithOffsetOptions options = new PagingGetMultiplePagesWithOffsetOptions(); - options.setOffset(100); - List response = client.getPagingOperations().getMultiplePagesWithOffset(options, "client-id").getBody(); + options.withOffset(100); + List response = client.pagings().getMultiplePagesWithOffset(options, "client-id").getBody(); Assert.assertEquals(10, response.size()); - Assert.assertEquals(110, (int) response.get(response.size() - 1).getProperties().getId()); + Assert.assertEquals(110, (int) response.get(response.size() - 1).properties().id()); } @Test public void getMultiplePagesAsync() throws Exception { final CountDownLatch lock = new CountDownLatch(1); - client.getPagingOperations().getMultiplePagesAsync("client-id", null, new ListOperationCallback() { + client.pagings().getMultiplePagesAsync("client-id", null, new ListOperationCallback() { @Override public void failure(Throwable t) { fail(); @@ -100,20 +99,20 @@ public PagingBahavior progress(List partial) { @Test public void getMultiplePagesRetryFirst() throws Exception { - List response = client.getPagingOperations().getMultiplePagesRetryFirst().getBody(); + List response = client.pagings().getMultiplePagesRetryFirst().getBody(); Assert.assertEquals(10, response.size()); } @Test public void getMultiplePagesRetrySecond() throws Exception { - List response = client.getPagingOperations().getMultiplePagesRetrySecond().getBody(); + List response = client.pagings().getMultiplePagesRetrySecond().getBody(); Assert.assertEquals(10, response.size()); } @Test public void getSinglePagesFailure() throws Exception { try { - List response = client.getPagingOperations().getSinglePagesFailure().getBody(); + List response = client.pagings().getSinglePagesFailure().getBody(); fail(); } catch (CloudException ex) { Assert.assertNotNull(ex.getResponse()); @@ -123,7 +122,7 @@ public void getSinglePagesFailure() throws Exception { @Test public void getMultiplePagesFailure() throws Exception { try { - List response = client.getPagingOperations().getMultiplePagesFailure().getBody(); + List response = client.pagings().getMultiplePagesFailure().getBody(); response.size(); fail(); } catch (WebServiceException ex) { @@ -134,7 +133,7 @@ public void getMultiplePagesFailure() throws Exception { @Test public void getMultiplePagesFailureUri() throws Exception { try { - List response = client.getPagingOperations().getMultiplePagesFailureUri().getBody(); + List response = client.pagings().getMultiplePagesFailureUri().getBody(); response.size(); fail(); } catch (WebServiceException ex) { diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/subscriptionidapiversion/GroupTests.java b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/subscriptionidapiversion/GroupTests.java index a89d7875976b8..d3bbc9e544f76 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/subscriptionidapiversion/GroupTests.java +++ b/AutoRest/Generators/Java/Azure.Java.Tests/src/test/java/fixtures/subscriptionidapiversion/GroupTests.java @@ -1,5 +1,6 @@ package fixtures.subscriptionidapiversion; +import fixtures.subscriptionidapiversion.implementation.MicrosoftAzureTestUrlImpl; import fixtures.subscriptionidapiversion.models.SampleResourceGroup; import org.junit.Assert; import org.junit.BeforeClass; @@ -8,7 +9,7 @@ import java.util.UUID; public class GroupTests { - private static MicrosoftAzureTestUrl client; + private static MicrosoftAzureTestUrlImpl client; @BeforeClass public static void setup() { @@ -17,9 +18,9 @@ public static void setup() { @Test public void getSampleResourceGroup() throws Exception { - client.setSubscriptionId(UUID.randomUUID().toString()); - SampleResourceGroup group = client.getGroupOperations().getSampleResourceGroup("testgroup101").getBody(); - Assert.assertEquals("testgroup101", group.getName()); - Assert.assertEquals("West US", group.getLocation()); + client.withSubscriptionId(UUID.randomUUID().toString()); + SampleResourceGroup group = client.groups().getSampleResourceGroup("testgroup101").getBody(); + Assert.assertEquals("testgroup101", group.name()); + Assert.assertEquals("West US", group.location()); } } diff --git a/AutoRest/Generators/Java/Azure.Java/AutoRest.Generator.Azure.Java.csproj b/AutoRest/Generators/Java/Azure.Java/AutoRest.Generator.Azure.Java.csproj index 3047a09afadb8..e7651d8ceb8c3 100644 --- a/AutoRest/Generators/Java/Azure.Java/AutoRest.Generator.Azure.Java.csproj +++ b/AutoRest/Generators/Java/Azure.Java/AutoRest.Generator.Azure.Java.csproj @@ -41,7 +41,11 @@ + + + AzureMethodGroupInterfaceTemplate.cshtml + AzureMethodGroupTemplate.cshtml @@ -54,9 +58,6 @@ AzureServiceClientTemplate.cshtml - - AzureMethodGroupInterfaceTemplate.cshtml - AzureMethodGroupRetrofitTemplate.cshtml @@ -66,6 +67,7 @@ AzureServiceClientRetrofitTemplate.cshtml + @@ -99,11 +101,11 @@ + - diff --git a/AutoRest/Generators/Java/Azure.Java/AzureJavaCodeGenerator.cs b/AutoRest/Generators/Java/Azure.Java/AzureJavaCodeGenerator.cs index 45e4651a69e84..94a00bc9fb714 100644 --- a/AutoRest/Generators/Java/Azure.Java/AzureJavaCodeGenerator.cs +++ b/AutoRest/Generators/Java/Azure.Java/AzureJavaCodeGenerator.cs @@ -17,7 +17,6 @@ namespace Microsoft.Rest.Generator.Java.Azure public class AzureJavaCodeGenerator : JavaCodeGenerator { private readonly AzureJavaCodeNamer _namer; - private const string ClientRuntimePackage = "com.microsoft.rest:azure-client-runtime:1.0.0-SNAPSHOT from snapshot repo http://adxsnapshots.azurewebsites.net/"; private const string _packageInfoFileName = "package-info.java"; @@ -50,18 +49,25 @@ public override string UsageInstructions } } - public override string ImplementationFileExtension - { - get { return ".cs"; } - } - ///

/// Normalizes client model by updating names and types to be language specific. /// /// public override void NormalizeClientModel(ServiceClient serviceClient) { - AzureExtensions.NormalizeAzureClientModel(serviceClient, Settings, _namer); + Settings.AddCredentials = true; + + // This extension from general extensions must be run prior to Azure specific extensions. + AzureExtensions.ProcessParameterizedHost(serviceClient, Settings); + AzureExtensions.ProcessClientRequestIdExtension(serviceClient); + AzureExtensions.UpdateHeadMethods(serviceClient); + AzureExtensions.FlattenModels(serviceClient); + AzureExtensions.FlattenMethodParameters(serviceClient, Settings); + ParameterGroupExtensionHelper.AddParameterGroups(serviceClient); + AzureExtensions.AddLongRunningOperations(serviceClient); + AzureExtensions.AddAzureProperties(serviceClient); + AzureExtensions.SetDefaultResponses(serviceClient); + AzureExtensions.AddPageableMethod(serviceClient, _namer); _namer.NormalizeClientModel(serviceClient); _namer.ResolveNameCollisions(serviceClient, Settings.Namespace, Settings.Namespace + ".Models"); @@ -81,7 +87,7 @@ public override async Task Generate(ServiceClient serviceClient) { Model = serviceClientTemplateModel, }; - await Write(serviceClientTemplate, serviceClient.Name.ToPascalCase() + "Impl.java"); + await Write(serviceClientTemplate, Path.Combine("implementation", serviceClient.Name.ToPascalCase() + "Impl.java")); var serviceClientInterfaceTemplate = new AzureServiceClientInterfaceTemplate { @@ -118,7 +124,7 @@ public override async Task Generate(ServiceClient serviceClient) { Model = (AzureMethodGroupTemplateModel)methodGroupModel }; - await Write(methodGroupTemplate, methodGroupModel.MethodGroupType.ToPascalCase() + "Impl.java"); + await Write(methodGroupTemplate, Path.Combine("implementation", methodGroupModel.MethodGroupType.ToPascalCase() + "Impl.java")); var methodGroupInterfaceTemplate = new AzureMethodGroupInterfaceTemplate { Model = (AzureMethodGroupTemplateModel)methodGroupModel @@ -169,7 +175,11 @@ await Write(new PackageInfoTemplate }, _packageInfoFileName); await Write(new PackageInfoTemplate { - Model = new PackageInfoTemplateModel(serviceClient, serviceClient.Name, true) + Model = new PackageInfoTemplateModel(serviceClient, serviceClient.Name, "implementation") + }, Path.Combine("implementation", _packageInfoFileName)); + await Write(new PackageInfoTemplate + { + Model = new PackageInfoTemplateModel(serviceClient, serviceClient.Name, "models") }, Path.Combine("models", _packageInfoFileName)); } } diff --git a/AutoRest/Generators/Java/Azure.Java/AzureJavaCodeNamer.cs b/AutoRest/Generators/Java/Azure.Java/AzureJavaCodeNamer.cs index 6051c60ba5672..e31261a74e6fd 100644 --- a/AutoRest/Generators/Java/Azure.Java/AzureJavaCodeNamer.cs +++ b/AutoRest/Generators/Java/Azure.Java/AzureJavaCodeNamer.cs @@ -91,10 +91,11 @@ public virtual void NormalizePaginatedMethods(ServiceClient serviceClient, IDict if (sequenceType != null) { ITypeModel pagedResult; - pagedResult = new SequenceTypeModel + pagedResult = new AzureSequenceTypeModel { ElementType = sequenceType.ElementType, - NameFormat = "List<{0}>" + NameFormat = "List<{0}>", + PageImplType = pageClassName }; convertedTypes[(ITypeModel)method.Responses[responseStatus].Body] = pagedResult; diff --git a/AutoRest/Generators/Java/Azure.Java/GlobalSuppressions.cs b/AutoRest/Generators/Java/Azure.Java/GlobalSuppressions.cs index 1af18a4d3b35f..aa4aeea124e80 100644 --- a/AutoRest/Generators/Java/Azure.Java/GlobalSuppressions.cs +++ b/AutoRest/Generators/Java/Azure.Java/GlobalSuppressions.cs @@ -54,3 +54,12 @@ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "getNextPageLink", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel.#SuccessCallback(System.Boolean)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ListOperationCallback", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel.#SuccessCallback(System.Boolean)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Rest.Generator.Utilities.IndentedStringBuilder.AppendLine(System.String)", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel.#TransformPagingGroupedParameter(Microsoft.Rest.Generator.Utilities.IndentedStringBuilder,Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel.#.ctor(Microsoft.Rest.Generator.ClientModel.Method,Microsoft.Rest.Generator.ClientModel.ServiceClient)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureJavaCodeNamer.#NormalizeTopLevelTypes(Microsoft.Rest.Generator.ClientModel.ServiceClient)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureMethodGroupTemplateModel.#ImplImports")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureServiceClientTemplateModel.#ImplImports")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureSequenceTypeModel.#_azureRuntimePackage")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel.#TransformPagingGroupedParameter(Microsoft.Rest.Generator.Utilities.IndentedStringBuilder,Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel.#TransformPagingGroupedParameter(Microsoft.Rest.Generator.Utilities.IndentedStringBuilder,Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel.#TransformPagingGroupedParameter(Microsoft.Rest.Generator.Utilities.IndentedStringBuilder,Microsoft.Rest.Generator.Java.Azure.AzureMethodTemplateModel,System.Boolean)")] + diff --git a/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureEnumTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureEnumTemplateModel.cs new file mode 100644 index 0000000000000..c52a9d9a39b18 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureEnumTemplateModel.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Rest.Generator.ClientModel; +using Microsoft.Rest.Generator.Utilities; + +namespace Microsoft.Rest.Generator.Java.Azure +{ + public class AzureEnumTemplateModel : EnumTemplateModel + { + public AzureEnumTemplateModel(EnumType source) + : base(source) + { + } + + public override string ModelsPackage + { + get + { + return ".models"; + } + } + } +} \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureMethodGroupTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureMethodGroupTemplateModel.cs index 876d3f823c24f..20f72b48698ce 100644 --- a/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureMethodGroupTemplateModel.cs +++ b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureMethodGroupTemplateModel.cs @@ -8,6 +8,7 @@ using Microsoft.Rest.Generator.Azure; using Microsoft.Rest.Generator.ClientModel; using Microsoft.Rest.Generator.Utilities; +using System.Globalization; namespace Microsoft.Rest.Generator.Java.Azure { diff --git a/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureMethodTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureMethodTemplateModel.cs index 6a295aa2123e8..af8d77bc215f2 100644 --- a/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureMethodTemplateModel.cs +++ b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureMethodTemplateModel.cs @@ -16,6 +16,7 @@ namespace Microsoft.Rest.Generator.Java.Azure { public class AzureMethodTemplateModel : MethodTemplateModel { + private AzureJavaCodeNamer _namer; private AzureResponseModel _returnTypeModel; private Dictionary _responseModels; private string pageClassName; @@ -30,6 +31,7 @@ public AzureMethodTemplateModel(Method source, ServiceClient serviceClient) this.ClientRequestIdString = AzureExtensions.GetClientRequestIdString(source); this.RequestIdString = AzureExtensions.GetRequestIdString(source); + _namer = new AzureJavaCodeNamer(serviceClient.Namespace); _returnTypeModel = new AzureResponseModel(ReturnType, this); _responseModels = new Dictionary(); Responses.ForEach(r => _responseModels.Add(r.Key, new AzureResponseModel(r.Value, this))); @@ -105,7 +107,35 @@ public override string OperationExceptionTypeString { return "CloudException"; } - return base.OperationExceptionTypeString; + else if (this.DefaultResponse.Body is CompositeType) + { + CompositeType type = this.DefaultResponse.Body as CompositeType; + return new AzureModelTemplateModel(type, ServiceClient).ExceptionTypeDefinitionName; + } + else + { + return "ServiceException"; + } + } + } + + public override IEnumerable RetrofitParameters + { + get + { + List parameters = base.RetrofitParameters.ToList(); + parameters.Add(new ParameterModel(new Parameter + { + Name = Group == null ? "this.userAgent()" : "this.client.userAgent()", + SerializedName = "User-Agent", + Location = ParameterLocation.Header, + Type = new PrimaryTypeModel(KnownPrimaryType.String), + ClientProperty = new PropertyModel(new Property + { + Name = "userAgent" + }, ServiceClient.Namespace) + }, this)); + return parameters; } } @@ -244,6 +274,15 @@ public override string MethodRequiredParameterInvocationWithCallback } } + public override bool IsParameterizedHost + { + get + { + return ServiceClient.Extensions.ContainsKey(Generator.Extensions.ParameterizedHostExtension) + && !IsPagingNextOperation; + } + } + public override IEnumerable Exceptions { get @@ -342,9 +381,10 @@ public override string ResponseGeneration(bool filterRequired = false) } else if (this.IsPagingNonPollingOperation) { + var returnTypeBody = ReturnType.Body as AzureSequenceTypeModel; var builder = new IndentedStringBuilder(); - builder.AppendLine("{0}<{3}<{1}>> response = {2}Delegate(call.execute());", - ReturnTypeModel.ClientResponseType, ((SequenceType)ReturnType.Body).ElementType.Name, this.Name.ToCamelCase(), pageClassName); + builder.AppendLine("{0}<{1}<{2}>> response = {3}Delegate(call.execute());", + ReturnTypeModel.ClientResponseType, returnTypeBody.PageImplType, returnTypeBody.ElementType.Name, this.Name.ToCamelCase()); builder.AppendLine("{0} result = response.getBody().getItems();", this.ReturnType.Body.Name); return builder.ToString(); } @@ -432,9 +472,10 @@ public override string SuccessCallback(bool filterRequired = false) } else if (this.IsPagingNonPollingOperation) { + var returnTypeBody = ReturnType.Body as AzureSequenceTypeModel; var builder = new IndentedStringBuilder(); - builder.AppendLine("{0}<{3}<{1}>> result = {2}Delegate(response);", - ReturnTypeModel.ClientResponseType, ((SequenceType)ReturnType.Body).ElementType.Name, this.Name.ToCamelCase(), pageClassName); + builder.AppendLine("{0}<{1}<{2}>> result = {3}Delegate(response);", + ReturnTypeModel.ClientResponseType, returnTypeBody.PageImplType, returnTypeBody.ElementType.Name, this.Name.ToCamelCase()); if (ReturnType.Headers == null) { builder.AppendLine("serviceCallback.success(new {0}<>(result.getBody().getItems(), result.getResponse()));", ReturnTypeModel.ClientResponseType); @@ -451,16 +492,12 @@ public override string SuccessCallback(bool filterRequired = false) private AzureMethodTemplateModel GetPagingNextMethod(out string invocation, bool async = false) { string name = ((string)this.Extensions["nextMethodName"]).ToCamelCase(); - string group = (string)this.Extensions["nextMethodGroup"]; + string group = _namer.GetMethodGroupName((string)this.Extensions["nextMethodGroup"]); var methodModel = new AzureMethodTemplateModel( ServiceClient.Methods.FirstOrDefault(m => - group == null ? m.Group == null : group.Equals(m.Group, StringComparison.OrdinalIgnoreCase) + (group == null ? m.Group == null : group.Equals(m.Group, StringComparison.OrdinalIgnoreCase)) && m.Name.Equals(name, StringComparison.OrdinalIgnoreCase)), ServiceClient); group = group.ToPascalCase(); - if (group != null) - { - group += "Operations"; - } if (async) { name = name + "Async"; @@ -476,7 +513,7 @@ private AzureMethodTemplateModel GetPagingNextMethod(out string invocation, bool return methodModel; } - private void TransformPagingGroupedParameter(IndentedStringBuilder builder, AzureMethodTemplateModel nextMethod, bool filterRequired = false) + protected virtual void TransformPagingGroupedParameter(IndentedStringBuilder builder, AzureMethodTemplateModel nextMethod, bool filterRequired = false) { if (this.InputParameterTransformation.IsNullOrEmpty()) { @@ -488,24 +525,25 @@ private void TransformPagingGroupedParameter(IndentedStringBuilder builder, Azur { return; } + var nextGroupTypeName = _namer.GetTypeName(nextGroupType.Name); if (filterRequired && !nextGroupType.IsRequired) { return; } if (!groupedType.IsRequired) { - builder.AppendLine("{0} {1} = null;", nextGroupType.Name.ToPascalCase(), nextGroupType.Name.ToCamelCase()); + builder.AppendLine("{0} {1} = null;", nextGroupTypeName, nextGroupType.Name.ToCamelCase()); builder.AppendLine("if ({0} != null) {{", groupedType.Name.ToCamelCase()); builder.Indent(); - builder.AppendLine("{0} = new {1}();", nextGroupType.Name.ToCamelCase(), nextGroupType.Name.ToPascalCase()); + builder.AppendLine("{0} = new {1}();", nextGroupType.Name.ToCamelCase(), nextGroupTypeName); } else - { - builder.AppendLine("{1} {0} = new {1}();", nextGroupType.Name.ToCamelCase(), nextGroupType.Name.ToPascalCase()); + { + builder.AppendLine("{1} {0} = new {1}();", nextGroupType.Name.ToCamelCase(), nextGroupTypeName); } foreach (var outParam in nextMethod.InputParameterTransformation.Select(t => t.OutputParameter)) { - builder.AppendLine("{0}.set{1}({2}.get{1}());", nextGroupType.Name.ToCamelCase(), outParam.Name.ToPascalCase(), groupedType.Name.ToCamelCase()); + builder.AppendLine("{0}.with{1}({2}.{3}());", nextGroupType.Name.ToCamelCase(), outParam.Name.ToPascalCase(), groupedType.Name.ToCamelCase(), outParam.Name.ToCamelCase()); } if (!groupedType.IsRequired) { @@ -575,7 +613,7 @@ public override List ImplImports imports.Remove("com.microsoft.rest.ServiceResponseCallback"); imports.Remove("com.microsoft.azure.AzureServiceResponseBuilder"); imports.Add("retrofit2.Callback"); - this.Responses.Select(r => r.Value.Body).Concat(new IType[]{ DefaultResponse.Body }) + this.Responses.Select(r => r.Value.Body).Concat(new IType[] { DefaultResponse.Body }) .SelectMany(t => t.ImportSafe()) .Where(i => !this.Parameters.Any(p => p.Type.ImportSafe().Contains(i))) .ForEach(i => imports.Remove(i)); @@ -588,7 +626,7 @@ public override List ImplImports imports.Add("com.microsoft.azure.ListOperationCallback"); imports.Add("com.microsoft.azure.Page"); imports.Add("com.microsoft.azure.PagedList"); - imports.AddRange(new CompositeTypeModel(ServiceClient.Namespace) { Name = pageClassName }.ImportSafe()); + imports.AddRange(new CompositeTypeModel(ServiceClient.Namespace) { Name = ((AzureSequenceTypeModel)ReturnTypeModel.BodyClientType).PageImplType }.ImportSafe()); } if (this.IsPagingNextOperation) { @@ -597,7 +635,7 @@ public override List ImplImports } if (this.IsPagingNonPollingOperation) { - imports.AddRange(new CompositeTypeModel(ServiceClient.Namespace) { Name = pageClassName }.ImportSafe()); + imports.AddRange(new CompositeTypeModel(ServiceClient.Namespace) { Name = ((AzureSequenceTypeModel)ReturnTypeModel.BodyClientType).PageImplType }.ImportSafe()); } return imports; } diff --git a/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureModelTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureModelTemplateModel.cs index b1599747f1d74..51b59e5d94e06 100644 --- a/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureModelTemplateModel.cs +++ b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureModelTemplateModel.cs @@ -29,6 +29,22 @@ protected override JavaCodeNamer Namer } } + public override string ExceptionTypeDefinitionName + { + get + { + if (this.Extensions.ContainsKey(Microsoft.Rest.Generator.Extensions.NameOverrideExtension)) + { + var ext = this.Extensions[Microsoft.Rest.Generator.Extensions.NameOverrideExtension] as Newtonsoft.Json.Linq.JContainer; + if (ext != null && ext["name"] != null) + { + return ext["name"].ToString(); + } + } + return this.Name + "Exception"; + } + } + public override IEnumerable ImportList { get { diff --git a/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureServiceClientTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureServiceClientTemplateModel.cs index 4d5bf57b8d737..643edf2b1f1f6 100644 --- a/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureServiceClientTemplateModel.cs +++ b/AutoRest/Generators/Java/Azure.Java/TemplateModels/AzureServiceClientTemplateModel.cs @@ -8,6 +8,7 @@ using Microsoft.Rest.Generator.Azure; using Microsoft.Rest.Generator.ClientModel; using Microsoft.Rest.Generator.Utilities; +using System.Globalization; namespace Microsoft.Rest.Generator.Java.Azure { @@ -18,6 +19,7 @@ public class AzureServiceClientTemplateModel : ServiceClientTemplateModel public AzureServiceClientTemplateModel(ServiceClient serviceClient) : base(serviceClient) { + Properties.Remove(Properties.Find(p => p.Type.Name == "ServiceClientCredentials")); MethodTemplateModels.Clear(); Methods.Where(m => m.Group == null) .ForEach(m => MethodTemplateModels.Add(new AzureMethodTemplateModel(m, serviceClient))); @@ -41,12 +43,21 @@ public override IEnumerable Operations } } + public virtual string ParentDeclaration + { + get + { + return " extends AzureServiceClient implements " + Name; + } + } + public override List InterfaceImports { get { var imports = base.InterfaceImports; imports.Add("com.microsoft.azure.AzureClient"); + imports.Add("com.microsoft.azure.RestClient"); return imports.OrderBy(i => i).ToList(); } } @@ -57,9 +68,11 @@ public override IEnumerable ImplImports { var imports = base.ImplImports.ToList(); imports.Add("com.microsoft.azure.AzureClient"); - imports.Add("com.microsoft.azure.CustomHeaderInterceptor"); - imports.Add("java.util.UUID"); + imports.Add("com.microsoft.azure.RestClient"); + imports.Add("com.microsoft.rest.credentials.ServiceClientCredentials"); imports.Remove("com.microsoft.rest.ServiceClient"); + imports.Remove("okhttp3.OkHttpClient"); + imports.Remove("retrofit2.Retrofit"); imports.Add("com.microsoft.azure.AzureServiceClient"); return imports.OrderBy(i => i).ToList(); } @@ -69,7 +82,7 @@ public string SetDefaultHeaders { get { - return "this.clientBuilder.interceptors().add(new CustomHeaderInterceptor(\"x-ms-client-request-id\", UUID.randomUUID().toString()));"; + return ""; } } } diff --git a/AutoRest/Generators/Java/Azure.Java/TemplateModels/PageTemplateModel.cs b/AutoRest/Generators/Java/Azure.Java/TemplateModels/PageTemplateModel.cs index 4840e1fc3d8ac..723d0c46a4201 100644 --- a/AutoRest/Generators/Java/Azure.Java/TemplateModels/PageTemplateModel.cs +++ b/AutoRest/Generators/Java/Azure.Java/TemplateModels/PageTemplateModel.cs @@ -36,5 +36,13 @@ public IEnumerable ImportList return imports.OrderBy(i => i).Distinct(); } } + + public virtual string ModelsPackage + { + get + { + return "models"; + } + } } } diff --git a/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodGroupInterfaceTemplate.cshtml b/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodGroupInterfaceTemplate.cshtml index 476a7a947f9e4..130a810a0668f 100644 --- a/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodGroupInterfaceTemplate.cshtml +++ b/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodGroupInterfaceTemplate.cshtml @@ -1,4 +1,4 @@ -@using System +@using System @using Microsoft.Rest.Generator.Java.Azure @using Microsoft.Rest.Generator.Java.Azure.Templates @using Microsoft.Rest.Generator.Utilities @@ -29,4 +29,4 @@ public interface @Model.MethodGroupType { @:@Include(new MethodInterfaceTemplate(), method) @EmptyLine } -} +} \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodGroupTemplate.cshtml b/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodGroupTemplate.cshtml index d2c2d25339da9..6280ae39757db 100644 --- a/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodGroupTemplate.cshtml +++ b/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodGroupTemplate.cshtml @@ -10,7 +10,7 @@ */ @EmptyLine -package @(Settings.Namespace.ToLower()); +package @(Settings.Namespace.ToLower()).@(Model.ImplPackage); @EmptyLine @foreach (var importClass in Model.ImplImports) { @@ -22,19 +22,19 @@ package @(Settings.Namespace.ToLower()); * An instance of this class provides access to all the operations defined * in @(Model.MethodGroupType). */ -public final class @(Model.MethodGroupType)Impl implements @Model.MethodGroupType { +public final class @(Model.MethodGroupImplType)@(Model.ParentDeclaration) { /** The Retrofit service to perform REST calls. */ private @Model.MethodGroupServiceType service; /** The service client containing this operation class. */ - private @Model.Name client; + private @(Model.ServiceClientType) client; @EmptyLine /** - * Initializes an instance of @(Model.MethodGroupType). + * Initializes an instance of @(Model.MethodGroupImplType). * * @@param retrofit the Retrofit instance built from a Retrofit Builder. * @@param client the instance of the service client containing this operation class. */ - public @(Model.MethodGroupType)Impl(Retrofit retrofit, @Model.Name client) { + public @(Model.MethodGroupImplType)(Retrofit retrofit, @(Model.ServiceClientType) client) { this.service = retrofit.create(@(Model.MethodGroupServiceType).class); this.client = client; } diff --git a/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodTemplate.cshtml b/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodTemplate.cshtml index f70fc9e4a3731..8c2a599365e2c 100644 --- a/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodTemplate.cshtml +++ b/AutoRest/Generators/Java/Azure.Java/Templates/AzureMethodTemplate.cshtml @@ -29,7 +29,7 @@ if (Model.LocalParameters.Any(p => !p.IsConstant && !p.IsRequired)) * @foreach (var param in Model.LocalParameters.Where(p => !p.IsConstant && p.IsRequired)) { -@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment()) +@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment().Trim()) } @foreach (var exception in Model.ExceptionStatements) { @@ -85,7 +85,7 @@ public @Model.ReturnTypeModel.ClientResponseTypeString @(Model.Name)(@Model.Meth * @foreach (var param in Model.LocalParameters.Where(p => !p.IsConstant && p.IsRequired)) { -@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment()) +@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment().Trim()) } @Model.CallbackDocumentation * @@throws IllegalArgumentException thrown if callback is null @@ -149,7 +149,7 @@ public ServiceCall @(Model.Name)Async(@Model.MethodRequiredParameterDeclarationW * @foreach (var param in Model.LocalParameters.Where(p => !p.IsConstant)) { -@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment()) +@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment().Trim()) } @foreach (var exception in Model.ExceptionStatements) { @@ -201,7 +201,7 @@ public @Model.ReturnTypeModel.ClientResponseTypeString @(Model.Name)(@Model.Meth * @foreach (var param in Model.LocalParameters.Where(p => !p.IsConstant)) { -@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment()) +@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment().Trim()) } @Model.CallbackDocumentation * @@throws IllegalArgumentException thrown if callback is null diff --git a/AutoRest/Generators/Java/Azure.Java/Templates/AzureServiceClientInterfaceTemplate.cshtml b/AutoRest/Generators/Java/Azure.Java/Templates/AzureServiceClientInterfaceTemplate.cshtml index 3c6fe501ee773..5ab65d6946619 100644 --- a/AutoRest/Generators/Java/Azure.Java/Templates/AzureServiceClientInterfaceTemplate.cshtml +++ b/AutoRest/Generators/Java/Azure.Java/Templates/AzureServiceClientInterfaceTemplate.cshtml @@ -1,4 +1,4 @@ -@using System +@using System @using Microsoft.Rest.Generator.Java.Azure @using Microsoft.Rest.Generator.Java.Azure.Templates @using Microsoft.Rest.Generator.Utilities @@ -24,38 +24,24 @@ package @(Settings.Namespace.ToLower()); */ public interface @Model.Name { /** - * Gets the URL used as the base for all cloud service requests. + * Gets the REST client. * - * @@return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); -@EmptyLine - /** - * Gets the list of interceptors the OkHttp client will execute. - * @@return the list of interceptors. - */ - List getClientInterceptors(); + * @@return the {@@link RestClient} object. + */ + RestClient restClient(); @EmptyLine /** - * Sets the logging level for OkHttp client. - * - * @@param logLevel the logging level enum. + * Gets the {@@link AzureClient} used for long running operations. + * @@return the azure client; */ - void setLogLevel(Level logLevel); + AzureClient getAzureClient(); @EmptyLine /** - * Gets the adapter for {@@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. + * Gets the User-Agent header for the client. * - * @@return the adapter. + * @@return the user agent string. */ - JacksonMapperAdapter getMapperAdapter(); -@EmptyLine - /** - * Gets the {@@link AzureClient} used for long running operations. - * @@return the azure client; - */ - AzureClient getAzureClient(); + String userAgent(); @foreach (var property in Model.Properties) { @EmptyLine @@ -64,7 +50,7 @@ public interface @Model.Name { @: * @: * @@return the @(property.Name) value. @: */ -@: @property.Type get@(property.Name.ToPascalCase())(); +@: @property.Type @(property.Name.ToCamelCase())(); if(!property.IsReadOnly) { @EmptyLine @@ -72,8 +58,9 @@ if(!property.IsReadOnly) @: * Sets @(property.Documentation). @: * @: * @@param @(property.Name.ToCamelCase()) the @(property.Name) value. +@: * @@return the service client itself @: */ -@: void set@(property.Name.ToPascalCase())(@(property.Type) @(property.Name.ToCamelCase())); +@: @(Model.Name) with@(property.Name.ToPascalCase())(@(property.Type) @(property.Name.ToCamelCase())); } } @@ -84,7 +71,7 @@ if(!property.IsReadOnly) @: * Gets the @(operation.MethodGroupType) object to access its operations. @: * @@return the @(operation.MethodGroupType) object. @: */ -@: @(operation.MethodGroupType) get@(operation.MethodGroupType)(); +@: @(operation.MethodGroupType) @(operation.MethodGroupType.ToCamelCase())(); } @EmptyLine @if (Model.MethodTemplateModels.Any()) @@ -97,4 +84,4 @@ if(!property.IsReadOnly) } } -} +} \ No newline at end of file diff --git a/AutoRest/Generators/Java/Azure.Java/Templates/AzureServiceClientTemplate.cshtml b/AutoRest/Generators/Java/Azure.Java/Templates/AzureServiceClientTemplate.cshtml index ebac71be51c38..dabb1afd2a176 100644 --- a/AutoRest/Generators/Java/Azure.Java/Templates/AzureServiceClientTemplate.cshtml +++ b/AutoRest/Generators/Java/Azure.Java/Templates/AzureServiceClientTemplate.cshtml @@ -11,7 +11,7 @@ */ @EmptyLine -package @(Settings.Namespace.ToLower()); +package @(Settings.Namespace.ToLower()).@(Model.ImplPackage); @EmptyLine @foreach (var importClass in Model.ImplImports) @@ -21,27 +21,16 @@ package @(Settings.Namespace.ToLower()); @EmptyLine /** - * Initializes a new instance of the @Model.Name class. + * Initializes a new instance of the @(Model.Name)Impl class. */ -public final class @(Model.Name)Impl extends AzureServiceClient implements @Model.Name { +public final class @(Model.Name)Impl@(Model.ParentDeclaration) { @if (Model.MethodTemplateModels.Any()) { @: /** The Retrofit service to perform REST calls. */ @: private @Model.ServiceClientServiceType service; } - /** The URL used as the base for all cloud service requests. */ - private final AutoRestBaseUrl baseUrl; /** the {@@link AzureClient} used for long running operations. */ private AzureClient azureClient; -@EmptyLine - /** - * Gets the URL used as the base for all cloud service requests. - * - * @@return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } @EmptyLine /** * Gets the {@@link AzureClient} used for long running operations. @@ -61,7 +50,7 @@ public final class @(Model.Name)Impl extends AzureServiceClient implements @Mode @: * @: * @@return the @(property.Name) value. @: */ -@: public @(property.Type) get@(property.Name.ToPascalCase())() { +@: public @(property.Type) @(property.Name.ToCamelCase())() { @: return this.@(property.Name.ToCamelCase()); @: } if(!property.IsReadOnly) @@ -71,9 +60,11 @@ if(!property.IsReadOnly) @: * Sets @(property.Documentation.Period()) @: * @: * @@param @(property.Name.ToCamelCase()) the @(property.Name) value. +@: * @@return the service client itself @: */ -@: public void set@(property.Name.ToPascalCase())(@(property.Type) @(property.Name.ToCamelCase())) { +@: public @(Model.Name)Impl with@(property.Name.ToPascalCase())(@(property.Type) @(property.Name.ToCamelCase())) { @: this.@(property.Name.ToCamelCase()) = @(property.Name.ToCamelCase()); +@: return this; @: } } } @@ -82,11 +73,16 @@ if(!property.IsReadOnly) { @EmptyLine @: /** -@: * Gets the @(operation.MethodGroupType) object to access its operations. -@: * @@return the @(operation.MethodGroupType) object. +@: * The @(operation.MethodGroupDeclarationType) object to access its operations. @: */ -@: public @(operation.MethodGroupType) get@(operation.MethodGroupType)() { -@: return new @(operation.MethodGroupType)Impl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); +@: private @(operation.MethodGroupDeclarationType) @(operation.MethodGroupName); +@EmptyLine +@: /** +@: * Gets the @(operation.MethodGroupDeclarationType) object to access its operations. +@: * @@return the @(operation.MethodGroupDeclarationType) object. +@: */ +@: public @(operation.MethodGroupDeclarationType) @(operation.MethodGroupName)() { +@: return this.@(operation.MethodGroupName); @: } } @EmptyLine @@ -110,45 +106,22 @@ if(!property.IsReadOnly) * @@param credentials the management credentials for Azure */ @(Model.IsCustomBaseUri ? "private" : "public") @(Model.Name)Impl(String baseUrl, ServiceClientCredentials credentials) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - this.credentials = credentials; - initialize(); + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); } @EmptyLine -@if(!Model.IsCustomBaseUri) -{ -@: /** -@: * Initializes an instance of @(Model.Name) client. -@: * -@: * @@param baseUrl the base URL of the host -@: * @@param credentials the management credentials for Azure -@: * @@param clientBuilder the builder for building up an {@@link OkHttpClient} -@: * @@param retrofitBuilder the builder for building up a {@@link Retrofit} -@: */ -@: public @(Model.Name)Impl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { -@: super(clientBuilder, retrofitBuilder); -@: this.baseUrl = new AutoRestBaseUrl(baseUrl); -@: this.credentials = credentials; -@: initialize(); -@: } -} -else -{ -@: /** -@: * Initializes an instance of @(Model.Name) client. -@: * -@: * @@param credentials the management credentials for Azure -@: * @@param clientBuilder the builder for building up an {@@link OkHttpClient} -@: * @@param retrofitBuilder the builder for building up a {@@link Retrofit} -@: */ -@: public @(Model.Name)Impl(ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { -@: super(clientBuilder, retrofitBuilder); -@: this.baseUrl = new AutoRestBaseUrl("@Model.BaseUrl"); -@: this.credentials = credentials; -@: initialize(); -@: } -} + /** + * Initializes an instance of @(Model.Name) client. + * + * @@param restClient the REST client to connect to Azure. + */ + public @(Model.Name)Impl(RestClient restClient) { + super(restClient); + initialize(); + } + @EmptyLine @@ -172,82 +145,54 @@ else this(baseUrl, null); } @EmptyLine -@if(Model.IsCustomBaseUri) -{ -@: /** -@: * Initializes an instance of @(Model.Name) client. -@: * -@: * @@param clientBuilder the builder for building up an {@@link OkHttpClient} -@: * @@param retrofitBuilder the builder for building up a {@@link Retrofit} -@: */ -@: public @(Model.Name)Impl(OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { -@: super(clientBuilder, retrofitBuilder); -@: this.baseUrl = new AutoRestBaseUrl("@Model.BaseUrl"); -@: initialize(); -@: } -} -else -{ -@: /** -@: * Initializes an instance of @(Model.Name) client. -@: * -@: * @@param baseUrl the base URL of the host -@: * @@param clientBuilder the builder for building up an {@@link OkHttpClient} -@: * @@param retrofitBuilder the builder for building up a {@@link Retrofit} -@: */ -@: public @(Model.Name)Impl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { -@: super(clientBuilder, retrofitBuilder); -@: this.baseUrl = new AutoRestBaseUrl(baseUrl); -@: initialize(); -@: } -} + /** + * Initializes an instance of @(Model.Name) client. + * + * @@param restClient the REST client to connect to Azure + */ + public @(Model.Name)Impl(RestClient restClient) { + super(restClient); + restClient.baseUrl("@Model.BaseUrl"); + initialize(); + } @EmptyLine } - @@Override protected void initialize() { @foreach (var property in Model.Properties.Where(p => p.DefaultValue != null)) { @:this.@(property.Name) = @(property.DefaultValue); +} +@foreach (var operation in Model.Operations) +{ +@: this.@(operation.MethodGroupName) = new @(operation.MethodGroupImplType)(restClient().retrofit(), this); } @Model.SetDefaultHeaders - @if (Settings.AddCredentials) - { -@: if (this.credentials != null) { -@: this.credentials.applyCredentialsFilter(clientBuilder); -@: } - } - super.initialize(); - this.azureClient = new AzureClient(clientBuilder, retrofitBuilder, mapperAdapter); - this.azureClient.setCredentials(this.credentials); - - this.retrofitBuilder.baseUrl(baseUrl); + this.azureClient = new AzureClient(this); @if (Model.MethodTemplateModels.Any()) { @: initializeService(); } } -@if (Model.MethodTemplateModels.Any()) -{ -@EmptyLine - - private void initializeService() { - service = this.retrofitBuilder.client(this.clientBuilder.build()) - .build() - .create(@(Model.ServiceClientServiceType).class); - } - @EmptyLine - + /** - * Sets the logging level for OkHttp client. + * Gets the User-Agent header for the client. * - * @@param logLevel the logging level enum + * @@return the user agent string. */ @@Override - public void setLogLevel(Level logLevel) { - super.setLogLevel(logLevel); - initializeService(); + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "@Model.Name, @Model.ApiVersion"); + } +@if (Model.MethodTemplateModels.Any()) +{ +@EmptyLine + + private void initializeService() { + service = restClient().retrofit().create(@(Model.ServiceClientServiceType).class); } @EmptyLine diff --git a/AutoRest/Generators/Java/Azure.Java/Templates/PageTemplate.cshtml b/AutoRest/Generators/Java/Azure.Java/Templates/PageTemplate.cshtml index 09c3ef48de768..49b2cc2a087f4 100644 --- a/AutoRest/Generators/Java/Azure.Java/Templates/PageTemplate.cshtml +++ b/AutoRest/Generators/Java/Azure.Java/Templates/PageTemplate.cshtml @@ -8,7 +8,7 @@ */ @EmptyLine -package @(Settings.Namespace.ToLower()).models; +package @(Settings.Namespace.ToLower()).@(Model.ModelsPackage); @EmptyLine @foreach (var importClass in Model.ImportList) { @@ -54,4 +54,26 @@ public class @Model.TypeDefinitionName implements Page { public List getItems() { return items; } + @EmptyLine + /** + * Sets the link to the next page. + * + * @@param nextPageLink the link to the next page. + * @@return this Page object itself. + */ + public @Model.TypeDefinitionName setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + @EmptyLine + /** + * Sets the list of items. + * + * @@param items the list of items in {@@link List}. + * @@return this Page object itself. + */ + public @Model.TypeDefinitionName setItems(List items) { + this.items = items; + return this; + } } diff --git a/AutoRest/Generators/Java/Azure.Java/TypeModels/AzureResponseModel.cs b/AutoRest/Generators/Java/Azure.Java/TypeModels/AzureResponseModel.cs index 499ac74333e80..887d7620d6186 100644 --- a/AutoRest/Generators/Java/Azure.Java/TypeModels/AzureResponseModel.cs +++ b/AutoRest/Generators/Java/Azure.Java/TypeModels/AzureResponseModel.cs @@ -31,11 +31,10 @@ public override string GenericBodyClientTypeString { get { - if (BodyClientType is SequenceType && _method.IsPagingNextOperation) + var bodySequenceType = BodyClientType as AzureSequenceTypeModel; + if (bodySequenceType != null && _method.IsPagingNextOperation) { - var ext = _method.Extensions[AzureExtensions.PageableExtension] as Newtonsoft.Json.Linq.JContainer; - string pageClassName = (string)ext["className"]; - return string.Format(CultureInfo.InvariantCulture, "{0}<{1}>", pageClassName, ((SequenceType)BodyClientType).ElementType); + return string.Format(CultureInfo.InvariantCulture, "{0}<{1}>", bodySequenceType.PageImplType, bodySequenceType.ElementType); } else if (BodyClientType is SequenceType && _method.IsPagingOperation) { @@ -49,12 +48,10 @@ public override string GenericBodyWireTypeString { get { - SequenceTypeModel sequenceType = BodyWireType as SequenceTypeModel; + var sequenceType = BodyWireType as AzureSequenceTypeModel; if (sequenceType != null && (_method.IsPagingOperation || _method.IsPagingNextOperation || _method.IsPagingNonPollingOperation)) { - var ext = _method.Extensions[AzureExtensions.PageableExtension] as Newtonsoft.Json.Linq.JContainer; - string pageClassName = (string)ext["className"]; - return string.Format(CultureInfo.InvariantCulture, "{0}<{1}>", pageClassName, sequenceType.ElementTypeModel.InstanceType()); + return string.Format(CultureInfo.InvariantCulture, "{0}<{1}>", sequenceType.PageImplType, sequenceType.ElementTypeModel.InstanceType()); } return base.GenericBodyWireTypeString; } diff --git a/AutoRest/Generators/Java/Azure.Java/TypeModels/AzureSequenceTypeModel.cs b/AutoRest/Generators/Java/Azure.Java/TypeModels/AzureSequenceTypeModel.cs new file mode 100644 index 0000000000000..6cc7afc610061 --- /dev/null +++ b/AutoRest/Generators/Java/Azure.Java/TypeModels/AzureSequenceTypeModel.cs @@ -0,0 +1,29 @@ +using Microsoft.Rest.Generator.ClientModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Rest.Generator.Java.TemplateModels; +using Microsoft.Rest.Generator.Utilities; +using Microsoft.Rest.Generator.Azure; + +namespace Microsoft.Rest.Generator.Java.Azure +{ + public class AzureSequenceTypeModel : SequenceTypeModel + { + protected string _azureRuntimePackage = "com.microsoft.azure"; + + public AzureSequenceTypeModel() + : base() + { + } + + public AzureSequenceTypeModel(SequenceType javaSequenceType) + : base(javaSequenceType) + { + } + + public string PageImplType { get; set; } + } +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/Arrays.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/Arrays.java index e37c6c2725986..9a286963a3f59 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/Arrays.java @@ -1,1249 +1,1249 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -package fixtures.bodyarray; - -import com.microsoft.rest.ServiceCall; -import com.microsoft.rest.ServiceCallback; -import com.microsoft.rest.ServiceResponse; -import fixtures.bodyarray.models.ErrorException; -import fixtures.bodyarray.models.Product; -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.Period; - -/** - * An instance of this class provides access to all the operations defined - * in ArrayOperations. - */ -public interface ArrayOperations { - /** - * Get null array value. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getNull() throws ErrorException, IOException; - - /** - * Get null array value. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get invalid array [1, 2, 3. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getInvalid() throws ErrorException, IOException; - - /** - * Get invalid array [1, 2, 3. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getInvalidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get empty array value []. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getEmpty() throws ErrorException, IOException; - - /** - * Get empty array value []. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value empty []. - * - * @param arrayBody the List<String> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putEmpty(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value empty []. - * - * @param arrayBody the List<String> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putEmptyAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get boolean array value [true, false, false, true]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getBooleanTfft() throws ErrorException, IOException; - - /** - * Get boolean array value [true, false, false, true]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getBooleanTfftAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value empty [true, false, false, true]. - * - * @param arrayBody the List<Boolean> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putBooleanTfft(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value empty [true, false, false, true]. - * - * @param arrayBody the List<Boolean> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putBooleanTfftAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get boolean array value [true, null, false]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getBooleanInvalidNull() throws ErrorException, IOException; - - /** - * Get boolean array value [true, null, false]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getBooleanInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get boolean array value [true, 'boolean', false]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getBooleanInvalidString() throws ErrorException, IOException; - - /** - * Get boolean array value [true, 'boolean', false]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getBooleanInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get integer array value [1, -1, 3, 300]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getIntegerValid() throws ErrorException, IOException; - - /** - * Get integer array value [1, -1, 3, 300]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getIntegerValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value empty [1, -1, 3, 300]. - * - * @param arrayBody the List<Integer> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putIntegerValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value empty [1, -1, 3, 300]. - * - * @param arrayBody the List<Integer> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putIntegerValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get integer array value [1, null, 0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getIntInvalidNull() throws ErrorException, IOException; - - /** - * Get integer array value [1, null, 0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getIntInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get integer array value [1, 'integer', 0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getIntInvalidString() throws ErrorException, IOException; - - /** - * Get integer array value [1, 'integer', 0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getIntInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get integer array value [1, -1, 3, 300]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getLongValid() throws ErrorException, IOException; - - /** - * Get integer array value [1, -1, 3, 300]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getLongValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value empty [1, -1, 3, 300]. - * - * @param arrayBody the List<Long> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putLongValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value empty [1, -1, 3, 300]. - * - * @param arrayBody the List<Long> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putLongValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get long array value [1, null, 0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getLongInvalidNull() throws ErrorException, IOException; - - /** - * Get long array value [1, null, 0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getLongInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get long array value [1, 'integer', 0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getLongInvalidString() throws ErrorException, IOException; - - /** - * Get long array value [1, 'integer', 0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getLongInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get float array value [0, -0.01, 1.2e20]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getFloatValid() throws ErrorException, IOException; - - /** - * Get float array value [0, -0.01, 1.2e20]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getFloatValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value [0, -0.01, 1.2e20]. - * - * @param arrayBody the List<Double> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putFloatValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value [0, -0.01, 1.2e20]. - * - * @param arrayBody the List<Double> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putFloatValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get float array value [0.0, null, -1.2e20]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getFloatInvalidNull() throws ErrorException, IOException; - - /** - * Get float array value [0.0, null, -1.2e20]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getFloatInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get boolean array value [1.0, 'number', 0.0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getFloatInvalidString() throws ErrorException, IOException; - - /** - * Get boolean array value [1.0, 'number', 0.0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getFloatInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get float array value [0, -0.01, 1.2e20]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDoubleValid() throws ErrorException, IOException; - - /** - * Get float array value [0, -0.01, 1.2e20]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDoubleValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value [0, -0.01, 1.2e20]. - * - * @param arrayBody the List<Double> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putDoubleValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value [0, -0.01, 1.2e20]. - * - * @param arrayBody the List<Double> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putDoubleValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get float array value [0.0, null, -1.2e20]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDoubleInvalidNull() throws ErrorException, IOException; - - /** - * Get float array value [0.0, null, -1.2e20]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDoubleInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get boolean array value [1.0, 'number', 0.0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDoubleInvalidString() throws ErrorException, IOException; - - /** - * Get boolean array value [1.0, 'number', 0.0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDoubleInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get string array value ['foo1', 'foo2', 'foo3']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<String> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getStringValid() throws ErrorException, IOException; - - /** - * Get string array value ['foo1', 'foo2', 'foo3']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getStringValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value ['foo1', 'foo2', 'foo3']. - * - * @param arrayBody the List<String> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putStringValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value ['foo1', 'foo2', 'foo3']. - * - * @param arrayBody the List<String> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putStringValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get string array value ['foo', null, 'foo2']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<String> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getStringWithNull() throws ErrorException, IOException; - - /** - * Get string array value ['foo', null, 'foo2']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getStringWithNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get string array value ['foo', 123, 'foo2']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<String> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getStringWithInvalid() throws ErrorException, IOException; - - /** - * Get string array value ['foo', 123, 'foo2']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getStringWithInvalidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<UUID> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getUuidValid() throws ErrorException, IOException; - - /** - * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getUuidValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - * - * @param arrayBody the List<UUID> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putUuidValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - * - * @param arrayBody the List<UUID> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putUuidValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<UUID> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getUuidInvalidChars() throws ErrorException, IOException; - - /** - * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getUuidInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDateValid() throws ErrorException, IOException; - - /** - * Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDateValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - * - * @param arrayBody the List<LocalDate> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putDateValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - * - * @param arrayBody the List<LocalDate> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putDateValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get date array value ['2012-01-01', null, '1776-07-04']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDateInvalidNull() throws ErrorException, IOException; - - /** - * Get date array value ['2012-01-01', null, '1776-07-04']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDateInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get date array value ['2011-03-22', 'date']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDateInvalidChars() throws ErrorException, IOException; - - /** - * Get date array value ['2011-03-22', 'date']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDateInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDateTimeValid() throws ErrorException, IOException; - - /** - * Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDateTimeValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. - * - * @param arrayBody the List<DateTime> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putDateTimeValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. - * - * @param arrayBody the List<DateTime> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putDateTimeValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get date array value ['2000-12-01t00:00:01z', null]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDateTimeInvalidNull() throws ErrorException, IOException; - - /** - * Get date array value ['2000-12-01t00:00:01z', null]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDateTimeInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get date array value ['2000-12-01t00:00:01z', 'date-time']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDateTimeInvalidChars() throws ErrorException, IOException; - - /** - * Get date array value ['2000-12-01t00:00:01z', 'date-time']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDateTimeInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDateTimeRfc1123Valid() throws ErrorException, IOException; - - /** - * Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDateTimeRfc1123ValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. - * - * @param arrayBody the List<DateTimeRfc1123> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putDateTimeRfc1123Valid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. - * - * @param arrayBody the List<DateTimeRfc1123> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putDateTimeRfc1123ValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Period> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getDurationValid() throws ErrorException, IOException; - - /** - * Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDurationValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - * - * @param arrayBody the List<Period> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putDurationValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - * - * @param arrayBody the List<Period> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putDurationValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<byte[]> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getByteValid() throws ErrorException, IOException; - - /** - * Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getByteValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. - * - * @param arrayBody the List<byte[]> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putByteValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. - * - * @param arrayBody the List<byte[]> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putByteValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<byte[]> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getByteInvalidNull() throws ErrorException, IOException; - - /** - * Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getByteInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<String> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getBase64Url() throws ErrorException, IOException; - - /** - * Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getBase64UrlAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get array of complex type null value. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getComplexNull() throws ErrorException, IOException; - - /** - * Get array of complex type null value. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getComplexNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get empty array of complex type []. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getComplexEmpty() throws ErrorException, IOException; - - /** - * Get empty array of complex type []. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getComplexEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getComplexItemNull() throws ErrorException, IOException; - - /** - * Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getComplexItemNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getComplexItemEmpty() throws ErrorException, IOException; - - /** - * Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getComplexItemEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse> getComplexValid() throws ErrorException, IOException; - - /** - * Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getComplexValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; - - /** - * Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. - * - * @param arrayBody the List<Product> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putComplexValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. - * - * @param arrayBody the List<Product> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putComplexValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get a null array. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getArrayNull() throws ErrorException, IOException; - - /** - * Get a null array. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getArrayNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Get an empty array []. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getArrayEmpty() throws ErrorException, IOException; - - /** - * Get an empty array []. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getArrayEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getArrayItemNull() throws ErrorException, IOException; - - /** - * Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getArrayItemNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getArrayItemEmpty() throws ErrorException, IOException; - - /** - * Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getArrayItemEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getArrayValid() throws ErrorException, IOException; - - /** - * Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getArrayValidAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - * - * @param arrayBody the List<List<String>> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putArrayValid(List> arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - * - * @param arrayBody the List<List<String>> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putArrayValidAsync(List> arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - - /** - * Get an array of Dictionaries with value null. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getDictionaryNull() throws ErrorException, IOException; - - /** - * Get an array of Dictionaries with value null. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDictionaryNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Get an array of Dictionaries of type <string, string> with value []. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getDictionaryEmpty() throws ErrorException, IOException; - - /** - * Get an array of Dictionaries of type <string, string> with value []. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDictionaryEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getDictionaryItemNull() throws ErrorException, IOException; - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDictionaryItemNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getDictionaryItemEmpty() throws ErrorException, IOException; - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDictionaryItemEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - ServiceResponse>> getDictionaryValid() throws ErrorException, IOException; - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall getDictionaryValidAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param arrayBody the List<Map<String, String>> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - ServiceResponse putDictionaryValid(List> arrayBody) throws ErrorException, IOException, IllegalArgumentException; - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param arrayBody the List<Map<String, String>> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link ServiceCall} object - */ - ServiceCall putDictionaryValidAsync(List> arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; - -} +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.bodyarray; + +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import fixtures.bodyarray.models.ErrorException; +import fixtures.bodyarray.models.Product; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.Period; + +/** + * An instance of this class provides access to all the operations defined + * in Arrays. + */ +public interface Arrays { + /** + * Get null array value. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getNull() throws ErrorException, IOException; + + /** + * Get null array value. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get invalid array [1, 2, 3. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getInvalid() throws ErrorException, IOException; + + /** + * Get invalid array [1, 2, 3. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getInvalidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get empty array value []. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getEmpty() throws ErrorException, IOException; + + /** + * Get empty array value []. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value empty []. + * + * @param arrayBody the List<String> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putEmpty(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value empty []. + * + * @param arrayBody the List<String> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putEmptyAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get boolean array value [true, false, false, true]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getBooleanTfft() throws ErrorException, IOException; + + /** + * Get boolean array value [true, false, false, true]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getBooleanTfftAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value empty [true, false, false, true]. + * + * @param arrayBody the List<Boolean> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putBooleanTfft(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value empty [true, false, false, true]. + * + * @param arrayBody the List<Boolean> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putBooleanTfftAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get boolean array value [true, null, false]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getBooleanInvalidNull() throws ErrorException, IOException; + + /** + * Get boolean array value [true, null, false]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getBooleanInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get boolean array value [true, 'boolean', false]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getBooleanInvalidString() throws ErrorException, IOException; + + /** + * Get boolean array value [true, 'boolean', false]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getBooleanInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get integer array value [1, -1, 3, 300]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getIntegerValid() throws ErrorException, IOException; + + /** + * Get integer array value [1, -1, 3, 300]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getIntegerValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value empty [1, -1, 3, 300]. + * + * @param arrayBody the List<Integer> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putIntegerValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value empty [1, -1, 3, 300]. + * + * @param arrayBody the List<Integer> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putIntegerValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get integer array value [1, null, 0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getIntInvalidNull() throws ErrorException, IOException; + + /** + * Get integer array value [1, null, 0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getIntInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get integer array value [1, 'integer', 0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getIntInvalidString() throws ErrorException, IOException; + + /** + * Get integer array value [1, 'integer', 0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getIntInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get integer array value [1, -1, 3, 300]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getLongValid() throws ErrorException, IOException; + + /** + * Get integer array value [1, -1, 3, 300]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getLongValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value empty [1, -1, 3, 300]. + * + * @param arrayBody the List<Long> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putLongValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value empty [1, -1, 3, 300]. + * + * @param arrayBody the List<Long> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putLongValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get long array value [1, null, 0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getLongInvalidNull() throws ErrorException, IOException; + + /** + * Get long array value [1, null, 0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getLongInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get long array value [1, 'integer', 0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getLongInvalidString() throws ErrorException, IOException; + + /** + * Get long array value [1, 'integer', 0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getLongInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get float array value [0, -0.01, 1.2e20]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getFloatValid() throws ErrorException, IOException; + + /** + * Get float array value [0, -0.01, 1.2e20]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getFloatValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value [0, -0.01, 1.2e20]. + * + * @param arrayBody the List<Double> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putFloatValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value [0, -0.01, 1.2e20]. + * + * @param arrayBody the List<Double> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putFloatValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get float array value [0.0, null, -1.2e20]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getFloatInvalidNull() throws ErrorException, IOException; + + /** + * Get float array value [0.0, null, -1.2e20]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getFloatInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get boolean array value [1.0, 'number', 0.0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getFloatInvalidString() throws ErrorException, IOException; + + /** + * Get boolean array value [1.0, 'number', 0.0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getFloatInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get float array value [0, -0.01, 1.2e20]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDoubleValid() throws ErrorException, IOException; + + /** + * Get float array value [0, -0.01, 1.2e20]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDoubleValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value [0, -0.01, 1.2e20]. + * + * @param arrayBody the List<Double> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putDoubleValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value [0, -0.01, 1.2e20]. + * + * @param arrayBody the List<Double> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putDoubleValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get float array value [0.0, null, -1.2e20]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDoubleInvalidNull() throws ErrorException, IOException; + + /** + * Get float array value [0.0, null, -1.2e20]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDoubleInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get boolean array value [1.0, 'number', 0.0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDoubleInvalidString() throws ErrorException, IOException; + + /** + * Get boolean array value [1.0, 'number', 0.0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDoubleInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get string array value ['foo1', 'foo2', 'foo3']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<String> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getStringValid() throws ErrorException, IOException; + + /** + * Get string array value ['foo1', 'foo2', 'foo3']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getStringValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value ['foo1', 'foo2', 'foo3']. + * + * @param arrayBody the List<String> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putStringValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value ['foo1', 'foo2', 'foo3']. + * + * @param arrayBody the List<String> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putStringValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get string array value ['foo', null, 'foo2']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<String> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getStringWithNull() throws ErrorException, IOException; + + /** + * Get string array value ['foo', null, 'foo2']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getStringWithNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get string array value ['foo', 123, 'foo2']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<String> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getStringWithInvalid() throws ErrorException, IOException; + + /** + * Get string array value ['foo', 123, 'foo2']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getStringWithInvalidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<UUID> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getUuidValid() throws ErrorException, IOException; + + /** + * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getUuidValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. + * + * @param arrayBody the List<UUID> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putUuidValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. + * + * @param arrayBody the List<UUID> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putUuidValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<UUID> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getUuidInvalidChars() throws ErrorException, IOException; + + /** + * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getUuidInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDateValid() throws ErrorException, IOException; + + /** + * Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDateValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. + * + * @param arrayBody the List<LocalDate> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putDateValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. + * + * @param arrayBody the List<LocalDate> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putDateValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get date array value ['2012-01-01', null, '1776-07-04']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDateInvalidNull() throws ErrorException, IOException; + + /** + * Get date array value ['2012-01-01', null, '1776-07-04']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDateInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get date array value ['2011-03-22', 'date']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDateInvalidChars() throws ErrorException, IOException; + + /** + * Get date array value ['2011-03-22', 'date']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDateInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDateTimeValid() throws ErrorException, IOException; + + /** + * Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDateTimeValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. + * + * @param arrayBody the List<DateTime> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putDateTimeValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. + * + * @param arrayBody the List<DateTime> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putDateTimeValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get date array value ['2000-12-01t00:00:01z', null]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDateTimeInvalidNull() throws ErrorException, IOException; + + /** + * Get date array value ['2000-12-01t00:00:01z', null]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDateTimeInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get date array value ['2000-12-01t00:00:01z', 'date-time']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDateTimeInvalidChars() throws ErrorException, IOException; + + /** + * Get date array value ['2000-12-01t00:00:01z', 'date-time']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDateTimeInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDateTimeRfc1123Valid() throws ErrorException, IOException; + + /** + * Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDateTimeRfc1123ValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. + * + * @param arrayBody the List<DateTimeRfc1123> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putDateTimeRfc1123Valid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. + * + * @param arrayBody the List<DateTimeRfc1123> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putDateTimeRfc1123ValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Period> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getDurationValid() throws ErrorException, IOException; + + /** + * Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDurationValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. + * + * @param arrayBody the List<Period> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putDurationValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. + * + * @param arrayBody the List<Period> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putDurationValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<byte[]> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getByteValid() throws ErrorException, IOException; + + /** + * Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getByteValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. + * + * @param arrayBody the List<byte[]> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putByteValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. + * + * @param arrayBody the List<byte[]> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putByteValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<byte[]> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getByteInvalidNull() throws ErrorException, IOException; + + /** + * Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getByteInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<String> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getBase64Url() throws ErrorException, IOException; + + /** + * Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getBase64UrlAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get array of complex type null value. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getComplexNull() throws ErrorException, IOException; + + /** + * Get array of complex type null value. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getComplexNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get empty array of complex type []. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getComplexEmpty() throws ErrorException, IOException; + + /** + * Get empty array of complex type []. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getComplexEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getComplexItemNull() throws ErrorException, IOException; + + /** + * Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getComplexItemNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getComplexItemEmpty() throws ErrorException, IOException; + + /** + * Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getComplexItemEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> getComplexValid() throws ErrorException, IOException; + + /** + * Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getComplexValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. + * + * @param arrayBody the List<Product> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putComplexValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. + * + * @param arrayBody the List<Product> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putComplexValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get a null array. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getArrayNull() throws ErrorException, IOException; + + /** + * Get a null array. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getArrayNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Get an empty array []. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getArrayEmpty() throws ErrorException, IOException; + + /** + * Get an empty array []. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getArrayEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getArrayItemNull() throws ErrorException, IOException; + + /** + * Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getArrayItemNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getArrayItemEmpty() throws ErrorException, IOException; + + /** + * Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getArrayItemEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getArrayValid() throws ErrorException, IOException; + + /** + * Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getArrayValidAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. + * + * @param arrayBody the List<List<String>> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putArrayValid(List> arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. + * + * @param arrayBody the List<List<String>> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putArrayValidAsync(List> arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Get an array of Dictionaries with value null. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getDictionaryNull() throws ErrorException, IOException; + + /** + * Get an array of Dictionaries with value null. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDictionaryNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Get an array of Dictionaries of type <string, string> with value []. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getDictionaryEmpty() throws ErrorException, IOException; + + /** + * Get an array of Dictionaries of type <string, string> with value []. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDictionaryEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getDictionaryItemNull() throws ErrorException, IOException; + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDictionaryItemNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getDictionaryItemEmpty() throws ErrorException, IOException; + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDictionaryItemEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse>> getDictionaryValid() throws ErrorException, IOException; + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getDictionaryValidAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException; + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param arrayBody the List<Map<String, String>> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse putDictionaryValid(List> arrayBody) throws ErrorException, IOException, IllegalArgumentException; + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param arrayBody the List<Map<String, String>> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall putDictionaryValidAsync(List> arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException; + +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/AutoRestSwaggerBATArrayService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/AutoRestSwaggerBATArrayService.java index 24e483d04f13a..30babd90a3d32 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/AutoRestSwaggerBATArrayService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/AutoRestSwaggerBATArrayService.java @@ -10,49 +10,20 @@ package fixtures.bodyarray; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestSwaggerBATArrayService class. */ public interface AutoRestSwaggerBATArrayService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Arrays object to access its operations. + * @return the Arrays object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the ArrayOperations object to access its operations. - * @return the ArrayOperations object. - */ - ArrayOperations getArrayOperations(); + Arrays arrays(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/implementation/ArraysImpl.java similarity index 96% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/implementation/ArraysImpl.java index 01f53ca7948f2..cca1023349989 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/implementation/ArraysImpl.java @@ -1,3475 +1,3476 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -package fixtures.bodyarray; - -import com.google.common.reflect.TypeToken; -import com.microsoft.rest.DateTimeRfc1123; -import com.microsoft.rest.ServiceCall; -import com.microsoft.rest.ServiceCallback; -import com.microsoft.rest.ServiceResponse; -import com.microsoft.rest.ServiceResponseBuilder; -import com.microsoft.rest.ServiceResponseCallback; -import com.microsoft.rest.Validator; -import fixtures.bodyarray.models.ErrorException; -import fixtures.bodyarray.models.Product; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import okhttp3.ResponseBody; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.Period; -import retrofit2.Call; -import retrofit2.http.Body; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.PUT; -import retrofit2.Response; -import retrofit2.Retrofit; - -/** - * An instance of this class provides access to all the operations defined - * in ArrayOperations. - */ -public final class ArrayOperationsImpl implements ArrayOperations { - /** The Retrofit service to perform REST calls. */ - private ArrayService service; - /** The service client containing this operation class. */ - private AutoRestSwaggerBATArrayService client; - - /** - * Initializes an instance of ArrayOperations. - * - * @param retrofit the Retrofit instance built from a Retrofit Builder. - * @param client the instance of the service client containing this operation class. - */ - public ArrayOperationsImpl(Retrofit retrofit, AutoRestSwaggerBATArrayService client) { - this.service = retrofit.create(ArrayService.class); - this.client = client; - } - - /** - * The interface defining all the services for ArrayOperations to be - * used by Retrofit to perform actually REST calls. - */ - interface ArrayService { - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/null") - Call getNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/invalid") - Call getInvalid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/empty") - Call getEmpty(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/empty") - Call putEmpty(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/boolean/tfft") - Call getBooleanTfft(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/boolean/tfft") - Call putBooleanTfft(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/boolean/true.null.false") - Call getBooleanInvalidNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/boolean/true.boolean.false") - Call getBooleanInvalidString(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/integer/1.-1.3.300") - Call getIntegerValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/integer/1.-1.3.300") - Call putIntegerValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/integer/1.null.zero") - Call getIntInvalidNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/integer/1.integer.0") - Call getIntInvalidString(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/long/1.-1.3.300") - Call getLongValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/long/1.-1.3.300") - Call putLongValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/long/1.null.zero") - Call getLongInvalidNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/long/1.integer.0") - Call getLongInvalidString(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/float/0--0.01-1.2e20") - Call getFloatValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/float/0--0.01-1.2e20") - Call putFloatValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/float/0.0-null-1.2e20") - Call getFloatInvalidNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/float/1.number.0") - Call getFloatInvalidString(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/double/0--0.01-1.2e20") - Call getDoubleValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/double/0--0.01-1.2e20") - Call putDoubleValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/double/0.0-null-1.2e20") - Call getDoubleInvalidNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/double/1.number.0") - Call getDoubleInvalidString(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/string/foo1.foo2.foo3") - Call getStringValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/string/foo1.foo2.foo3") - Call putStringValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/string/foo.null.foo2") - Call getStringWithNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/string/foo.123.foo2") - Call getStringWithInvalid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/uuid/valid") - Call getUuidValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/uuid/valid") - Call putUuidValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/uuid/invalidchars") - Call getUuidInvalidChars(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/date/valid") - Call getDateValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/date/valid") - Call putDateValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/date/invalidnull") - Call getDateInvalidNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/date/invalidchars") - Call getDateInvalidChars(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/date-time/valid") - Call getDateTimeValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/date-time/valid") - Call putDateTimeValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/date-time/invalidnull") - Call getDateTimeInvalidNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/date-time/invalidchars") - Call getDateTimeInvalidChars(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/date-time-rfc1123/valid") - Call getDateTimeRfc1123Valid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/date-time-rfc1123/valid") - Call putDateTimeRfc1123Valid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/duration/valid") - Call getDurationValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/duration/valid") - Call putDurationValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/byte/valid") - Call getByteValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/prim/byte/valid") - Call putByteValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/byte/invalidnull") - Call getByteInvalidNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/prim/base64url/valid") - Call getBase64Url(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/complex/null") - Call getComplexNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/complex/empty") - Call getComplexEmpty(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/complex/itemnull") - Call getComplexItemNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/complex/itemempty") - Call getComplexItemEmpty(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/complex/valid") - Call getComplexValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/complex/valid") - Call putComplexValid(@Body List arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/array/null") - Call getArrayNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/array/empty") - Call getArrayEmpty(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/array/itemnull") - Call getArrayItemNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/array/itemempty") - Call getArrayItemEmpty(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/array/valid") - Call getArrayValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/array/valid") - Call putArrayValid(@Body List> arrayBody); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/dictionary/null") - Call getDictionaryNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/dictionary/empty") - Call getDictionaryEmpty(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/dictionary/itemnull") - Call getDictionaryItemNull(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/dictionary/itemempty") - Call getDictionaryItemEmpty(); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("array/dictionary/valid") - Call getDictionaryValid(); - - @Headers("Content-Type: application/json; charset=utf-8") - @PUT("array/dictionary/valid") - Call putDictionaryValid(@Body List> arrayBody); - - } - - /** - * Get null array value. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getNull() throws ErrorException, IOException { - Call call = service.getNull(); - return getNullDelegate(call.execute()); - } - - /** - * Get null array value. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get invalid array [1, 2, 3. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getInvalid() throws ErrorException, IOException { - Call call = service.getInvalid(); - return getInvalidDelegate(call.execute()); - } - - /** - * Get invalid array [1, 2, 3. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getInvalidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getInvalid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getInvalidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get empty array value []. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getEmpty() throws ErrorException, IOException { - Call call = service.getEmpty(); - return getEmptyDelegate(call.execute()); - } - - /** - * Get empty array value []. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getEmpty(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getEmptyDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value empty []. - * - * @param arrayBody the List<String> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putEmpty(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putEmpty(arrayBody); - return putEmptyDelegate(call.execute()); - } - - /** - * Set array value empty []. - * - * @param arrayBody the List<String> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putEmptyAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putEmpty(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putEmptyDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get boolean array value [true, false, false, true]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getBooleanTfft() throws ErrorException, IOException { - Call call = service.getBooleanTfft(); - return getBooleanTfftDelegate(call.execute()); - } - - /** - * Get boolean array value [true, false, false, true]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getBooleanTfftAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getBooleanTfft(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getBooleanTfftDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getBooleanTfftDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value empty [true, false, false, true]. - * - * @param arrayBody the List<Boolean> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putBooleanTfft(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putBooleanTfft(arrayBody); - return putBooleanTfftDelegate(call.execute()); - } - - /** - * Set array value empty [true, false, false, true]. - * - * @param arrayBody the List<Boolean> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putBooleanTfftAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putBooleanTfft(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putBooleanTfftDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putBooleanTfftDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get boolean array value [true, null, false]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getBooleanInvalidNull() throws ErrorException, IOException { - Call call = service.getBooleanInvalidNull(); - return getBooleanInvalidNullDelegate(call.execute()); - } - - /** - * Get boolean array value [true, null, false]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getBooleanInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getBooleanInvalidNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getBooleanInvalidNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getBooleanInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get boolean array value [true, 'boolean', false]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getBooleanInvalidString() throws ErrorException, IOException { - Call call = service.getBooleanInvalidString(); - return getBooleanInvalidStringDelegate(call.execute()); - } - - /** - * Get boolean array value [true, 'boolean', false]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getBooleanInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getBooleanInvalidString(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getBooleanInvalidStringDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getBooleanInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get integer array value [1, -1, 3, 300]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getIntegerValid() throws ErrorException, IOException { - Call call = service.getIntegerValid(); - return getIntegerValidDelegate(call.execute()); - } - - /** - * Get integer array value [1, -1, 3, 300]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getIntegerValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getIntegerValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getIntegerValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getIntegerValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value empty [1, -1, 3, 300]. - * - * @param arrayBody the List<Integer> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putIntegerValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putIntegerValid(arrayBody); - return putIntegerValidDelegate(call.execute()); - } - - /** - * Set array value empty [1, -1, 3, 300]. - * - * @param arrayBody the List<Integer> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putIntegerValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putIntegerValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putIntegerValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putIntegerValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get integer array value [1, null, 0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getIntInvalidNull() throws ErrorException, IOException { - Call call = service.getIntInvalidNull(); - return getIntInvalidNullDelegate(call.execute()); - } - - /** - * Get integer array value [1, null, 0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getIntInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getIntInvalidNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getIntInvalidNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getIntInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get integer array value [1, 'integer', 0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getIntInvalidString() throws ErrorException, IOException { - Call call = service.getIntInvalidString(); - return getIntInvalidStringDelegate(call.execute()); - } - - /** - * Get integer array value [1, 'integer', 0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getIntInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getIntInvalidString(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getIntInvalidStringDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getIntInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get integer array value [1, -1, 3, 300]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getLongValid() throws ErrorException, IOException { - Call call = service.getLongValid(); - return getLongValidDelegate(call.execute()); - } - - /** - * Get integer array value [1, -1, 3, 300]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getLongValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getLongValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getLongValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getLongValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value empty [1, -1, 3, 300]. - * - * @param arrayBody the List<Long> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putLongValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putLongValid(arrayBody); - return putLongValidDelegate(call.execute()); - } - - /** - * Set array value empty [1, -1, 3, 300]. - * - * @param arrayBody the List<Long> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putLongValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putLongValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putLongValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putLongValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get long array value [1, null, 0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getLongInvalidNull() throws ErrorException, IOException { - Call call = service.getLongInvalidNull(); - return getLongInvalidNullDelegate(call.execute()); - } - - /** - * Get long array value [1, null, 0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getLongInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getLongInvalidNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getLongInvalidNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getLongInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get long array value [1, 'integer', 0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getLongInvalidString() throws ErrorException, IOException { - Call call = service.getLongInvalidString(); - return getLongInvalidStringDelegate(call.execute()); - } - - /** - * Get long array value [1, 'integer', 0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getLongInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getLongInvalidString(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getLongInvalidStringDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getLongInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get float array value [0, -0.01, 1.2e20]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getFloatValid() throws ErrorException, IOException { - Call call = service.getFloatValid(); - return getFloatValidDelegate(call.execute()); - } - - /** - * Get float array value [0, -0.01, 1.2e20]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getFloatValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getFloatValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getFloatValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getFloatValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value [0, -0.01, 1.2e20]. - * - * @param arrayBody the List<Double> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putFloatValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putFloatValid(arrayBody); - return putFloatValidDelegate(call.execute()); - } - - /** - * Set array value [0, -0.01, 1.2e20]. - * - * @param arrayBody the List<Double> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putFloatValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putFloatValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putFloatValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putFloatValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get float array value [0.0, null, -1.2e20]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getFloatInvalidNull() throws ErrorException, IOException { - Call call = service.getFloatInvalidNull(); - return getFloatInvalidNullDelegate(call.execute()); - } - - /** - * Get float array value [0.0, null, -1.2e20]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getFloatInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getFloatInvalidNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getFloatInvalidNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getFloatInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get boolean array value [1.0, 'number', 0.0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getFloatInvalidString() throws ErrorException, IOException { - Call call = service.getFloatInvalidString(); - return getFloatInvalidStringDelegate(call.execute()); - } - - /** - * Get boolean array value [1.0, 'number', 0.0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getFloatInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getFloatInvalidString(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getFloatInvalidStringDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getFloatInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get float array value [0, -0.01, 1.2e20]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDoubleValid() throws ErrorException, IOException { - Call call = service.getDoubleValid(); - return getDoubleValidDelegate(call.execute()); - } - - /** - * Get float array value [0, -0.01, 1.2e20]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDoubleValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDoubleValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDoubleValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDoubleValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value [0, -0.01, 1.2e20]. - * - * @param arrayBody the List<Double> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putDoubleValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putDoubleValid(arrayBody); - return putDoubleValidDelegate(call.execute()); - } - - /** - * Set array value [0, -0.01, 1.2e20]. - * - * @param arrayBody the List<Double> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putDoubleValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putDoubleValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putDoubleValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putDoubleValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get float array value [0.0, null, -1.2e20]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDoubleInvalidNull() throws ErrorException, IOException { - Call call = service.getDoubleInvalidNull(); - return getDoubleInvalidNullDelegate(call.execute()); - } - - /** - * Get float array value [0.0, null, -1.2e20]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDoubleInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDoubleInvalidNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDoubleInvalidNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDoubleInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get boolean array value [1.0, 'number', 0.0]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDoubleInvalidString() throws ErrorException, IOException { - Call call = service.getDoubleInvalidString(); - return getDoubleInvalidStringDelegate(call.execute()); - } - - /** - * Get boolean array value [1.0, 'number', 0.0]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDoubleInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDoubleInvalidString(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDoubleInvalidStringDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDoubleInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get string array value ['foo1', 'foo2', 'foo3']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<String> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getStringValid() throws ErrorException, IOException { - Call call = service.getStringValid(); - return getStringValidDelegate(call.execute()); - } - - /** - * Get string array value ['foo1', 'foo2', 'foo3']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getStringValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getStringValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getStringValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getStringValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value ['foo1', 'foo2', 'foo3']. - * - * @param arrayBody the List<String> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putStringValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putStringValid(arrayBody); - return putStringValidDelegate(call.execute()); - } - - /** - * Set array value ['foo1', 'foo2', 'foo3']. - * - * @param arrayBody the List<String> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putStringValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putStringValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putStringValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putStringValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get string array value ['foo', null, 'foo2']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<String> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getStringWithNull() throws ErrorException, IOException { - Call call = service.getStringWithNull(); - return getStringWithNullDelegate(call.execute()); - } - - /** - * Get string array value ['foo', null, 'foo2']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getStringWithNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getStringWithNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getStringWithNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getStringWithNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get string array value ['foo', 123, 'foo2']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<String> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getStringWithInvalid() throws ErrorException, IOException { - Call call = service.getStringWithInvalid(); - return getStringWithInvalidDelegate(call.execute()); - } - - /** - * Get string array value ['foo', 123, 'foo2']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getStringWithInvalidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getStringWithInvalid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getStringWithInvalidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getStringWithInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<UUID> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getUuidValid() throws ErrorException, IOException { - Call call = service.getUuidValid(); - return getUuidValidDelegate(call.execute()); - } - - /** - * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getUuidValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getUuidValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getUuidValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getUuidValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - * - * @param arrayBody the List<UUID> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putUuidValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putUuidValid(arrayBody); - return putUuidValidDelegate(call.execute()); - } - - /** - * Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - * - * @param arrayBody the List<UUID> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putUuidValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putUuidValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putUuidValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putUuidValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<UUID> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getUuidInvalidChars() throws ErrorException, IOException { - Call call = service.getUuidInvalidChars(); - return getUuidInvalidCharsDelegate(call.execute()); - } - - /** - * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getUuidInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getUuidInvalidChars(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getUuidInvalidCharsDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getUuidInvalidCharsDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDateValid() throws ErrorException, IOException { - Call call = service.getDateValid(); - return getDateValidDelegate(call.execute()); - } - - /** - * Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDateValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDateValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDateValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDateValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - * - * @param arrayBody the List<LocalDate> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putDateValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putDateValid(arrayBody); - return putDateValidDelegate(call.execute()); - } - - /** - * Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - * - * @param arrayBody the List<LocalDate> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putDateValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putDateValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putDateValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putDateValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get date array value ['2012-01-01', null, '1776-07-04']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDateInvalidNull() throws ErrorException, IOException { - Call call = service.getDateInvalidNull(); - return getDateInvalidNullDelegate(call.execute()); - } - - /** - * Get date array value ['2012-01-01', null, '1776-07-04']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDateInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDateInvalidNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDateInvalidNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDateInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get date array value ['2011-03-22', 'date']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDateInvalidChars() throws ErrorException, IOException { - Call call = service.getDateInvalidChars(); - return getDateInvalidCharsDelegate(call.execute()); - } - - /** - * Get date array value ['2011-03-22', 'date']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDateInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDateInvalidChars(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDateInvalidCharsDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDateInvalidCharsDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDateTimeValid() throws ErrorException, IOException { - Call call = service.getDateTimeValid(); - return getDateTimeValidDelegate(call.execute()); - } - - /** - * Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDateTimeValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDateTimeValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDateTimeValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDateTimeValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. - * - * @param arrayBody the List<DateTime> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putDateTimeValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putDateTimeValid(arrayBody); - return putDateTimeValidDelegate(call.execute()); - } - - /** - * Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. - * - * @param arrayBody the List<DateTime> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putDateTimeValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putDateTimeValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putDateTimeValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putDateTimeValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get date array value ['2000-12-01t00:00:01z', null]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDateTimeInvalidNull() throws ErrorException, IOException { - Call call = service.getDateTimeInvalidNull(); - return getDateTimeInvalidNullDelegate(call.execute()); - } - - /** - * Get date array value ['2000-12-01t00:00:01z', null]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDateTimeInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDateTimeInvalidNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDateTimeInvalidNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDateTimeInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get date array value ['2000-12-01t00:00:01z', 'date-time']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDateTimeInvalidChars() throws ErrorException, IOException { - Call call = service.getDateTimeInvalidChars(); - return getDateTimeInvalidCharsDelegate(call.execute()); - } - - /** - * Get date array value ['2000-12-01t00:00:01z', 'date-time']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDateTimeInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDateTimeInvalidChars(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDateTimeInvalidCharsDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDateTimeInvalidCharsDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDateTimeRfc1123Valid() throws ErrorException, IOException { - Call call = service.getDateTimeRfc1123Valid(); - ServiceResponse> response = getDateTimeRfc1123ValidDelegate(call.execute()); - List body = null; - if (response.getBody() != null) { - body = new ArrayList(); - for (DateTimeRfc1123 item : response.getBody()) { - DateTime value; - value = item.getDateTime(); - body.add(value); - } - } - return new ServiceResponse>(body, response.getResponse()); - } - - /** - * Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDateTimeRfc1123ValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDateTimeRfc1123Valid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - ServiceResponse> result = getDateTimeRfc1123ValidDelegate(response); - List body = null; - if (result.getBody() != null) { - body = new ArrayList(); - for (DateTimeRfc1123 item : result.getBody()) { - DateTime value; - value = item.getDateTime(); - body.add(value); - } - } - serviceCallback.success(new ServiceResponse>(body, result.getResponse())); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDateTimeRfc1123ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. - * - * @param arrayBody the List<DateTimeRfc1123> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putDateTimeRfc1123Valid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - List arrayBodyConverted = new ArrayList(); - for (DateTime item : arrayBody) { - DateTimeRfc1123 value = new DateTimeRfc1123(item); - arrayBodyConverted.add(value); - } - Call call = service.putDateTimeRfc1123Valid(arrayBodyConverted); - return putDateTimeRfc1123ValidDelegate(call.execute()); - } - - /** - * Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. - * - * @param arrayBody the List<DateTimeRfc1123> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putDateTimeRfc1123ValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - List arrayBodyConverted = new ArrayList(); - for (DateTime item : arrayBody) { - DateTimeRfc1123 value = new DateTimeRfc1123(item); - arrayBodyConverted.add(value); - } - Call call = service.putDateTimeRfc1123Valid(arrayBodyConverted); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putDateTimeRfc1123ValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putDateTimeRfc1123ValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Period> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getDurationValid() throws ErrorException, IOException { - Call call = service.getDurationValid(); - return getDurationValidDelegate(call.execute()); - } - - /** - * Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDurationValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDurationValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDurationValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getDurationValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - * - * @param arrayBody the List<Period> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putDurationValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putDurationValid(arrayBody); - return putDurationValidDelegate(call.execute()); - } - - /** - * Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - * - * @param arrayBody the List<Period> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putDurationValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putDurationValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putDurationValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putDurationValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<byte[]> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getByteValid() throws ErrorException, IOException { - Call call = service.getByteValid(); - return getByteValidDelegate(call.execute()); - } - - /** - * Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getByteValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getByteValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getByteValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getByteValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. - * - * @param arrayBody the List<byte[]> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putByteValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putByteValid(arrayBody); - return putByteValidDelegate(call.execute()); - } - - /** - * Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. - * - * @param arrayBody the List<byte[]> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putByteValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putByteValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putByteValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putByteValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<byte[]> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getByteInvalidNull() throws ErrorException, IOException { - Call call = service.getByteInvalidNull(); - return getByteInvalidNullDelegate(call.execute()); - } - - /** - * Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getByteInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getByteInvalidNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getByteInvalidNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getByteInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<String> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getBase64Url() throws ErrorException, IOException { - Call call = service.getBase64Url(); - return getBase64UrlDelegate(call.execute()); - } - - /** - * Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getBase64UrlAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getBase64Url(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getBase64UrlDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getBase64UrlDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get array of complex type null value. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getComplexNull() throws ErrorException, IOException { - Call call = service.getComplexNull(); - return getComplexNullDelegate(call.execute()); - } - - /** - * Get array of complex type null value. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getComplexNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getComplexNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getComplexNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getComplexNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get empty array of complex type []. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getComplexEmpty() throws ErrorException, IOException { - Call call = service.getComplexEmpty(); - return getComplexEmptyDelegate(call.execute()); - } - - /** - * Get empty array of complex type []. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getComplexEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getComplexEmpty(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getComplexEmptyDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getComplexEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getComplexItemNull() throws ErrorException, IOException { - Call call = service.getComplexItemNull(); - return getComplexItemNullDelegate(call.execute()); - } - - /** - * Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getComplexItemNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getComplexItemNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getComplexItemNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getComplexItemNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getComplexItemEmpty() throws ErrorException, IOException { - Call call = service.getComplexItemEmpty(); - return getComplexItemEmptyDelegate(call.execute()); - } - - /** - * Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getComplexItemEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getComplexItemEmpty(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getComplexItemEmptyDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getComplexItemEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse> getComplexValid() throws ErrorException, IOException { - Call call = service.getComplexValid(); - return getComplexValidDelegate(call.execute()); - } - - /** - * Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getComplexValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getComplexValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getComplexValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse> getComplexValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. - * - * @param arrayBody the List<Product> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putComplexValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putComplexValid(arrayBody); - return putComplexValidDelegate(call.execute()); - } - - /** - * Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. - * - * @param arrayBody the List<Product> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putComplexValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putComplexValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putComplexValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putComplexValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get a null array. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getArrayNull() throws ErrorException, IOException { - Call call = service.getArrayNull(); - return getArrayNullDelegate(call.execute()); - } - - /** - * Get a null array. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getArrayNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getArrayNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getArrayNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getArrayNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an empty array []. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getArrayEmpty() throws ErrorException, IOException { - Call call = service.getArrayEmpty(); - return getArrayEmptyDelegate(call.execute()); - } - - /** - * Get an empty array []. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getArrayEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getArrayEmpty(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getArrayEmptyDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getArrayEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getArrayItemNull() throws ErrorException, IOException { - Call call = service.getArrayItemNull(); - return getArrayItemNullDelegate(call.execute()); - } - - /** - * Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getArrayItemNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getArrayItemNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getArrayItemNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getArrayItemNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getArrayItemEmpty() throws ErrorException, IOException { - Call call = service.getArrayItemEmpty(); - return getArrayItemEmptyDelegate(call.execute()); - } - - /** - * Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getArrayItemEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getArrayItemEmpty(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getArrayItemEmptyDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getArrayItemEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getArrayValid() throws ErrorException, IOException { - Call call = service.getArrayValid(); - return getArrayValidDelegate(call.execute()); - } - - /** - * Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getArrayValidAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getArrayValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getArrayValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getArrayValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - * - * @param arrayBody the List<List<String>> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putArrayValid(List> arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putArrayValid(arrayBody); - return putArrayValidDelegate(call.execute()); - } - - /** - * Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - * - * @param arrayBody the List<List<String>> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putArrayValidAsync(List> arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putArrayValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putArrayValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putArrayValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an array of Dictionaries with value null. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getDictionaryNull() throws ErrorException, IOException { - Call call = service.getDictionaryNull(); - return getDictionaryNullDelegate(call.execute()); - } - - /** - * Get an array of Dictionaries with value null. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDictionaryNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDictionaryNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDictionaryNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getDictionaryNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an array of Dictionaries of type <string, string> with value []. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getDictionaryEmpty() throws ErrorException, IOException { - Call call = service.getDictionaryEmpty(); - return getDictionaryEmptyDelegate(call.execute()); - } - - /** - * Get an array of Dictionaries of type <string, string> with value []. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDictionaryEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDictionaryEmpty(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDictionaryEmptyDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getDictionaryEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getDictionaryItemNull() throws ErrorException, IOException { - Call call = service.getDictionaryItemNull(); - return getDictionaryItemNullDelegate(call.execute()); - } - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDictionaryItemNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDictionaryItemNull(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDictionaryItemNullDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getDictionaryItemNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getDictionaryItemEmpty() throws ErrorException, IOException { - Call call = service.getDictionaryItemEmpty(); - return getDictionaryItemEmptyDelegate(call.execute()); - } - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDictionaryItemEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDictionaryItemEmpty(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDictionaryItemEmptyDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getDictionaryItemEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. - */ - public ServiceResponse>> getDictionaryValid() throws ErrorException, IOException { - Call call = service.getDictionaryValid(); - return getDictionaryValidDelegate(call.execute()); - } - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall getDictionaryValidAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - Call call = service.getDictionaryValid(); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback>>(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(getDictionaryValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse>> getDictionaryValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) - .register(200, new TypeToken>>() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param arrayBody the List<Map<String, String>> value - * @throws ErrorException exception thrown from REST call - * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters - * @return the {@link ServiceResponse} object if successful. - */ - public ServiceResponse putDictionaryValid(List> arrayBody) throws ErrorException, IOException, IllegalArgumentException { - if (arrayBody == null) { - throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); - } - Validator.validate(arrayBody); - Call call = service.putDictionaryValid(arrayBody); - return putDictionaryValidDelegate(call.execute()); - } - - /** - * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - * - * @param arrayBody the List<Map<String, String>> value - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if callback is null - * @return the {@link Call} object - */ - public ServiceCall putDictionaryValidAsync(List> arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { - if (serviceCallback == null) { - throw new IllegalArgumentException("ServiceCallback is required for async calls."); - } - if (arrayBody == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); - return null; - } - Validator.validate(arrayBody, serviceCallback); - Call call = service.putDictionaryValid(arrayBody); - final ServiceCall serviceCall = new ServiceCall(call); - call.enqueue(new ServiceResponseCallback(serviceCallback) { - @Override - public void onResponse(Call call, Response response) { - try { - serviceCallback.success(putDictionaryValidDelegate(response)); - } catch (ErrorException | IOException exception) { - serviceCallback.failure(exception); - } - } - }); - return serviceCall; - } - - private ServiceResponse putDictionaryValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorException.class) - .build(response); - } - -} +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.bodyarray.implementation; + +import retrofit2.Retrofit; +import fixtures.bodyarray.Arrays; +import com.google.common.reflect.TypeToken; +import com.microsoft.rest.DateTimeRfc1123; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseBuilder; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.Validator; +import fixtures.bodyarray.models.ErrorException; +import fixtures.bodyarray.models.Product; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.Period; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Headers; +import retrofit2.http.PUT; +import retrofit2.Response; + +/** + * An instance of this class provides access to all the operations defined + * in Arrays. + */ +public final class ArraysImpl implements Arrays { + /** The Retrofit service to perform REST calls. */ + private ArraysService service; + /** The service client containing this operation class. */ + private AutoRestSwaggerBATArrayServiceImpl client; + + /** + * Initializes an instance of Arrays. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ArraysImpl(Retrofit retrofit, AutoRestSwaggerBATArrayServiceImpl client) { + this.service = retrofit.create(ArraysService.class); + this.client = client; + } + + /** + * The interface defining all the services for Arrays to be + * used by Retrofit to perform actually REST calls. + */ + interface ArraysService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/null") + Call getNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/invalid") + Call getInvalid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/empty") + Call getEmpty(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/empty") + Call putEmpty(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/boolean/tfft") + Call getBooleanTfft(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/boolean/tfft") + Call putBooleanTfft(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/boolean/true.null.false") + Call getBooleanInvalidNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/boolean/true.boolean.false") + Call getBooleanInvalidString(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/integer/1.-1.3.300") + Call getIntegerValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/integer/1.-1.3.300") + Call putIntegerValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/integer/1.null.zero") + Call getIntInvalidNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/integer/1.integer.0") + Call getIntInvalidString(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/long/1.-1.3.300") + Call getLongValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/long/1.-1.3.300") + Call putLongValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/long/1.null.zero") + Call getLongInvalidNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/long/1.integer.0") + Call getLongInvalidString(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/float/0--0.01-1.2e20") + Call getFloatValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/float/0--0.01-1.2e20") + Call putFloatValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/float/0.0-null-1.2e20") + Call getFloatInvalidNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/float/1.number.0") + Call getFloatInvalidString(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/double/0--0.01-1.2e20") + Call getDoubleValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/double/0--0.01-1.2e20") + Call putDoubleValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/double/0.0-null-1.2e20") + Call getDoubleInvalidNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/double/1.number.0") + Call getDoubleInvalidString(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/string/foo1.foo2.foo3") + Call getStringValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/string/foo1.foo2.foo3") + Call putStringValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/string/foo.null.foo2") + Call getStringWithNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/string/foo.123.foo2") + Call getStringWithInvalid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/uuid/valid") + Call getUuidValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/uuid/valid") + Call putUuidValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/uuid/invalidchars") + Call getUuidInvalidChars(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/date/valid") + Call getDateValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/date/valid") + Call putDateValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/date/invalidnull") + Call getDateInvalidNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/date/invalidchars") + Call getDateInvalidChars(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/date-time/valid") + Call getDateTimeValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/date-time/valid") + Call putDateTimeValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/date-time/invalidnull") + Call getDateTimeInvalidNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/date-time/invalidchars") + Call getDateTimeInvalidChars(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/date-time-rfc1123/valid") + Call getDateTimeRfc1123Valid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/date-time-rfc1123/valid") + Call putDateTimeRfc1123Valid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/duration/valid") + Call getDurationValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/duration/valid") + Call putDurationValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/byte/valid") + Call getByteValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/prim/byte/valid") + Call putByteValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/byte/invalidnull") + Call getByteInvalidNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/prim/base64url/valid") + Call getBase64Url(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/complex/null") + Call getComplexNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/complex/empty") + Call getComplexEmpty(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/complex/itemnull") + Call getComplexItemNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/complex/itemempty") + Call getComplexItemEmpty(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/complex/valid") + Call getComplexValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/complex/valid") + Call putComplexValid(@Body List arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/array/null") + Call getArrayNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/array/empty") + Call getArrayEmpty(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/array/itemnull") + Call getArrayItemNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/array/itemempty") + Call getArrayItemEmpty(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/array/valid") + Call getArrayValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/array/valid") + Call putArrayValid(@Body List> arrayBody); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/dictionary/null") + Call getDictionaryNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/dictionary/empty") + Call getDictionaryEmpty(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/dictionary/itemnull") + Call getDictionaryItemNull(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/dictionary/itemempty") + Call getDictionaryItemEmpty(); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("array/dictionary/valid") + Call getDictionaryValid(); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("array/dictionary/valid") + Call putDictionaryValid(@Body List> arrayBody); + + } + + /** + * Get null array value. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getNull() throws ErrorException, IOException { + Call call = service.getNull(); + return getNullDelegate(call.execute()); + } + + /** + * Get null array value. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get invalid array [1, 2, 3. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getInvalid() throws ErrorException, IOException { + Call call = service.getInvalid(); + return getInvalidDelegate(call.execute()); + } + + /** + * Get invalid array [1, 2, 3. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getInvalidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getInvalid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getInvalidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getInvalidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get empty array value []. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getEmpty() throws ErrorException, IOException { + Call call = service.getEmpty(); + return getEmptyDelegate(call.execute()); + } + + /** + * Get empty array value []. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getEmpty(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getEmptyDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getEmptyDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value empty []. + * + * @param arrayBody the List<String> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putEmpty(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putEmpty(arrayBody); + return putEmptyDelegate(call.execute()); + } + + /** + * Set array value empty []. + * + * @param arrayBody the List<String> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putEmptyAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putEmpty(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putEmptyDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get boolean array value [true, false, false, true]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getBooleanTfft() throws ErrorException, IOException { + Call call = service.getBooleanTfft(); + return getBooleanTfftDelegate(call.execute()); + } + + /** + * Get boolean array value [true, false, false, true]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getBooleanTfftAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getBooleanTfft(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getBooleanTfftDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getBooleanTfftDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value empty [true, false, false, true]. + * + * @param arrayBody the List<Boolean> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putBooleanTfft(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putBooleanTfft(arrayBody); + return putBooleanTfftDelegate(call.execute()); + } + + /** + * Set array value empty [true, false, false, true]. + * + * @param arrayBody the List<Boolean> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putBooleanTfftAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putBooleanTfft(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putBooleanTfftDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putBooleanTfftDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get boolean array value [true, null, false]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getBooleanInvalidNull() throws ErrorException, IOException { + Call call = service.getBooleanInvalidNull(); + return getBooleanInvalidNullDelegate(call.execute()); + } + + /** + * Get boolean array value [true, null, false]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getBooleanInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getBooleanInvalidNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getBooleanInvalidNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getBooleanInvalidNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get boolean array value [true, 'boolean', false]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Boolean> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getBooleanInvalidString() throws ErrorException, IOException { + Call call = service.getBooleanInvalidString(); + return getBooleanInvalidStringDelegate(call.execute()); + } + + /** + * Get boolean array value [true, 'boolean', false]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getBooleanInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getBooleanInvalidString(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getBooleanInvalidStringDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getBooleanInvalidStringDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get integer array value [1, -1, 3, 300]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getIntegerValid() throws ErrorException, IOException { + Call call = service.getIntegerValid(); + return getIntegerValidDelegate(call.execute()); + } + + /** + * Get integer array value [1, -1, 3, 300]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getIntegerValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getIntegerValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getIntegerValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getIntegerValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value empty [1, -1, 3, 300]. + * + * @param arrayBody the List<Integer> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putIntegerValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putIntegerValid(arrayBody); + return putIntegerValidDelegate(call.execute()); + } + + /** + * Set array value empty [1, -1, 3, 300]. + * + * @param arrayBody the List<Integer> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putIntegerValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putIntegerValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putIntegerValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putIntegerValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get integer array value [1, null, 0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getIntInvalidNull() throws ErrorException, IOException { + Call call = service.getIntInvalidNull(); + return getIntInvalidNullDelegate(call.execute()); + } + + /** + * Get integer array value [1, null, 0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getIntInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getIntInvalidNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getIntInvalidNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getIntInvalidNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get integer array value [1, 'integer', 0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Integer> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getIntInvalidString() throws ErrorException, IOException { + Call call = service.getIntInvalidString(); + return getIntInvalidStringDelegate(call.execute()); + } + + /** + * Get integer array value [1, 'integer', 0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getIntInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getIntInvalidString(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getIntInvalidStringDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getIntInvalidStringDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get integer array value [1, -1, 3, 300]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getLongValid() throws ErrorException, IOException { + Call call = service.getLongValid(); + return getLongValidDelegate(call.execute()); + } + + /** + * Get integer array value [1, -1, 3, 300]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getLongValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getLongValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getLongValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getLongValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value empty [1, -1, 3, 300]. + * + * @param arrayBody the List<Long> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putLongValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putLongValid(arrayBody); + return putLongValidDelegate(call.execute()); + } + + /** + * Set array value empty [1, -1, 3, 300]. + * + * @param arrayBody the List<Long> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putLongValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putLongValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putLongValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putLongValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get long array value [1, null, 0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getLongInvalidNull() throws ErrorException, IOException { + Call call = service.getLongInvalidNull(); + return getLongInvalidNullDelegate(call.execute()); + } + + /** + * Get long array value [1, null, 0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getLongInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getLongInvalidNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getLongInvalidNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getLongInvalidNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get long array value [1, 'integer', 0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Long> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getLongInvalidString() throws ErrorException, IOException { + Call call = service.getLongInvalidString(); + return getLongInvalidStringDelegate(call.execute()); + } + + /** + * Get long array value [1, 'integer', 0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getLongInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getLongInvalidString(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getLongInvalidStringDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getLongInvalidStringDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get float array value [0, -0.01, 1.2e20]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getFloatValid() throws ErrorException, IOException { + Call call = service.getFloatValid(); + return getFloatValidDelegate(call.execute()); + } + + /** + * Get float array value [0, -0.01, 1.2e20]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getFloatValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getFloatValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getFloatValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getFloatValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value [0, -0.01, 1.2e20]. + * + * @param arrayBody the List<Double> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putFloatValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putFloatValid(arrayBody); + return putFloatValidDelegate(call.execute()); + } + + /** + * Set array value [0, -0.01, 1.2e20]. + * + * @param arrayBody the List<Double> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putFloatValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putFloatValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putFloatValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putFloatValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get float array value [0.0, null, -1.2e20]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getFloatInvalidNull() throws ErrorException, IOException { + Call call = service.getFloatInvalidNull(); + return getFloatInvalidNullDelegate(call.execute()); + } + + /** + * Get float array value [0.0, null, -1.2e20]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getFloatInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getFloatInvalidNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getFloatInvalidNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getFloatInvalidNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get boolean array value [1.0, 'number', 0.0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getFloatInvalidString() throws ErrorException, IOException { + Call call = service.getFloatInvalidString(); + return getFloatInvalidStringDelegate(call.execute()); + } + + /** + * Get boolean array value [1.0, 'number', 0.0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getFloatInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getFloatInvalidString(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getFloatInvalidStringDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getFloatInvalidStringDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get float array value [0, -0.01, 1.2e20]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDoubleValid() throws ErrorException, IOException { + Call call = service.getDoubleValid(); + return getDoubleValidDelegate(call.execute()); + } + + /** + * Get float array value [0, -0.01, 1.2e20]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDoubleValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDoubleValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDoubleValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDoubleValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value [0, -0.01, 1.2e20]. + * + * @param arrayBody the List<Double> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putDoubleValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putDoubleValid(arrayBody); + return putDoubleValidDelegate(call.execute()); + } + + /** + * Set array value [0, -0.01, 1.2e20]. + * + * @param arrayBody the List<Double> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putDoubleValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putDoubleValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putDoubleValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putDoubleValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get float array value [0.0, null, -1.2e20]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDoubleInvalidNull() throws ErrorException, IOException { + Call call = service.getDoubleInvalidNull(); + return getDoubleInvalidNullDelegate(call.execute()); + } + + /** + * Get float array value [0.0, null, -1.2e20]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDoubleInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDoubleInvalidNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDoubleInvalidNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDoubleInvalidNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get boolean array value [1.0, 'number', 0.0]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Double> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDoubleInvalidString() throws ErrorException, IOException { + Call call = service.getDoubleInvalidString(); + return getDoubleInvalidStringDelegate(call.execute()); + } + + /** + * Get boolean array value [1.0, 'number', 0.0]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDoubleInvalidStringAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDoubleInvalidString(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDoubleInvalidStringDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDoubleInvalidStringDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get string array value ['foo1', 'foo2', 'foo3']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<String> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getStringValid() throws ErrorException, IOException { + Call call = service.getStringValid(); + return getStringValidDelegate(call.execute()); + } + + /** + * Get string array value ['foo1', 'foo2', 'foo3']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getStringValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getStringValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getStringValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getStringValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value ['foo1', 'foo2', 'foo3']. + * + * @param arrayBody the List<String> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putStringValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putStringValid(arrayBody); + return putStringValidDelegate(call.execute()); + } + + /** + * Set array value ['foo1', 'foo2', 'foo3']. + * + * @param arrayBody the List<String> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putStringValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putStringValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putStringValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putStringValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get string array value ['foo', null, 'foo2']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<String> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getStringWithNull() throws ErrorException, IOException { + Call call = service.getStringWithNull(); + return getStringWithNullDelegate(call.execute()); + } + + /** + * Get string array value ['foo', null, 'foo2']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getStringWithNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getStringWithNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getStringWithNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getStringWithNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get string array value ['foo', 123, 'foo2']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<String> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getStringWithInvalid() throws ErrorException, IOException { + Call call = service.getStringWithInvalid(); + return getStringWithInvalidDelegate(call.execute()); + } + + /** + * Get string array value ['foo', 123, 'foo2']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getStringWithInvalidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getStringWithInvalid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getStringWithInvalidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getStringWithInvalidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<UUID> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getUuidValid() throws ErrorException, IOException { + Call call = service.getUuidValid(); + return getUuidValidDelegate(call.execute()); + } + + /** + * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getUuidValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getUuidValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getUuidValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getUuidValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. + * + * @param arrayBody the List<UUID> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putUuidValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putUuidValid(arrayBody); + return putUuidValidDelegate(call.execute()); + } + + /** + * Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. + * + * @param arrayBody the List<UUID> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putUuidValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putUuidValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putUuidValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putUuidValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<UUID> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getUuidInvalidChars() throws ErrorException, IOException { + Call call = service.getUuidInvalidChars(); + return getUuidInvalidCharsDelegate(call.execute()); + } + + /** + * Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getUuidInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getUuidInvalidChars(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getUuidInvalidCharsDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getUuidInvalidCharsDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDateValid() throws ErrorException, IOException { + Call call = service.getDateValid(); + return getDateValidDelegate(call.execute()); + } + + /** + * Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDateValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDateValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDateValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDateValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. + * + * @param arrayBody the List<LocalDate> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putDateValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putDateValid(arrayBody); + return putDateValidDelegate(call.execute()); + } + + /** + * Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. + * + * @param arrayBody the List<LocalDate> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putDateValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putDateValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putDateValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putDateValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get date array value ['2012-01-01', null, '1776-07-04']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDateInvalidNull() throws ErrorException, IOException { + Call call = service.getDateInvalidNull(); + return getDateInvalidNullDelegate(call.execute()); + } + + /** + * Get date array value ['2012-01-01', null, '1776-07-04']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDateInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDateInvalidNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDateInvalidNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDateInvalidNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get date array value ['2011-03-22', 'date']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<LocalDate> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDateInvalidChars() throws ErrorException, IOException { + Call call = service.getDateInvalidChars(); + return getDateInvalidCharsDelegate(call.execute()); + } + + /** + * Get date array value ['2011-03-22', 'date']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDateInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDateInvalidChars(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDateInvalidCharsDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDateInvalidCharsDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDateTimeValid() throws ErrorException, IOException { + Call call = service.getDateTimeValid(); + return getDateTimeValidDelegate(call.execute()); + } + + /** + * Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDateTimeValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDateTimeValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDateTimeValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDateTimeValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. + * + * @param arrayBody the List<DateTime> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putDateTimeValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putDateTimeValid(arrayBody); + return putDateTimeValidDelegate(call.execute()); + } + + /** + * Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. + * + * @param arrayBody the List<DateTime> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putDateTimeValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putDateTimeValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putDateTimeValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putDateTimeValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get date array value ['2000-12-01t00:00:01z', null]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDateTimeInvalidNull() throws ErrorException, IOException { + Call call = service.getDateTimeInvalidNull(); + return getDateTimeInvalidNullDelegate(call.execute()); + } + + /** + * Get date array value ['2000-12-01t00:00:01z', null]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDateTimeInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDateTimeInvalidNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDateTimeInvalidNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDateTimeInvalidNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get date array value ['2000-12-01t00:00:01z', 'date-time']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDateTimeInvalidChars() throws ErrorException, IOException { + Call call = service.getDateTimeInvalidChars(); + return getDateTimeInvalidCharsDelegate(call.execute()); + } + + /** + * Get date array value ['2000-12-01t00:00:01z', 'date-time']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDateTimeInvalidCharsAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDateTimeInvalidChars(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDateTimeInvalidCharsDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDateTimeInvalidCharsDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<DateTime> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDateTimeRfc1123Valid() throws ErrorException, IOException { + Call call = service.getDateTimeRfc1123Valid(); + ServiceResponse> response = getDateTimeRfc1123ValidDelegate(call.execute()); + List body = null; + if (response.getBody() != null) { + body = new ArrayList(); + for (DateTimeRfc1123 item : response.getBody()) { + DateTime value; + value = item.getDateTime(); + body.add(value); + } + } + return new ServiceResponse>(body, response.getResponse()); + } + + /** + * Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDateTimeRfc1123ValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDateTimeRfc1123Valid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = getDateTimeRfc1123ValidDelegate(response); + List body = null; + if (result.getBody() != null) { + body = new ArrayList(); + for (DateTimeRfc1123 item : result.getBody()) { + DateTime value; + value = item.getDateTime(); + body.add(value); + } + } + serviceCallback.success(new ServiceResponse>(body, result.getResponse())); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDateTimeRfc1123ValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. + * + * @param arrayBody the List<DateTimeRfc1123> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putDateTimeRfc1123Valid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + List arrayBodyConverted = new ArrayList(); + for (DateTime item : arrayBody) { + DateTimeRfc1123 value = new DateTimeRfc1123(item); + arrayBodyConverted.add(value); + } + Call call = service.putDateTimeRfc1123Valid(arrayBodyConverted); + return putDateTimeRfc1123ValidDelegate(call.execute()); + } + + /** + * Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. + * + * @param arrayBody the List<DateTimeRfc1123> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putDateTimeRfc1123ValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + List arrayBodyConverted = new ArrayList(); + for (DateTime item : arrayBody) { + DateTimeRfc1123 value = new DateTimeRfc1123(item); + arrayBodyConverted.add(value); + } + Call call = service.putDateTimeRfc1123Valid(arrayBodyConverted); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putDateTimeRfc1123ValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putDateTimeRfc1123ValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Period> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getDurationValid() throws ErrorException, IOException { + Call call = service.getDurationValid(); + return getDurationValidDelegate(call.execute()); + } + + /** + * Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDurationValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDurationValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDurationValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getDurationValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. + * + * @param arrayBody the List<Period> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putDurationValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putDurationValid(arrayBody); + return putDurationValidDelegate(call.execute()); + } + + /** + * Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. + * + * @param arrayBody the List<Period> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putDurationValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putDurationValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putDurationValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putDurationValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<byte[]> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getByteValid() throws ErrorException, IOException { + Call call = service.getByteValid(); + return getByteValidDelegate(call.execute()); + } + + /** + * Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getByteValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getByteValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getByteValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getByteValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. + * + * @param arrayBody the List<byte[]> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putByteValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putByteValid(arrayBody); + return putByteValidDelegate(call.execute()); + } + + /** + * Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. + * + * @param arrayBody the List<byte[]> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putByteValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putByteValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putByteValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putByteValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<byte[]> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getByteInvalidNull() throws ErrorException, IOException { + Call call = service.getByteInvalidNull(); + return getByteInvalidNullDelegate(call.execute()); + } + + /** + * Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getByteInvalidNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getByteInvalidNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getByteInvalidNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getByteInvalidNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<String> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getBase64Url() throws ErrorException, IOException { + Call call = service.getBase64Url(); + return getBase64UrlDelegate(call.execute()); + } + + /** + * Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getBase64UrlAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getBase64Url(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getBase64UrlDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getBase64UrlDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get array of complex type null value. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getComplexNull() throws ErrorException, IOException { + Call call = service.getComplexNull(); + return getComplexNullDelegate(call.execute()); + } + + /** + * Get array of complex type null value. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getComplexNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getComplexNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getComplexNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getComplexNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get empty array of complex type []. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getComplexEmpty() throws ErrorException, IOException { + Call call = service.getComplexEmpty(); + return getComplexEmptyDelegate(call.execute()); + } + + /** + * Get empty array of complex type []. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getComplexEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getComplexEmpty(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getComplexEmptyDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getComplexEmptyDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getComplexItemNull() throws ErrorException, IOException { + Call call = service.getComplexItemNull(); + return getComplexItemNullDelegate(call.execute()); + } + + /** + * Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getComplexItemNullAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getComplexItemNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getComplexItemNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getComplexItemNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getComplexItemEmpty() throws ErrorException, IOException { + Call call = service.getComplexItemEmpty(); + return getComplexItemEmptyDelegate(call.execute()); + } + + /** + * Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getComplexItemEmptyAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getComplexItemEmpty(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getComplexItemEmptyDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getComplexItemEmptyDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Product> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> getComplexValid() throws ErrorException, IOException { + Call call = service.getComplexValid(); + return getComplexValidDelegate(call.execute()); + } + + /** + * Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getComplexValidAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getComplexValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getComplexValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> getComplexValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. + * + * @param arrayBody the List<Product> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putComplexValid(List arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putComplexValid(arrayBody); + return putComplexValidDelegate(call.execute()); + } + + /** + * Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. + * + * @param arrayBody the List<Product> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putComplexValidAsync(List arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putComplexValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putComplexValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putComplexValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get a null array. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getArrayNull() throws ErrorException, IOException { + Call call = service.getArrayNull(); + return getArrayNullDelegate(call.execute()); + } + + /** + * Get a null array. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getArrayNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getArrayNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getArrayNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getArrayNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an empty array []. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getArrayEmpty() throws ErrorException, IOException { + Call call = service.getArrayEmpty(); + return getArrayEmptyDelegate(call.execute()); + } + + /** + * Get an empty array []. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getArrayEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getArrayEmpty(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getArrayEmptyDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getArrayEmptyDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getArrayItemNull() throws ErrorException, IOException { + Call call = service.getArrayItemNull(); + return getArrayItemNullDelegate(call.execute()); + } + + /** + * Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getArrayItemNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getArrayItemNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getArrayItemNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getArrayItemNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getArrayItemEmpty() throws ErrorException, IOException { + Call call = service.getArrayItemEmpty(); + return getArrayItemEmptyDelegate(call.execute()); + } + + /** + * Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getArrayItemEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getArrayItemEmpty(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getArrayItemEmptyDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getArrayItemEmptyDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<List<String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getArrayValid() throws ErrorException, IOException { + Call call = service.getArrayValid(); + return getArrayValidDelegate(call.execute()); + } + + /** + * Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getArrayValidAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getArrayValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getArrayValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getArrayValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. + * + * @param arrayBody the List<List<String>> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putArrayValid(List> arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putArrayValid(arrayBody); + return putArrayValidDelegate(call.execute()); + } + + /** + * Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. + * + * @param arrayBody the List<List<String>> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putArrayValidAsync(List> arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putArrayValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putArrayValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putArrayValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an array of Dictionaries with value null. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getDictionaryNull() throws ErrorException, IOException { + Call call = service.getDictionaryNull(); + return getDictionaryNullDelegate(call.execute()); + } + + /** + * Get an array of Dictionaries with value null. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDictionaryNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDictionaryNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDictionaryNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getDictionaryNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an array of Dictionaries of type <string, string> with value []. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getDictionaryEmpty() throws ErrorException, IOException { + Call call = service.getDictionaryEmpty(); + return getDictionaryEmptyDelegate(call.execute()); + } + + /** + * Get an array of Dictionaries of type <string, string> with value []. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDictionaryEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDictionaryEmpty(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDictionaryEmptyDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getDictionaryEmptyDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getDictionaryItemNull() throws ErrorException, IOException { + Call call = service.getDictionaryItemNull(); + return getDictionaryItemNullDelegate(call.execute()); + } + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDictionaryItemNullAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDictionaryItemNull(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDictionaryItemNullDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getDictionaryItemNullDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getDictionaryItemEmpty() throws ErrorException, IOException { + Call call = service.getDictionaryItemEmpty(); + return getDictionaryItemEmptyDelegate(call.execute()); + } + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDictionaryItemEmptyAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDictionaryItemEmpty(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDictionaryItemEmptyDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getDictionaryItemEmptyDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @return the List<Map<String, String>> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse>> getDictionaryValid() throws ErrorException, IOException { + Call call = service.getDictionaryValid(); + return getDictionaryValidDelegate(call.execute()); + } + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getDictionaryValidAsync(final ServiceCallback>> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + Call call = service.getDictionaryValid(); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getDictionaryValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse>> getDictionaryValidDelegate(Response response) throws ErrorException, IOException { + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) + .register(200, new TypeToken>>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param arrayBody the List<Map<String, String>> value + * @throws ErrorException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse putDictionaryValid(List> arrayBody) throws ErrorException, IOException, IllegalArgumentException { + if (arrayBody == null) { + throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); + } + Validator.validate(arrayBody); + Call call = service.putDictionaryValid(arrayBody); + return putDictionaryValidDelegate(call.execute()); + } + + /** + * Get an array of Dictionaries of type <string, string> with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. + * + * @param arrayBody the List<Map<String, String>> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall putDictionaryValidAsync(List> arrayBody, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (arrayBody == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter arrayBody is required and cannot be null.")); + return null; + } + Validator.validate(arrayBody, serviceCallback); + Call call = service.putDictionaryValid(arrayBody); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(putDictionaryValidDelegate(response)); + } catch (ErrorException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse putDictionaryValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return new ServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/AutoRestSwaggerBATArrayServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/implementation/AutoRestSwaggerBATArrayServiceImpl.java similarity index 51% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/AutoRestSwaggerBATArrayServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/implementation/AutoRestSwaggerBATArrayServiceImpl.java index 40fba451c5812..da65b77deca52 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/AutoRestSwaggerBATArrayServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/implementation/AutoRestSwaggerBATArrayServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodyarray; +package fixtures.bodyarray.implementation; +import fixtures.bodyarray.AutoRestSwaggerBATArrayService; +import fixtures.bodyarray.Arrays; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestSwaggerBATArrayService class. */ public final class AutoRestSwaggerBATArrayServiceImpl extends ServiceClient implements AutoRestSwaggerBATArrayService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Arrays object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Arrays arrays; /** - * Gets the ArrayOperations object to access its operations. - * @return the ArrayOperations object. + * Gets the Arrays object to access its operations. + * @return the Arrays object. */ - public ArrayOperations getArrayOperations() { - return new ArrayOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Arrays arrays() { + return this.arrays; } /** @@ -54,8 +47,18 @@ public AutoRestSwaggerBATArrayServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestSwaggerBATArrayServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestSwaggerBATArrayService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestSwaggerBATArrayServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestSwaggerBATArrayServiceImpl(String baseUrl) { * Initializes an instance of AutoRestSwaggerBATArrayService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestSwaggerBATArrayServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestSwaggerBATArrayServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.arrays = new ArraysImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/implementation/package-info.java new file mode 100644 index 0000000000000..e34efad38e579 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestSwaggerBATArrayService. + * Test Infrastructure for AutoRest Swagger BAT. + */ +package fixtures.bodyarray.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/Error.java index 7eff1471ddeb6..de015c3393b48 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/ErrorException.java index cb2b5576a093d..c5ec02b3c168e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodyarray.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/Product.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/Product.java index 4f2f7e569fe25..3cd9a7f406214 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/Product.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/Product.java @@ -32,7 +32,7 @@ public class Product { * * @return the integer value */ - public Integer getInteger() { + public Integer integer() { return this.integer; } @@ -40,9 +40,11 @@ public Integer getInteger() { * Set the integer value. * * @param integer the integer value to set + * @return the Product object itself. */ - public void setInteger(Integer integer) { + public Product withInteger(Integer integer) { this.integer = integer; + return this; } /** @@ -50,7 +52,7 @@ public void setInteger(Integer integer) { * * @return the stringProperty value */ - public String getStringProperty() { + public String stringProperty() { return this.stringProperty; } @@ -58,9 +60,11 @@ public String getStringProperty() { * Set the stringProperty value. * * @param stringProperty the stringProperty value to set + * @return the Product object itself. */ - public void setStringProperty(String stringProperty) { + public Product withStringProperty(String stringProperty) { this.stringProperty = stringProperty; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/package-info.java index 193bdd31e08b8..90bf75b8381ea 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestSwaggerBATArrayService. + * This package contains the models classes for AutoRestSwaggerBATArrayService. * Test Infrastructure for AutoRest Swagger BAT. */ package fixtures.bodyarray.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/AutoRestBoolTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/AutoRestBoolTestService.java index 8309fd526a34f..079543f14df47 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/AutoRestBoolTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/AutoRestBoolTestService.java @@ -10,49 +10,20 @@ package fixtures.bodyboolean; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestBoolTestService class. */ public interface AutoRestBoolTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Bools object to access its operations. + * @return the Bools object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the BoolOperations object to access its operations. - * @return the BoolOperations object. - */ - BoolOperations getBoolOperations(); + Bools bools(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/BoolOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/Bools.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/BoolOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/Bools.java index 15e2e11de56bd..068dbb087c956 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/BoolOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/Bools.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in BoolOperations. + * in Bools. */ -public interface BoolOperations { +public interface Bools { /** * Get true Boolean value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/AutoRestBoolTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/implementation/AutoRestBoolTestServiceImpl.java similarity index 51% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/AutoRestBoolTestServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/implementation/AutoRestBoolTestServiceImpl.java index 00aeca2dbc057..94168014dd500 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/AutoRestBoolTestServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/implementation/AutoRestBoolTestServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodyboolean; +package fixtures.bodyboolean.implementation; +import fixtures.bodyboolean.AutoRestBoolTestService; +import fixtures.bodyboolean.Bools; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestBoolTestService class. */ public final class AutoRestBoolTestServiceImpl extends ServiceClient implements AutoRestBoolTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Bools object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Bools bools; /** - * Gets the BoolOperations object to access its operations. - * @return the BoolOperations object. + * Gets the Bools object to access its operations. + * @return the Bools object. */ - public BoolOperations getBoolOperations() { - return new BoolOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Bools bools() { + return this.bools; } /** @@ -54,8 +47,18 @@ public AutoRestBoolTestServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestBoolTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestBoolTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestBoolTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestBoolTestServiceImpl(String baseUrl) { * Initializes an instance of AutoRestBoolTestService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestBoolTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestBoolTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.bools = new BoolsImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/BoolOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/implementation/BoolsImpl.java similarity index 95% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/BoolOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/implementation/BoolsImpl.java index 5c3107666e0bc..b99a6b834ad1d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/BoolOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/implementation/BoolsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodyboolean; +package fixtures.bodyboolean.implementation; +import retrofit2.Retrofit; +import fixtures.bodyboolean.Bools; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -25,34 +27,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in BoolOperations. + * in Bools. */ -public final class BoolOperationsImpl implements BoolOperations { +public final class BoolsImpl implements Bools { /** The Retrofit service to perform REST calls. */ - private BoolService service; + private BoolsService service; /** The service client containing this operation class. */ - private AutoRestBoolTestService client; + private AutoRestBoolTestServiceImpl client; /** - * Initializes an instance of BoolOperations. + * Initializes an instance of Bools. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public BoolOperationsImpl(Retrofit retrofit, AutoRestBoolTestService client) { - this.service = retrofit.create(BoolService.class); + public BoolsImpl(Retrofit retrofit, AutoRestBoolTestServiceImpl client) { + this.service = retrofit.create(BoolsService.class); this.client = client; } /** - * The interface defining all the services for BoolOperations to be + * The interface defining all the services for Bools to be * used by Retrofit to perform actually REST calls. */ - interface BoolService { + interface BoolsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("bool/true") Call getTrue(); @@ -118,7 +119,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getTrueDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -165,7 +166,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putTrueDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -210,7 +211,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getFalseDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -257,7 +258,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putFalseDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -302,7 +303,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -347,7 +348,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/implementation/package-info.java new file mode 100644 index 0000000000000..8ff6929e772e6 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestBoolTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.bodyboolean.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/Error.java index 2eb9fd190f3e7..366b531c48572 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/ErrorException.java index 214e2a4f9c491..700cf00af2c27 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodyboolean.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/package-info.java index 7a4053dfa5bad..dd217d840e4dc 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestBoolTestService. + * This package contains the models classes for AutoRestBoolTestService. * Test Infrastructure for AutoRest. */ package fixtures.bodyboolean.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/AutoRestSwaggerBATByteService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/AutoRestSwaggerBATByteService.java index 741a41b9b5b4c..ed408f26c0fd1 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/AutoRestSwaggerBATByteService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/AutoRestSwaggerBATByteService.java @@ -10,49 +10,20 @@ package fixtures.bodybyte; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestSwaggerBATByteService class. */ public interface AutoRestSwaggerBATByteService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Bytes object to access its operations. + * @return the Bytes object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the ByteOperations object to access its operations. - * @return the ByteOperations object. - */ - ByteOperations getByteOperations(); + Bytes bytes(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/ByteOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/Bytes.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/ByteOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/Bytes.java index 3dc8214b633c5..3df8e4ea5ea37 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/ByteOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/Bytes.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in ByteOperations. + * in Bytes. */ -public interface ByteOperations { +public interface Bytes { /** * Get null byte value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/AutoRestSwaggerBATByteServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/implementation/AutoRestSwaggerBATByteServiceImpl.java similarity index 51% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/AutoRestSwaggerBATByteServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/implementation/AutoRestSwaggerBATByteServiceImpl.java index 7d0154870ef79..8fbed20b36dbf 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/AutoRestSwaggerBATByteServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/implementation/AutoRestSwaggerBATByteServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodybyte; +package fixtures.bodybyte.implementation; +import fixtures.bodybyte.AutoRestSwaggerBATByteService; +import fixtures.bodybyte.Bytes; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestSwaggerBATByteService class. */ public final class AutoRestSwaggerBATByteServiceImpl extends ServiceClient implements AutoRestSwaggerBATByteService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Bytes object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Bytes bytes; /** - * Gets the ByteOperations object to access its operations. - * @return the ByteOperations object. + * Gets the Bytes object to access its operations. + * @return the Bytes object. */ - public ByteOperations getByteOperations() { - return new ByteOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Bytes bytes() { + return this.bytes; } /** @@ -54,8 +47,18 @@ public AutoRestSwaggerBATByteServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestSwaggerBATByteServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestSwaggerBATByteService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestSwaggerBATByteServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestSwaggerBATByteServiceImpl(String baseUrl) { * Initializes an instance of AutoRestSwaggerBATByteService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestSwaggerBATByteServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestSwaggerBATByteServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.bytes = new BytesImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/ByteOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/implementation/BytesImpl.java similarity index 95% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/ByteOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/implementation/BytesImpl.java index 89b3b20b828b3..6a9d1b2ec9dca 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/ByteOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/implementation/BytesImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodybyte; +package fixtures.bodybyte.implementation; +import retrofit2.Retrofit; +import fixtures.bodybyte.Bytes; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -25,34 +27,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in ByteOperations. + * in Bytes. */ -public final class ByteOperationsImpl implements ByteOperations { +public final class BytesImpl implements Bytes { /** The Retrofit service to perform REST calls. */ - private ByteService service; + private BytesService service; /** The service client containing this operation class. */ - private AutoRestSwaggerBATByteService client; + private AutoRestSwaggerBATByteServiceImpl client; /** - * Initializes an instance of ByteOperations. + * Initializes an instance of Bytes. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ByteOperationsImpl(Retrofit retrofit, AutoRestSwaggerBATByteService client) { - this.service = retrofit.create(ByteService.class); + public BytesImpl(Retrofit retrofit, AutoRestSwaggerBATByteServiceImpl client) { + this.service = retrofit.create(BytesService.class); this.client = client; } /** - * The interface defining all the services for ByteOperations to be + * The interface defining all the services for Bytes to be * used by Retrofit to perform actually REST calls. */ - interface ByteService { + interface BytesService { @Headers("Content-Type: application/json; charset=utf-8") @GET("byte/null") Call getNull(); @@ -114,7 +115,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -159,7 +160,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -204,7 +205,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNonAsciiDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -259,7 +260,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putNonAsciiDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -304,7 +305,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/implementation/package-info.java new file mode 100644 index 0000000000000..81438a2fe35f1 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestSwaggerBATByteService. + * Test Infrastructure for AutoRest Swagger BAT. + */ +package fixtures.bodybyte.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/Error.java index 5cf45dba62d25..17359ba693a03 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/ErrorException.java index a93b379fcd31b..2a9ca4d3681e0 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodybyte.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/package-info.java index de3276aaee638..0fbd131704373 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodybyte/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestSwaggerBATByteService. + * This package contains the models classes for AutoRestSwaggerBATByteService. * Test Infrastructure for AutoRest Swagger BAT. */ package fixtures.bodybyte.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ArrayOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Arrays.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ArrayOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Arrays.java index dc9b9b8b18746..09c083cf70e96 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ArrayOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Arrays.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in ArrayOperations. + * in Arrays. */ -public interface ArrayOperations { +public interface Arrays { /** * Get complex types with array property. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/AutoRestComplexTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/AutoRestComplexTestService.java index bde519cdf7d86..ceb29f3bec7e0 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/AutoRestComplexTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/AutoRestComplexTestService.java @@ -10,105 +10,77 @@ package fixtures.bodycomplex; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestComplexTestService class. */ public interface AutoRestComplexTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * The default base URL. */ - JacksonMapperAdapter getMapperAdapter(); + String DEFAULT_BASE_URL = "http://localhost"; /** * Gets API ID.. * * @return the apiVersion value. */ - String getApiVersion(); + String apiVersion(); /** * Sets API ID.. * * @param apiVersion the apiVersion value. + * @return the service client itself */ - void setApiVersion(String apiVersion); + AutoRestComplexTestService withApiVersion(String apiVersion); /** - * Gets the BasicOperations object to access its operations. - * @return the BasicOperations object. + * Gets the Basics object to access its operations. + * @return the Basics object. */ - BasicOperations getBasicOperations(); + Basics basics(); /** - * Gets the PrimitiveOperations object to access its operations. - * @return the PrimitiveOperations object. + * Gets the Primitives object to access its operations. + * @return the Primitives object. */ - PrimitiveOperations getPrimitiveOperations(); + Primitives primitives(); /** - * Gets the ArrayOperations object to access its operations. - * @return the ArrayOperations object. + * Gets the Arrays object to access its operations. + * @return the Arrays object. */ - ArrayOperations getArrayOperations(); + Arrays arrays(); /** - * Gets the DictionaryOperations object to access its operations. - * @return the DictionaryOperations object. + * Gets the Dictionarys object to access its operations. + * @return the Dictionarys object. */ - DictionaryOperations getDictionaryOperations(); + Dictionarys dictionarys(); /** - * Gets the InheritanceOperations object to access its operations. - * @return the InheritanceOperations object. + * Gets the Inheritances object to access its operations. + * @return the Inheritances object. */ - InheritanceOperations getInheritanceOperations(); + Inheritances inheritances(); /** - * Gets the PolymorphismOperations object to access its operations. - * @return the PolymorphismOperations object. + * Gets the Polymorphisms object to access its operations. + * @return the Polymorphisms object. */ - PolymorphismOperations getPolymorphismOperations(); + Polymorphisms polymorphisms(); /** - * Gets the PolymorphicrecursiveOperations object to access its operations. - * @return the PolymorphicrecursiveOperations object. + * Gets the Polymorphicrecursives object to access its operations. + * @return the Polymorphicrecursives object. */ - PolymorphicrecursiveOperations getPolymorphicrecursiveOperations(); + Polymorphicrecursives polymorphicrecursives(); /** - * Gets the ReadonlypropertyOperations object to access its operations. - * @return the ReadonlypropertyOperations object. + * Gets the Readonlypropertys object to access its operations. + * @return the Readonlypropertys object. */ - ReadonlypropertyOperations getReadonlypropertyOperations(); + Readonlypropertys readonlypropertys(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/AutoRestComplexTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/AutoRestComplexTestServiceImpl.java deleted file mode 100644 index 2f534b2f45352..0000000000000 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/AutoRestComplexTestServiceImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -package fixtures.bodycomplex; - -import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; - -/** - * Initializes a new instance of the AutoRestComplexTestService class. - */ -public final class AutoRestComplexTestServiceImpl extends ServiceClient implements AutoRestComplexTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - - /** API ID. */ - private String apiVersion; - - /** - * Gets API ID. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * Sets API ID. - * - * @param apiVersion the apiVersion value. - */ - public void setApiVersion(String apiVersion) { - this.apiVersion = apiVersion; - } - - /** - * Gets the BasicOperations object to access its operations. - * @return the BasicOperations object. - */ - public BasicOperations getBasicOperations() { - return new BasicOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the PrimitiveOperations object to access its operations. - * @return the PrimitiveOperations object. - */ - public PrimitiveOperations getPrimitiveOperations() { - return new PrimitiveOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the ArrayOperations object to access its operations. - * @return the ArrayOperations object. - */ - public ArrayOperations getArrayOperations() { - return new ArrayOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the DictionaryOperations object to access its operations. - * @return the DictionaryOperations object. - */ - public DictionaryOperations getDictionaryOperations() { - return new DictionaryOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the InheritanceOperations object to access its operations. - * @return the InheritanceOperations object. - */ - public InheritanceOperations getInheritanceOperations() { - return new InheritanceOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the PolymorphismOperations object to access its operations. - * @return the PolymorphismOperations object. - */ - public PolymorphismOperations getPolymorphismOperations() { - return new PolymorphismOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the PolymorphicrecursiveOperations object to access its operations. - * @return the PolymorphicrecursiveOperations object. - */ - public PolymorphicrecursiveOperations getPolymorphicrecursiveOperations() { - return new PolymorphicrecursiveOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the ReadonlypropertyOperations object to access its operations. - * @return the ReadonlypropertyOperations object. - */ - public ReadonlypropertyOperations getReadonlypropertyOperations() { - return new ReadonlypropertyOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Initializes an instance of AutoRestComplexTestService client. - */ - public AutoRestComplexTestServiceImpl() { - this("http://localhost"); - } - - /** - * Initializes an instance of AutoRestComplexTestService client. - * - * @param baseUrl the base URL of the host - */ - public AutoRestComplexTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - /** - * Initializes an instance of AutoRestComplexTestService client. - * - * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} - */ - public AutoRestComplexTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); - } -} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/BasicOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Basics.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/BasicOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Basics.java index 2eb4c682f6f42..267dd8613d1aa 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/BasicOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Basics.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in BasicOperations. + * in Basics. */ -public interface BasicOperations { +public interface Basics { /** * Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/DictionaryOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Dictionarys.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/DictionaryOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Dictionarys.java index 2345c181cfca6..cc712c14885d2 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/DictionaryOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Dictionarys.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in DictionaryOperations. + * in Dictionarys. */ -public interface DictionaryOperations { +public interface Dictionarys { /** * Get complex types with dictionary property. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/InheritanceOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Inheritances.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/InheritanceOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Inheritances.java index d446bd93f4a62..4c8c6df4f544e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/InheritanceOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Inheritances.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in InheritanceOperations. + * in Inheritances. */ -public interface InheritanceOperations { +public interface Inheritances { /** * Get complex types that extend others. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphicrecursiveOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Polymorphicrecursives.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphicrecursiveOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Polymorphicrecursives.java index 85d3211cca508..bac72d0e33f9e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphicrecursiveOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Polymorphicrecursives.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in PolymorphicrecursiveOperations. + * in Polymorphicrecursives. */ -public interface PolymorphicrecursiveOperations { +public interface Polymorphicrecursives { /** * Get complex types that are polymorphic and have recursive references. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphismOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Polymorphisms.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphismOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Polymorphisms.java index 44703fa5029a3..688b61c43ea87 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphismOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Polymorphisms.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in PolymorphismOperations. + * in Polymorphisms. */ -public interface PolymorphismOperations { +public interface Polymorphisms { /** * Get complex types that are polymorphic. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PrimitiveOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Primitives.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PrimitiveOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Primitives.java index 17fa86e63d7a8..f54212f44c7bd 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PrimitiveOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Primitives.java @@ -29,9 +29,9 @@ /** * An instance of this class provides access to all the operations defined - * in PrimitiveOperations. + * in Primitives. */ -public interface PrimitiveOperations { +public interface Primitives { /** * Get complex types with integer properties. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ReadonlypropertyOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Readonlypropertys.java similarity index 96% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ReadonlypropertyOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Readonlypropertys.java index 18128334c16f8..90300cafb372c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ReadonlypropertyOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Readonlypropertys.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in ReadonlypropertyOperations. + * in Readonlypropertys. */ -public interface ReadonlypropertyOperations { +public interface Readonlypropertys { /** * Get complex types that have readonly properties. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ArrayOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/ArraysImpl.java similarity index 95% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ArrayOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/ArraysImpl.java index 67e3e4a264379..a3a46c6e9b993 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ArrayOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/ArraysImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodycomplex; +package fixtures.bodycomplex.implementation; +import retrofit2.Retrofit; +import fixtures.bodycomplex.Arrays; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -27,34 +29,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in ArrayOperations. + * in Arrays. */ -public final class ArrayOperationsImpl implements ArrayOperations { +public final class ArraysImpl implements Arrays { /** The Retrofit service to perform REST calls. */ - private ArrayService service; + private ArraysService service; /** The service client containing this operation class. */ - private AutoRestComplexTestService client; + private AutoRestComplexTestServiceImpl client; /** - * Initializes an instance of ArrayOperations. + * Initializes an instance of Arrays. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ArrayOperationsImpl(Retrofit retrofit, AutoRestComplexTestService client) { - this.service = retrofit.create(ArrayService.class); + public ArraysImpl(Retrofit retrofit, AutoRestComplexTestServiceImpl client) { + this.service = retrofit.create(ArraysService.class); this.client = client; } /** - * The interface defining all the services for ArrayOperations to be + * The interface defining all the services for Arrays to be * used by Retrofit to perform actually REST calls. */ - interface ArrayService { + interface ArraysService { @Headers("Content-Type: application/json; charset=utf-8") @GET("complex/array/valid") Call getValid(); @@ -116,7 +117,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -173,7 +174,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -218,7 +219,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -275,7 +276,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -320,7 +321,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNotProvidedDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/AutoRestComplexTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/AutoRestComplexTestServiceImpl.java new file mode 100644 index 0000000000000..3fbb4001de937 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/AutoRestComplexTestServiceImpl.java @@ -0,0 +1,209 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.bodycomplex.implementation; + +import fixtures.bodycomplex.AutoRestComplexTestService; +import fixtures.bodycomplex.Basics; +import fixtures.bodycomplex.Primitives; +import fixtures.bodycomplex.Arrays; +import fixtures.bodycomplex.Dictionarys; +import fixtures.bodycomplex.Inheritances; +import fixtures.bodycomplex.Polymorphisms; +import fixtures.bodycomplex.Polymorphicrecursives; +import fixtures.bodycomplex.Readonlypropertys; +import com.microsoft.rest.ServiceClient; +import okhttp3.OkHttpClient; +import retrofit2.Retrofit; + +/** + * Initializes a new instance of the AutoRestComplexTestService class. + */ +public final class AutoRestComplexTestServiceImpl extends ServiceClient implements AutoRestComplexTestService { + + /** API ID. */ + private String apiVersion; + + /** + * Gets API ID. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** + * Sets API ID. + * + * @param apiVersion the apiVersion value. + * @return the service client itself + */ + public AutoRestComplexTestServiceImpl withApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * The Basics object to access its operations. + */ + private Basics basics; + + /** + * Gets the Basics object to access its operations. + * @return the Basics object. + */ + public Basics basics() { + return this.basics; + } + + /** + * The Primitives object to access its operations. + */ + private Primitives primitives; + + /** + * Gets the Primitives object to access its operations. + * @return the Primitives object. + */ + public Primitives primitives() { + return this.primitives; + } + + /** + * The Arrays object to access its operations. + */ + private Arrays arrays; + + /** + * Gets the Arrays object to access its operations. + * @return the Arrays object. + */ + public Arrays arrays() { + return this.arrays; + } + + /** + * The Dictionarys object to access its operations. + */ + private Dictionarys dictionarys; + + /** + * Gets the Dictionarys object to access its operations. + * @return the Dictionarys object. + */ + public Dictionarys dictionarys() { + return this.dictionarys; + } + + /** + * The Inheritances object to access its operations. + */ + private Inheritances inheritances; + + /** + * Gets the Inheritances object to access its operations. + * @return the Inheritances object. + */ + public Inheritances inheritances() { + return this.inheritances; + } + + /** + * The Polymorphisms object to access its operations. + */ + private Polymorphisms polymorphisms; + + /** + * Gets the Polymorphisms object to access its operations. + * @return the Polymorphisms object. + */ + public Polymorphisms polymorphisms() { + return this.polymorphisms; + } + + /** + * The Polymorphicrecursives object to access its operations. + */ + private Polymorphicrecursives polymorphicrecursives; + + /** + * Gets the Polymorphicrecursives object to access its operations. + * @return the Polymorphicrecursives object. + */ + public Polymorphicrecursives polymorphicrecursives() { + return this.polymorphicrecursives; + } + + /** + * The Readonlypropertys object to access its operations. + */ + private Readonlypropertys readonlypropertys; + + /** + * Gets the Readonlypropertys object to access its operations. + * @return the Readonlypropertys object. + */ + public Readonlypropertys readonlypropertys() { + return this.readonlypropertys; + } + + /** + * Initializes an instance of AutoRestComplexTestService client. + */ + public AutoRestComplexTestServiceImpl() { + this("http://localhost"); + } + + /** + * Initializes an instance of AutoRestComplexTestService client. + * + * @param baseUrl the base URL of the host + */ + public AutoRestComplexTestServiceImpl(String baseUrl) { + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestComplexTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestComplexTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); + initialize(); + } + + /** + * Initializes an instance of AutoRestComplexTestService client. + * + * @param baseUrl the base URL of the host + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestComplexTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); + initialize(); + } + + private void initialize() { + this.apiVersion = "2014-04-01-preview"; + this.basics = new BasicsImpl(retrofit(), this); + this.primitives = new PrimitivesImpl(retrofit(), this); + this.arrays = new ArraysImpl(retrofit(), this); + this.dictionarys = new DictionarysImpl(retrofit(), this); + this.inheritances = new InheritancesImpl(retrofit(), this); + this.polymorphisms = new PolymorphismsImpl(retrofit(), this); + this.polymorphicrecursives = new PolymorphicrecursivesImpl(retrofit(), this); + this.readonlypropertys = new ReadonlypropertysImpl(retrofit(), this); + } +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/BasicOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/BasicsImpl.java similarity index 95% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/BasicOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/BasicsImpl.java index 18d296b35f5a4..23a7d1d8befb1 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/BasicOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/BasicsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodycomplex; +package fixtures.bodycomplex.implementation; +import retrofit2.Retrofit; +import fixtures.bodycomplex.Basics; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -28,34 +30,33 @@ import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in BasicOperations. + * in Basics. */ -public final class BasicOperationsImpl implements BasicOperations { +public final class BasicsImpl implements Basics { /** The Retrofit service to perform REST calls. */ - private BasicService service; + private BasicsService service; /** The service client containing this operation class. */ - private AutoRestComplexTestService client; + private AutoRestComplexTestServiceImpl client; /** - * Initializes an instance of BasicOperations. + * Initializes an instance of Basics. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public BasicOperationsImpl(Retrofit retrofit, AutoRestComplexTestService client) { - this.service = retrofit.create(BasicService.class); + public BasicsImpl(Retrofit retrofit, AutoRestComplexTestServiceImpl client) { + this.service = retrofit.create(BasicsService.class); this.client = client; } /** - * The interface defining all the services for BasicOperations to be + * The interface defining all the services for Basics to be * used by Retrofit to perform actually REST calls. */ - interface BasicService { + interface BasicsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("complex/basic/valid") Call getValid(); @@ -121,7 +122,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -141,7 +142,7 @@ public ServiceResponse putValid(Basic complexBody) throws ErrorException, throw new IllegalArgumentException("Parameter complexBody is required and cannot be null."); } Validator.validate(complexBody); - Call call = service.putValid(complexBody, this.client.getApiVersion()); + Call call = service.putValid(complexBody, this.client.apiVersion()); return putValidDelegate(call.execute()); } @@ -162,7 +163,7 @@ public ServiceCall putValidAsync(Basic complexBody, final ServiceCallback return null; } Validator.validate(complexBody, serviceCallback); - Call call = service.putValid(complexBody, this.client.getApiVersion()); + Call call = service.putValid(complexBody, this.client.apiVersion()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -178,7 +179,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -223,7 +224,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -268,7 +269,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -313,7 +314,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -358,7 +359,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNotProvidedDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/DictionaryOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/DictionarysImpl.java similarity index 95% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/DictionaryOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/DictionarysImpl.java index b3718874860c0..c3dbf31a77d98 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/DictionaryOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/DictionarysImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodycomplex; +package fixtures.bodycomplex.implementation; +import retrofit2.Retrofit; +import fixtures.bodycomplex.Dictionarys; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -27,34 +29,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in DictionaryOperations. + * in Dictionarys. */ -public final class DictionaryOperationsImpl implements DictionaryOperations { +public final class DictionarysImpl implements Dictionarys { /** The Retrofit service to perform REST calls. */ - private DictionaryService service; + private DictionarysService service; /** The service client containing this operation class. */ - private AutoRestComplexTestService client; + private AutoRestComplexTestServiceImpl client; /** - * Initializes an instance of DictionaryOperations. + * Initializes an instance of Dictionarys. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public DictionaryOperationsImpl(Retrofit retrofit, AutoRestComplexTestService client) { - this.service = retrofit.create(DictionaryService.class); + public DictionarysImpl(Retrofit retrofit, AutoRestComplexTestServiceImpl client) { + this.service = retrofit.create(DictionarysService.class); this.client = client; } /** - * The interface defining all the services for DictionaryOperations to be + * The interface defining all the services for Dictionarys to be * used by Retrofit to perform actually REST calls. */ - interface DictionaryService { + interface DictionarysService { @Headers("Content-Type: application/json; charset=utf-8") @GET("complex/dictionary/typed/valid") Call getValid(); @@ -120,7 +121,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -177,7 +178,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -222,7 +223,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -279,7 +280,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -324,7 +325,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -369,7 +370,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNotProvidedDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/InheritanceOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/InheritancesImpl.java similarity index 91% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/InheritanceOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/InheritancesImpl.java index f76b165272892..0ff4d798fdf21 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/InheritanceOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/InheritancesImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodycomplex; +package fixtures.bodycomplex.implementation; +import retrofit2.Retrofit; +import fixtures.bodycomplex.Inheritances; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -27,34 +29,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in InheritanceOperations. + * in Inheritances. */ -public final class InheritanceOperationsImpl implements InheritanceOperations { +public final class InheritancesImpl implements Inheritances { /** The Retrofit service to perform REST calls. */ - private InheritanceService service; + private InheritancesService service; /** The service client containing this operation class. */ - private AutoRestComplexTestService client; + private AutoRestComplexTestServiceImpl client; /** - * Initializes an instance of InheritanceOperations. + * Initializes an instance of Inheritances. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public InheritanceOperationsImpl(Retrofit retrofit, AutoRestComplexTestService client) { - this.service = retrofit.create(InheritanceService.class); + public InheritancesImpl(Retrofit retrofit, AutoRestComplexTestServiceImpl client) { + this.service = retrofit.create(InheritancesService.class); this.client = client; } /** - * The interface defining all the services for InheritanceOperations to be + * The interface defining all the services for Inheritances to be * used by Retrofit to perform actually REST calls. */ - interface InheritanceService { + interface InheritancesService { @Headers("Content-Type: application/json; charset=utf-8") @GET("complex/inheritance/valid") Call getValid(); @@ -104,7 +105,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -161,7 +162,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphicrecursiveOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/PolymorphicrecursivesImpl.java similarity index 93% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphicrecursiveOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/PolymorphicrecursivesImpl.java index 91f90a81e0a97..367c861c9fe70 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphicrecursiveOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/PolymorphicrecursivesImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodycomplex; +package fixtures.bodycomplex.implementation; +import retrofit2.Retrofit; +import fixtures.bodycomplex.Polymorphicrecursives; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -27,34 +29,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in PolymorphicrecursiveOperations. + * in Polymorphicrecursives. */ -public final class PolymorphicrecursiveOperationsImpl implements PolymorphicrecursiveOperations { +public final class PolymorphicrecursivesImpl implements Polymorphicrecursives { /** The Retrofit service to perform REST calls. */ - private PolymorphicrecursiveService service; + private PolymorphicrecursivesService service; /** The service client containing this operation class. */ - private AutoRestComplexTestService client; + private AutoRestComplexTestServiceImpl client; /** - * Initializes an instance of PolymorphicrecursiveOperations. + * Initializes an instance of Polymorphicrecursives. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PolymorphicrecursiveOperationsImpl(Retrofit retrofit, AutoRestComplexTestService client) { - this.service = retrofit.create(PolymorphicrecursiveService.class); + public PolymorphicrecursivesImpl(Retrofit retrofit, AutoRestComplexTestServiceImpl client) { + this.service = retrofit.create(PolymorphicrecursivesService.class); this.client = client; } /** - * The interface defining all the services for PolymorphicrecursiveOperations to be + * The interface defining all the services for Polymorphicrecursives to be * used by Retrofit to perform actually REST calls. */ - interface PolymorphicrecursiveService { + interface PolymorphicrecursivesService { @Headers("Content-Type: application/json; charset=utf-8") @GET("complex/polymorphicrecursive/valid") Call getValid(); @@ -104,7 +105,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -265,7 +266,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphismOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/PolymorphismsImpl.java similarity index 95% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphismOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/PolymorphismsImpl.java index 734aa42955483..31359af6796e0 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PolymorphismOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/PolymorphismsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodycomplex; +package fixtures.bodycomplex.implementation; +import retrofit2.Retrofit; +import fixtures.bodycomplex.Polymorphisms; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -27,34 +29,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in PolymorphismOperations. + * in Polymorphisms. */ -public final class PolymorphismOperationsImpl implements PolymorphismOperations { +public final class PolymorphismsImpl implements Polymorphisms { /** The Retrofit service to perform REST calls. */ - private PolymorphismService service; + private PolymorphismsService service; /** The service client containing this operation class. */ - private AutoRestComplexTestService client; + private AutoRestComplexTestServiceImpl client; /** - * Initializes an instance of PolymorphismOperations. + * Initializes an instance of Polymorphisms. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PolymorphismOperationsImpl(Retrofit retrofit, AutoRestComplexTestService client) { - this.service = retrofit.create(PolymorphismService.class); + public PolymorphismsImpl(Retrofit retrofit, AutoRestComplexTestServiceImpl client) { + this.service = retrofit.create(PolymorphismsService.class); this.client = client; } /** - * The interface defining all the services for PolymorphismOperations to be + * The interface defining all the services for Polymorphisms to be * used by Retrofit to perform actually REST calls. */ - interface PolymorphismService { + interface PolymorphismsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("complex/polymorphism/valid") Call getValid(); @@ -108,7 +109,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -229,7 +230,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -336,7 +337,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putValidMissingRequiredDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PrimitiveOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/PrimitivesImpl.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PrimitiveOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/PrimitivesImpl.java index 7cb2ede7c8dd5..9bafa422990f2 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PrimitiveOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/PrimitivesImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodycomplex; +package fixtures.bodycomplex.implementation; +import retrofit2.Retrofit; +import fixtures.bodycomplex.Primitives; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -37,34 +39,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in PrimitiveOperations. + * in Primitives. */ -public final class PrimitiveOperationsImpl implements PrimitiveOperations { +public final class PrimitivesImpl implements Primitives { /** The Retrofit service to perform REST calls. */ - private PrimitiveService service; + private PrimitivesService service; /** The service client containing this operation class. */ - private AutoRestComplexTestService client; + private AutoRestComplexTestServiceImpl client; /** - * Initializes an instance of PrimitiveOperations. + * Initializes an instance of Primitives. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PrimitiveOperationsImpl(Retrofit retrofit, AutoRestComplexTestService client) { - this.service = retrofit.create(PrimitiveService.class); + public PrimitivesImpl(Retrofit retrofit, AutoRestComplexTestServiceImpl client) { + this.service = retrofit.create(PrimitivesService.class); this.client = client; } /** - * The interface defining all the services for PrimitiveOperations to be + * The interface defining all the services for Primitives to be * used by Retrofit to perform actually REST calls. */ - interface PrimitiveService { + interface PrimitivesService { @Headers("Content-Type: application/json; charset=utf-8") @GET("complex/primitive/integer") Call getInt(); @@ -194,7 +195,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getIntDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -251,7 +252,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putIntDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -296,7 +297,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getLongDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -353,7 +354,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putLongDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -398,7 +399,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getFloatDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -455,7 +456,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putFloatDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -500,7 +501,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDoubleDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -557,7 +558,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDoubleDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -602,7 +603,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBoolDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -659,7 +660,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBoolDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -704,7 +705,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -761,7 +762,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putStringDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -806,7 +807,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDateDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -863,7 +864,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDateDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -908,7 +909,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -965,7 +966,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDateTimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1010,7 +1011,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDateTimeRfc1123Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1067,7 +1068,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDateTimeRfc1123Delegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1112,7 +1113,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDurationDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1169,7 +1170,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDurationDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1214,7 +1215,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getByteDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1271,7 +1272,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putByteDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ReadonlypropertyOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/ReadonlypropertysImpl.java similarity index 91% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ReadonlypropertyOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/ReadonlypropertysImpl.java index 4049575145ffa..5620e4be476e4 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/ReadonlypropertyOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/ReadonlypropertysImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodycomplex; +package fixtures.bodycomplex.implementation; +import retrofit2.Retrofit; +import fixtures.bodycomplex.Readonlypropertys; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -27,34 +29,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in ReadonlypropertyOperations. + * in Readonlypropertys. */ -public final class ReadonlypropertyOperationsImpl implements ReadonlypropertyOperations { +public final class ReadonlypropertysImpl implements Readonlypropertys { /** The Retrofit service to perform REST calls. */ - private ReadonlypropertyService service; + private ReadonlypropertysService service; /** The service client containing this operation class. */ - private AutoRestComplexTestService client; + private AutoRestComplexTestServiceImpl client; /** - * Initializes an instance of ReadonlypropertyOperations. + * Initializes an instance of Readonlypropertys. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ReadonlypropertyOperationsImpl(Retrofit retrofit, AutoRestComplexTestService client) { - this.service = retrofit.create(ReadonlypropertyService.class); + public ReadonlypropertysImpl(Retrofit retrofit, AutoRestComplexTestServiceImpl client) { + this.service = retrofit.create(ReadonlypropertysService.class); this.client = client; } /** - * The interface defining all the services for ReadonlypropertyOperations to be + * The interface defining all the services for Readonlypropertys to be * used by Retrofit to perform actually REST calls. */ - interface ReadonlypropertyService { + interface ReadonlypropertysService { @Headers("Content-Type: application/json; charset=utf-8") @GET("complex/readonlyproperty/valid") Call getValid(); @@ -104,7 +105,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -161,7 +162,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/package-info.java new file mode 100644 index 0000000000000..d9e093bf11b2d --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestComplexTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.bodycomplex.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ArrayWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ArrayWrapper.java index ba19c4d3644f5..85571d743d80c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ArrayWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ArrayWrapper.java @@ -26,7 +26,7 @@ public class ArrayWrapper { * * @return the array value */ - public List getArray() { + public List array() { return this.array; } @@ -34,9 +34,11 @@ public List getArray() { * Set the array value. * * @param array the array value to set + * @return the ArrayWrapper object itself. */ - public void setArray(List array) { + public ArrayWrapper withArray(List array) { this.array = array; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Basic.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Basic.java index 0fcca7e0b7c7c..d8e9724eaf5ef 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Basic.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Basic.java @@ -35,7 +35,7 @@ public class Basic { * * @return the id value */ - public Integer getId() { + public Integer id() { return this.id; } @@ -43,9 +43,11 @@ public Integer getId() { * Set the id value. * * @param id the id value to set + * @return the Basic object itself. */ - public void setId(Integer id) { + public Basic withId(Integer id) { this.id = id; + return this; } /** @@ -53,7 +55,7 @@ public void setId(Integer id) { * * @return the name value */ - public String getName() { + public String name() { return this.name; } @@ -61,9 +63,11 @@ public String getName() { * Set the name value. * * @param name the name value to set + * @return the Basic object itself. */ - public void setName(String name) { + public Basic withName(String name) { this.name = name; + return this; } /** @@ -71,7 +75,7 @@ public void setName(String name) { * * @return the color value */ - public String getColor() { + public String color() { return this.color; } @@ -79,9 +83,11 @@ public String getColor() { * Set the color value. * * @param color the color value to set + * @return the Basic object itself. */ - public void setColor(String color) { + public Basic withColor(String color) { this.color = color; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/BooleanWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/BooleanWrapper.java index 34b0f49f21144..4a5ae99290afe 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/BooleanWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/BooleanWrapper.java @@ -33,7 +33,7 @@ public class BooleanWrapper { * * @return the fieldTrue value */ - public Boolean getFieldTrue() { + public Boolean fieldTrue() { return this.fieldTrue; } @@ -41,9 +41,11 @@ public Boolean getFieldTrue() { * Set the fieldTrue value. * * @param fieldTrue the fieldTrue value to set + * @return the BooleanWrapper object itself. */ - public void setFieldTrue(Boolean fieldTrue) { + public BooleanWrapper withFieldTrue(Boolean fieldTrue) { this.fieldTrue = fieldTrue; + return this; } /** @@ -51,7 +53,7 @@ public void setFieldTrue(Boolean fieldTrue) { * * @return the fieldFalse value */ - public Boolean getFieldFalse() { + public Boolean fieldFalse() { return this.fieldFalse; } @@ -59,9 +61,11 @@ public Boolean getFieldFalse() { * Set the fieldFalse value. * * @param fieldFalse the fieldFalse value to set + * @return the BooleanWrapper object itself. */ - public void setFieldFalse(Boolean fieldFalse) { + public BooleanWrapper withFieldFalse(Boolean fieldFalse) { this.fieldFalse = fieldFalse; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ByteWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ByteWrapper.java index cec668b39bc52..9911738bea80f 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ByteWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ByteWrapper.java @@ -25,7 +25,7 @@ public class ByteWrapper { * * @return the field value */ - public byte[] getField() { + public byte[] field() { return this.field; } @@ -33,9 +33,11 @@ public byte[] getField() { * Set the field value. * * @param field the field value to set + * @return the ByteWrapper object itself. */ - public void setField(byte[] field) { + public ByteWrapper withField(byte[] field) { this.field = field; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/CMYKColors.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/CMYKColors.java new file mode 100644 index 0000000000000..09fa340d6af35 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/CMYKColors.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.bodycomplex.models; + +/** + * Defines values for CMYKColors. + */ +public final class CMYKColors { + /** Static value cyan for CMYKColors. */ + public static final String CYAN = "cyan"; + + /** Static value Magenta for CMYKColors. */ + public static final String MAGENTA = "Magenta"; + + /** Static value YELLOW for CMYKColors. */ + public static final String YELLOW = "YELLOW"; + + /** Static value blacK for CMYKColors. */ + public static final String BLACK = "blacK"; + + private CMYKColors() { + } +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Cat.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Cat.java index 050598a40ef28..8eb3e748d0e9e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Cat.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Cat.java @@ -31,7 +31,7 @@ public class Cat extends Pet { * * @return the color value */ - public String getColor() { + public String color() { return this.color; } @@ -39,9 +39,11 @@ public String getColor() { * Set the color value. * * @param color the color value to set + * @return the Cat object itself. */ - public void setColor(String color) { + public Cat withColor(String color) { this.color = color; + return this; } /** @@ -49,7 +51,7 @@ public void setColor(String color) { * * @return the hates value */ - public List getHates() { + public List hates() { return this.hates; } @@ -57,9 +59,11 @@ public List getHates() { * Set the hates value. * * @param hates the hates value to set + * @return the Cat object itself. */ - public void setHates(List hates) { + public Cat withHates(List hates) { this.hates = hates; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DateWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DateWrapper.java index 18d4760340348..2d30bc84a42eb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DateWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DateWrapper.java @@ -31,7 +31,7 @@ public class DateWrapper { * * @return the field value */ - public LocalDate getField() { + public LocalDate field() { return this.field; } @@ -39,9 +39,11 @@ public LocalDate getField() { * Set the field value. * * @param field the field value to set + * @return the DateWrapper object itself. */ - public void setField(LocalDate field) { + public DateWrapper withField(LocalDate field) { this.field = field; + return this; } /** @@ -49,7 +51,7 @@ public void setField(LocalDate field) { * * @return the leap value */ - public LocalDate getLeap() { + public LocalDate leap() { return this.leap; } @@ -57,9 +59,11 @@ public LocalDate getLeap() { * Set the leap value. * * @param leap the leap value to set + * @return the DateWrapper object itself. */ - public void setLeap(LocalDate leap) { + public DateWrapper withLeap(LocalDate leap) { this.leap = leap; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DatetimeWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DatetimeWrapper.java index b0b63fa25be4f..333269bf54f80 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DatetimeWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DatetimeWrapper.java @@ -31,7 +31,7 @@ public class DatetimeWrapper { * * @return the field value */ - public DateTime getField() { + public DateTime field() { return this.field; } @@ -39,9 +39,11 @@ public DateTime getField() { * Set the field value. * * @param field the field value to set + * @return the DatetimeWrapper object itself. */ - public void setField(DateTime field) { + public DatetimeWrapper withField(DateTime field) { this.field = field; + return this; } /** @@ -49,7 +51,7 @@ public void setField(DateTime field) { * * @return the now value */ - public DateTime getNow() { + public DateTime now() { return this.now; } @@ -57,9 +59,11 @@ public DateTime getNow() { * Set the now value. * * @param now the now value to set + * @return the DatetimeWrapper object itself. */ - public void setNow(DateTime now) { + public DatetimeWrapper withNow(DateTime now) { this.now = now; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Datetimerfc1123Wrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Datetimerfc1123Wrapper.java index 6136a56f86b1f..4925b3033abc6 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Datetimerfc1123Wrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Datetimerfc1123Wrapper.java @@ -32,7 +32,7 @@ public class Datetimerfc1123Wrapper { * * @return the field value */ - public DateTime getField() { + public DateTime field() { if (this.field == null) { return null; } @@ -43,9 +43,11 @@ public DateTime getField() { * Set the field value. * * @param field the field value to set + * @return the Datetimerfc1123Wrapper object itself. */ - public void setField(DateTime field) { + public Datetimerfc1123Wrapper withField(DateTime field) { this.field = new DateTimeRfc1123(field); + return this; } /** @@ -53,7 +55,7 @@ public void setField(DateTime field) { * * @return the now value */ - public DateTime getNow() { + public DateTime now() { if (this.now == null) { return null; } @@ -64,9 +66,11 @@ public DateTime getNow() { * Set the now value. * * @param now the now value to set + * @return the Datetimerfc1123Wrapper object itself. */ - public void setNow(DateTime now) { + public Datetimerfc1123Wrapper withNow(DateTime now) { this.now = new DateTimeRfc1123(now); + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DictionaryWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DictionaryWrapper.java index fc96fedf78ee2..478955f6b3378 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DictionaryWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DictionaryWrapper.java @@ -26,7 +26,7 @@ public class DictionaryWrapper { * * @return the defaultProgram value */ - public Map getDefaultProgram() { + public Map defaultProgram() { return this.defaultProgram; } @@ -34,9 +34,11 @@ public Map getDefaultProgram() { * Set the defaultProgram value. * * @param defaultProgram the defaultProgram value to set + * @return the DictionaryWrapper object itself. */ - public void setDefaultProgram(Map defaultProgram) { + public DictionaryWrapper withDefaultProgram(Map defaultProgram) { this.defaultProgram = defaultProgram; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Dog.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Dog.java index c88d6c0a9e885..5f0a4d02c59b3 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Dog.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Dog.java @@ -25,7 +25,7 @@ public class Dog extends Pet { * * @return the food value */ - public String getFood() { + public String food() { return this.food; } @@ -33,9 +33,11 @@ public String getFood() { * Set the food value. * * @param food the food value to set + * @return the Dog object itself. */ - public void setFood(String food) { + public Dog withFood(String food) { this.food = food; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DoubleWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DoubleWrapper.java index 4315684273a19..a86e7ad90a1fe 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DoubleWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DoubleWrapper.java @@ -34,7 +34,7 @@ public class DoubleWrapper { * * @return the field1 value */ - public Double getField1() { + public Double field1() { return this.field1; } @@ -42,9 +42,11 @@ public Double getField1() { * Set the field1 value. * * @param field1 the field1 value to set + * @return the DoubleWrapper object itself. */ - public void setField1(Double field1) { + public DoubleWrapper withField1(Double field1) { this.field1 = field1; + return this; } /** @@ -52,7 +54,7 @@ public void setField1(Double field1) { * * @return the field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose value */ - public Double getField56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose() { + public Double field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose() { return this.field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose; } @@ -60,9 +62,11 @@ public Double getField56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFi * Set the field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose value. * * @param field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose the field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose value to set + * @return the DoubleWrapper object itself. */ - public void setField56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose(Double field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose) { + public DoubleWrapper withField56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose(Double field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose) { this.field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose = field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DurationWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DurationWrapper.java index e7816c6c44b60..3080c6d9cc177 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DurationWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/DurationWrapper.java @@ -26,7 +26,7 @@ public class DurationWrapper { * * @return the field value */ - public Period getField() { + public Period field() { return this.field; } @@ -34,9 +34,11 @@ public Period getField() { * Set the field value. * * @param field the field value to set + * @return the DurationWrapper object itself. */ - public void setField(Period field) { + public DurationWrapper withField(Period field) { this.field = field; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Error.java index df6996ea5f577..2ef54b432f444 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ErrorException.java index 7ce6d925b23b0..c82d2c8c69f12 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodycomplex.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Fish.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Fish.java index cdb598998e1c0..af356a9bf2f23 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Fish.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Fish.java @@ -47,7 +47,7 @@ public class Fish { * * @return the species value */ - public String getSpecies() { + public String species() { return this.species; } @@ -55,9 +55,11 @@ public String getSpecies() { * Set the species value. * * @param species the species value to set + * @return the Fish object itself. */ - public void setSpecies(String species) { + public Fish withSpecies(String species) { this.species = species; + return this; } /** @@ -65,7 +67,7 @@ public void setSpecies(String species) { * * @return the length value */ - public double getLength() { + public double length() { return this.length; } @@ -73,9 +75,11 @@ public double getLength() { * Set the length value. * * @param length the length value to set + * @return the Fish object itself. */ - public void setLength(double length) { + public Fish withLength(double length) { this.length = length; + return this; } /** @@ -83,7 +87,7 @@ public void setLength(double length) { * * @return the siblings value */ - public List getSiblings() { + public List siblings() { return this.siblings; } @@ -91,9 +95,11 @@ public List getSiblings() { * Set the siblings value. * * @param siblings the siblings value to set + * @return the Fish object itself. */ - public void setSiblings(List siblings) { + public Fish withSiblings(List siblings) { this.siblings = siblings; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/FloatWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/FloatWrapper.java index fb56eb3041be4..e416e502921e0 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/FloatWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/FloatWrapper.java @@ -30,7 +30,7 @@ public class FloatWrapper { * * @return the field1 value */ - public Double getField1() { + public Double field1() { return this.field1; } @@ -38,9 +38,11 @@ public Double getField1() { * Set the field1 value. * * @param field1 the field1 value to set + * @return the FloatWrapper object itself. */ - public void setField1(Double field1) { + public FloatWrapper withField1(Double field1) { this.field1 = field1; + return this; } /** @@ -48,7 +50,7 @@ public void setField1(Double field1) { * * @return the field2 value */ - public Double getField2() { + public Double field2() { return this.field2; } @@ -56,9 +58,11 @@ public Double getField2() { * Set the field2 value. * * @param field2 the field2 value to set + * @return the FloatWrapper object itself. */ - public void setField2(Double field2) { + public FloatWrapper withField2(Double field2) { this.field2 = field2; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Goblinshark.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Goblinshark.java index 08f5416b69a6c..5c164918cbe33 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Goblinshark.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Goblinshark.java @@ -29,7 +29,7 @@ public class Goblinshark extends Shark { * * @return the jawsize value */ - public Integer getJawsize() { + public Integer jawsize() { return this.jawsize; } @@ -37,9 +37,11 @@ public Integer getJawsize() { * Set the jawsize value. * * @param jawsize the jawsize value to set + * @return the Goblinshark object itself. */ - public void setJawsize(Integer jawsize) { + public Goblinshark withJawsize(Integer jawsize) { this.jawsize = jawsize; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/IntWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/IntWrapper.java index 358e5d9d51755..a2dd5f4297ca6 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/IntWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/IntWrapper.java @@ -30,7 +30,7 @@ public class IntWrapper { * * @return the field1 value */ - public Integer getField1() { + public Integer field1() { return this.field1; } @@ -38,9 +38,11 @@ public Integer getField1() { * Set the field1 value. * * @param field1 the field1 value to set + * @return the IntWrapper object itself. */ - public void setField1(Integer field1) { + public IntWrapper withField1(Integer field1) { this.field1 = field1; + return this; } /** @@ -48,7 +50,7 @@ public void setField1(Integer field1) { * * @return the field2 value */ - public Integer getField2() { + public Integer field2() { return this.field2; } @@ -56,9 +58,11 @@ public Integer getField2() { * Set the field2 value. * * @param field2 the field2 value to set + * @return the IntWrapper object itself. */ - public void setField2(Integer field2) { + public IntWrapper withField2(Integer field2) { this.field2 = field2; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/LongWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/LongWrapper.java index d2358d4148f2f..2950e02072847 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/LongWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/LongWrapper.java @@ -30,7 +30,7 @@ public class LongWrapper { * * @return the field1 value */ - public Long getField1() { + public Long field1() { return this.field1; } @@ -38,9 +38,11 @@ public Long getField1() { * Set the field1 value. * * @param field1 the field1 value to set + * @return the LongWrapper object itself. */ - public void setField1(Long field1) { + public LongWrapper withField1(Long field1) { this.field1 = field1; + return this; } /** @@ -48,7 +50,7 @@ public void setField1(Long field1) { * * @return the field2 value */ - public Long getField2() { + public Long field2() { return this.field2; } @@ -56,9 +58,11 @@ public Long getField2() { * Set the field2 value. * * @param field2 the field2 value to set + * @return the LongWrapper object itself. */ - public void setField2(Long field2) { + public LongWrapper withField2(Long field2) { this.field2 = field2; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Pet.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Pet.java index ff2f573044153..78ea6a417558d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Pet.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Pet.java @@ -30,7 +30,7 @@ public class Pet { * * @return the id value */ - public Integer getId() { + public Integer id() { return this.id; } @@ -38,9 +38,11 @@ public Integer getId() { * Set the id value. * * @param id the id value to set + * @return the Pet object itself. */ - public void setId(Integer id) { + public Pet withId(Integer id) { this.id = id; + return this; } /** @@ -48,7 +50,7 @@ public void setId(Integer id) { * * @return the name value */ - public String getName() { + public String name() { return this.name; } @@ -56,9 +58,11 @@ public String getName() { * Set the name value. * * @param name the name value to set + * @return the Pet object itself. */ - public void setName(String name) { + public Pet withName(String name) { this.name = name; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ReadonlyObj.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ReadonlyObj.java index 4fed8612b368f..4ef03bbf106e5 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ReadonlyObj.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/ReadonlyObj.java @@ -32,7 +32,7 @@ public class ReadonlyObj { * * @return the id value */ - public String getId() { + public String id() { return this.id; } @@ -41,7 +41,7 @@ public String getId() { * * @return the size value */ - public Integer getSize() { + public Integer size() { return this.size; } @@ -49,9 +49,11 @@ public Integer getSize() { * Set the size value. * * @param size the size value to set + * @return the ReadonlyObj object itself. */ - public void setSize(Integer size) { + public ReadonlyObj withSize(Integer size) { this.size = size; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Salmon.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Salmon.java index 376a6642d63e7..f8927b380afa2 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Salmon.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Salmon.java @@ -34,7 +34,7 @@ public class Salmon extends Fish { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -42,9 +42,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the Salmon object itself. */ - public void setLocation(String location) { + public Salmon withLocation(String location) { this.location = location; + return this; } /** @@ -52,7 +54,7 @@ public void setLocation(String location) { * * @return the iswild value */ - public Boolean getIswild() { + public Boolean iswild() { return this.iswild; } @@ -60,9 +62,11 @@ public Boolean getIswild() { * Set the iswild value. * * @param iswild the iswild value to set + * @return the Salmon object itself. */ - public void setIswild(Boolean iswild) { + public Salmon withIswild(Boolean iswild) { this.iswild = iswild; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Sawshark.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Sawshark.java index 0ebd0c99890f3..20e273b343019 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Sawshark.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Sawshark.java @@ -29,7 +29,7 @@ public class Sawshark extends Shark { * * @return the picture value */ - public byte[] getPicture() { + public byte[] picture() { return this.picture; } @@ -37,9 +37,11 @@ public byte[] getPicture() { * Set the picture value. * * @param picture the picture value to set + * @return the Sawshark object itself. */ - public void setPicture(byte[] picture) { + public Sawshark withPicture(byte[] picture) { this.picture = picture; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Shark.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Shark.java index 2c1f2eaa58a37..529ea930aba85 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Shark.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Shark.java @@ -43,7 +43,7 @@ public class Shark extends Fish { * * @return the age value */ - public Integer getAge() { + public Integer age() { return this.age; } @@ -51,9 +51,11 @@ public Integer getAge() { * Set the age value. * * @param age the age value to set + * @return the Shark object itself. */ - public void setAge(Integer age) { + public Shark withAge(Integer age) { this.age = age; + return this; } /** @@ -61,7 +63,7 @@ public void setAge(Integer age) { * * @return the birthday value */ - public DateTime getBirthday() { + public DateTime birthday() { return this.birthday; } @@ -69,9 +71,11 @@ public DateTime getBirthday() { * Set the birthday value. * * @param birthday the birthday value to set + * @return the Shark object itself. */ - public void setBirthday(DateTime birthday) { + public Shark withBirthday(DateTime birthday) { this.birthday = birthday; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Siamese.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Siamese.java index a123e4205123c..0b66e4d9f1a76 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Siamese.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/Siamese.java @@ -25,7 +25,7 @@ public class Siamese extends Cat { * * @return the breed value */ - public String getBreed() { + public String breed() { return this.breed; } @@ -33,9 +33,11 @@ public String getBreed() { * Set the breed value. * * @param breed the breed value to set + * @return the Siamese object itself. */ - public void setBreed(String breed) { + public Siamese withBreed(String breed) { this.breed = breed; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/StringWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/StringWrapper.java index 197760200a5d6..e0d45e5175a17 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/StringWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/StringWrapper.java @@ -37,7 +37,7 @@ public class StringWrapper { * * @return the field value */ - public String getField() { + public String field() { return this.field; } @@ -45,9 +45,11 @@ public String getField() { * Set the field value. * * @param field the field value to set + * @return the StringWrapper object itself. */ - public void setField(String field) { + public StringWrapper withField(String field) { this.field = field; + return this; } /** @@ -55,7 +57,7 @@ public void setField(String field) { * * @return the empty value */ - public String getEmpty() { + public String empty() { return this.empty; } @@ -63,9 +65,11 @@ public String getEmpty() { * Set the empty value. * * @param empty the empty value to set + * @return the StringWrapper object itself. */ - public void setEmpty(String empty) { + public StringWrapper withEmpty(String empty) { this.empty = empty; + return this; } /** @@ -73,7 +77,7 @@ public void setEmpty(String empty) { * * @return the nullProperty value */ - public String getNullProperty() { + public String nullProperty() { return this.nullProperty; } @@ -81,9 +85,11 @@ public String getNullProperty() { * Set the nullProperty value. * * @param nullProperty the nullProperty value to set + * @return the StringWrapper object itself. */ - public void setNullProperty(String nullProperty) { + public StringWrapper withNullProperty(String nullProperty) { this.nullProperty = nullProperty; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/package-info.java index 3c264af2583a7..5287b511cf915 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestComplexTestService. + * This package contains the models classes for AutoRestComplexTestService. * Test Infrastructure for AutoRest. */ package fixtures.bodycomplex.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/AutoRestDateTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/AutoRestDateTestService.java index d331ca3bb8d43..1fe8e8db57c0a 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/AutoRestDateTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/AutoRestDateTestService.java @@ -10,49 +10,20 @@ package fixtures.bodydate; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestDateTestService class. */ public interface AutoRestDateTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "https://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Dates object to access its operations. + * @return the Dates object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the DateOperations object to access its operations. - * @return the DateOperations object. - */ - DateOperations getDateOperations(); + Dates dates(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/DateOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/Dates.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/DateOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/Dates.java index a873b3731f8d1..ef6e04b72bb7b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/DateOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/Dates.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in DateOperations. + * in Dates. */ -public interface DateOperations { +public interface Dates { /** * Get null date value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/AutoRestDateTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/implementation/AutoRestDateTestServiceImpl.java similarity index 51% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/AutoRestDateTestServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/implementation/AutoRestDateTestServiceImpl.java index e2dea8a6cd201..da8245c62004d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/AutoRestDateTestServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/implementation/AutoRestDateTestServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodydate; +package fixtures.bodydate.implementation; +import fixtures.bodydate.AutoRestDateTestService; +import fixtures.bodydate.Dates; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestDateTestService class. */ public final class AutoRestDateTestServiceImpl extends ServiceClient implements AutoRestDateTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Dates object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Dates dates; /** - * Gets the DateOperations object to access its operations. - * @return the DateOperations object. + * Gets the Dates object to access its operations. + * @return the Dates object. */ - public DateOperations getDateOperations() { - return new DateOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Dates dates() { + return this.dates; } /** @@ -54,8 +47,18 @@ public AutoRestDateTestServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestDateTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestDateTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestDateTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("https://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestDateTestServiceImpl(String baseUrl) { * Initializes an instance of AutoRestDateTestService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestDateTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestDateTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.dates = new DatesImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/DateOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/implementation/DatesImpl.java similarity index 96% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/DateOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/implementation/DatesImpl.java index 61d4d1ac27efd..e3ad4f0090011 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/DateOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/implementation/DatesImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodydate; +package fixtures.bodydate.implementation; +import retrofit2.Retrofit; +import fixtures.bodydate.Dates; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -26,34 +28,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in DateOperations. + * in Dates. */ -public final class DateOperationsImpl implements DateOperations { +public final class DatesImpl implements Dates { /** The Retrofit service to perform REST calls. */ - private DateService service; + private DatesService service; /** The service client containing this operation class. */ - private AutoRestDateTestService client; + private AutoRestDateTestServiceImpl client; /** - * Initializes an instance of DateOperations. + * Initializes an instance of Dates. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public DateOperationsImpl(Retrofit retrofit, AutoRestDateTestService client) { - this.service = retrofit.create(DateService.class); + public DatesImpl(Retrofit retrofit, AutoRestDateTestServiceImpl client) { + this.service = retrofit.create(DatesService.class); this.client = client; } /** - * The interface defining all the services for DateOperations to be + * The interface defining all the services for Dates to be * used by Retrofit to perform actually REST calls. */ - interface DateService { + interface DatesService { @Headers("Content-Type: application/json; charset=utf-8") @GET("date/null") Call getNull(); @@ -127,7 +128,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -172,7 +173,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDateDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -217,7 +218,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getOverflowDateDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -262,7 +263,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUnderflowDateDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -317,7 +318,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putMaxDateDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -362,7 +363,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMaxDateDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -417,7 +418,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putMinDateDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -462,7 +463,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMinDateDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/implementation/package-info.java new file mode 100644 index 0000000000000..1f4f9897a637e --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestDateTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.bodydate.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/Error.java index 1b65299d03764..beace92f6c83d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/ErrorException.java index 90d6393844073..1f20d20efd277 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodydate.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/package-info.java index bc59448d8960c..30108040925fb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydate/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestDateTestService. + * This package contains the models classes for AutoRestDateTestService. * Test Infrastructure for AutoRest. */ package fixtures.bodydate.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/AutoRestDateTimeTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/AutoRestDateTimeTestService.java index 6e7189802282c..4cf6aeb40245c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/AutoRestDateTimeTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/AutoRestDateTimeTestService.java @@ -10,49 +10,20 @@ package fixtures.bodydatetime; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestDateTimeTestService class. */ public interface AutoRestDateTimeTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "https://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Datetimes object to access its operations. + * @return the Datetimes object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the DatetimeOperations object to access its operations. - * @return the DatetimeOperations object. - */ - DatetimeOperations getDatetimeOperations(); + Datetimes datetimes(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/DatetimeOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/Datetimes.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/DatetimeOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/Datetimes.java index 09a345f30a825..c337759c138a3 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/DatetimeOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/Datetimes.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in DatetimeOperations. + * in Datetimes. */ -public interface DatetimeOperations { +public interface Datetimes { /** * Get null datetime value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/AutoRestDateTimeTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/implementation/AutoRestDateTimeTestServiceImpl.java similarity index 50% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/AutoRestDateTimeTestServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/implementation/AutoRestDateTimeTestServiceImpl.java index 635f85e774838..1586c585f29c7 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/AutoRestDateTimeTestServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/implementation/AutoRestDateTimeTestServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodydatetime; +package fixtures.bodydatetime.implementation; +import fixtures.bodydatetime.AutoRestDateTimeTestService; +import fixtures.bodydatetime.Datetimes; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestDateTimeTestService class. */ public final class AutoRestDateTimeTestServiceImpl extends ServiceClient implements AutoRestDateTimeTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Datetimes object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Datetimes datetimes; /** - * Gets the DatetimeOperations object to access its operations. - * @return the DatetimeOperations object. + * Gets the Datetimes object to access its operations. + * @return the Datetimes object. */ - public DatetimeOperations getDatetimeOperations() { - return new DatetimeOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Datetimes datetimes() { + return this.datetimes; } /** @@ -54,8 +47,18 @@ public AutoRestDateTimeTestServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestDateTimeTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestDateTimeTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestDateTimeTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("https://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestDateTimeTestServiceImpl(String baseUrl) { * Initializes an instance of AutoRestDateTimeTestService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestDateTimeTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestDateTimeTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.datetimes = new DatetimesImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/DatetimeOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/implementation/DatetimesImpl.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/DatetimeOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/implementation/DatetimesImpl.java index bbd7911cb8582..215330739e5cb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/DatetimeOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/implementation/DatetimesImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodydatetime; +package fixtures.bodydatetime.implementation; +import retrofit2.Retrofit; +import fixtures.bodydatetime.Datetimes; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -26,34 +28,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in DatetimeOperations. + * in Datetimes. */ -public final class DatetimeOperationsImpl implements DatetimeOperations { +public final class DatetimesImpl implements Datetimes { /** The Retrofit service to perform REST calls. */ - private DatetimeService service; + private DatetimesService service; /** The service client containing this operation class. */ - private AutoRestDateTimeTestService client; + private AutoRestDateTimeTestServiceImpl client; /** - * Initializes an instance of DatetimeOperations. + * Initializes an instance of Datetimes. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public DatetimeOperationsImpl(Retrofit retrofit, AutoRestDateTimeTestService client) { - this.service = retrofit.create(DatetimeService.class); + public DatetimesImpl(Retrofit retrofit, AutoRestDateTimeTestServiceImpl client) { + this.service = retrofit.create(DatetimesService.class); this.client = client; } /** - * The interface defining all the services for DatetimeOperations to be + * The interface defining all the services for Datetimes to be * used by Retrofit to perform actually REST calls. */ - interface DatetimeService { + interface DatetimesService { @Headers("Content-Type: application/json; charset=utf-8") @GET("datetime/null") Call getNull(); @@ -171,7 +172,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -216,7 +217,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -261,7 +262,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getOverflowDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -306,7 +307,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUnderflowDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -361,7 +362,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putUtcMaxDateTimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -406,7 +407,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUtcLowercaseMaxDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -451,7 +452,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUtcUppercaseMaxDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -506,7 +507,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putLocalPositiveOffsetMaxDateTimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -551,7 +552,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getLocalPositiveOffsetLowercaseMaxDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -596,7 +597,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getLocalPositiveOffsetUppercaseMaxDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -651,7 +652,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putLocalNegativeOffsetMaxDateTimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -696,7 +697,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getLocalNegativeOffsetUppercaseMaxDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -741,7 +742,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getLocalNegativeOffsetLowercaseMaxDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -796,7 +797,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putUtcMinDateTimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -841,7 +842,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUtcMinDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -896,7 +897,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putLocalPositiveOffsetMinDateTimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -941,7 +942,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getLocalPositiveOffsetMinDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -996,7 +997,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putLocalNegativeOffsetMinDateTimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1041,7 +1042,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getLocalNegativeOffsetMinDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/implementation/package-info.java new file mode 100644 index 0000000000000..f7651101a7418 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestDateTimeTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.bodydatetime.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/Error.java index 3157df04b13bf..ae1c386261ff3 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/ErrorException.java index f57363c3bf4b5..5ea2551b9015b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodydatetime.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/package-info.java index b291928a47839..ef150361f72d6 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetime/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestDateTimeTestService. + * This package contains the models classes for AutoRestDateTimeTestService. * Test Infrastructure for AutoRest. */ package fixtures.bodydatetime.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/AutoRestRFC1123DateTimeTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/AutoRestRFC1123DateTimeTestService.java index 8c15100de3d1b..bb6d704709509 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/AutoRestRFC1123DateTimeTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/AutoRestRFC1123DateTimeTestService.java @@ -10,49 +10,20 @@ package fixtures.bodydatetimerfc1123; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestRFC1123DateTimeTestService class. */ public interface AutoRestRFC1123DateTimeTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "https://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Datetimerfc1123s object to access its operations. + * @return the Datetimerfc1123s object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the Datetimerfc1123Operations object to access its operations. - * @return the Datetimerfc1123Operations object. - */ - Datetimerfc1123Operations getDatetimerfc1123Operations(); + Datetimerfc1123s datetimerfc1123s(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/AutoRestRFC1123DateTimeTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/AutoRestRFC1123DateTimeTestServiceImpl.java deleted file mode 100644 index 4ed4773e21a07..0000000000000 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/AutoRestRFC1123DateTimeTestServiceImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -package fixtures.bodydatetimerfc1123; - -import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; - -/** - * Initializes a new instance of the AutoRestRFC1123DateTimeTestService class. - */ -public final class AutoRestRFC1123DateTimeTestServiceImpl extends ServiceClient implements AutoRestRFC1123DateTimeTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - - /** - * Gets the Datetimerfc1123Operations object to access its operations. - * @return the Datetimerfc1123Operations object. - */ - public Datetimerfc1123Operations getDatetimerfc1123Operations() { - return new Datetimerfc1123OperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Initializes an instance of AutoRestRFC1123DateTimeTestService client. - */ - public AutoRestRFC1123DateTimeTestServiceImpl() { - this("https://localhost"); - } - - /** - * Initializes an instance of AutoRestRFC1123DateTimeTestService client. - * - * @param baseUrl the base URL of the host - */ - public AutoRestRFC1123DateTimeTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - /** - * Initializes an instance of AutoRestRFC1123DateTimeTestService client. - * - * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} - */ - public AutoRestRFC1123DateTimeTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); - } -} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/Datetimerfc1123Operations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/Datetimerfc1123s.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/Datetimerfc1123Operations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/Datetimerfc1123s.java index 9204bc950ba56..a234e4a21463e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/Datetimerfc1123Operations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/Datetimerfc1123s.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in Datetimerfc1123Operations. + * in Datetimerfc1123s. */ -public interface Datetimerfc1123Operations { +public interface Datetimerfc1123s { /** * Get null datetime value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/implementation/AutoRestRFC1123DateTimeTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/implementation/AutoRestRFC1123DateTimeTestServiceImpl.java new file mode 100644 index 0000000000000..a6089b1cc36c0 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/implementation/AutoRestRFC1123DateTimeTestServiceImpl.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.bodydatetimerfc1123.implementation; + +import fixtures.bodydatetimerfc1123.AutoRestRFC1123DateTimeTestService; +import fixtures.bodydatetimerfc1123.Datetimerfc1123s; +import com.microsoft.rest.ServiceClient; +import okhttp3.OkHttpClient; +import retrofit2.Retrofit; + +/** + * Initializes a new instance of the AutoRestRFC1123DateTimeTestService class. + */ +public final class AutoRestRFC1123DateTimeTestServiceImpl extends ServiceClient implements AutoRestRFC1123DateTimeTestService { + + /** + * The Datetimerfc1123s object to access its operations. + */ + private Datetimerfc1123s datetimerfc1123s; + + /** + * Gets the Datetimerfc1123s object to access its operations. + * @return the Datetimerfc1123s object. + */ + public Datetimerfc1123s datetimerfc1123s() { + return this.datetimerfc1123s; + } + + /** + * Initializes an instance of AutoRestRFC1123DateTimeTestService client. + */ + public AutoRestRFC1123DateTimeTestServiceImpl() { + this("https://localhost"); + } + + /** + * Initializes an instance of AutoRestRFC1123DateTimeTestService client. + * + * @param baseUrl the base URL of the host + */ + public AutoRestRFC1123DateTimeTestServiceImpl(String baseUrl) { + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestRFC1123DateTimeTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestRFC1123DateTimeTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("https://localhost", clientBuilder, restBuilder); + initialize(); + } + + /** + * Initializes an instance of AutoRestRFC1123DateTimeTestService client. + * + * @param baseUrl the base URL of the host + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestRFC1123DateTimeTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); + initialize(); + } + + private void initialize() { + this.datetimerfc1123s = new Datetimerfc1123sImpl(retrofit(), this); + } +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/Datetimerfc1123OperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/implementation/Datetimerfc1123sImpl.java similarity index 96% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/Datetimerfc1123OperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/implementation/Datetimerfc1123sImpl.java index aa6910fc4de5d..e984b4580da5f 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/Datetimerfc1123OperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/implementation/Datetimerfc1123sImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodydatetimerfc1123; +package fixtures.bodydatetimerfc1123.implementation; +import retrofit2.Retrofit; +import fixtures.bodydatetimerfc1123.Datetimerfc1123s; import com.google.common.reflect.TypeToken; import com.microsoft.rest.DateTimeRfc1123; import com.microsoft.rest.ServiceCall; @@ -27,34 +29,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in Datetimerfc1123Operations. + * in Datetimerfc1123s. */ -public final class Datetimerfc1123OperationsImpl implements Datetimerfc1123Operations { +public final class Datetimerfc1123sImpl implements Datetimerfc1123s { /** The Retrofit service to perform REST calls. */ - private Datetimerfc1123Service service; + private Datetimerfc1123sService service; /** The service client containing this operation class. */ - private AutoRestRFC1123DateTimeTestService client; + private AutoRestRFC1123DateTimeTestServiceImpl client; /** - * Initializes an instance of Datetimerfc1123Operations. + * Initializes an instance of Datetimerfc1123s. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public Datetimerfc1123OperationsImpl(Retrofit retrofit, AutoRestRFC1123DateTimeTestService client) { - this.service = retrofit.create(Datetimerfc1123Service.class); + public Datetimerfc1123sImpl(Retrofit retrofit, AutoRestRFC1123DateTimeTestServiceImpl client) { + this.service = retrofit.create(Datetimerfc1123sService.class); this.client = client; } /** - * The interface defining all the services for Datetimerfc1123Operations to be + * The interface defining all the services for Datetimerfc1123s to be * used by Retrofit to perform actually REST calls. */ - interface Datetimerfc1123Service { + interface Datetimerfc1123sService { @Headers("Content-Type: application/json; charset=utf-8") @GET("datetimerfc1123/null") Call getNull(); @@ -142,7 +143,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -197,7 +198,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -252,7 +253,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getOverflowDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -307,7 +308,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUnderflowDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -364,7 +365,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putUtcMaxDateTimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -419,7 +420,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUtcLowercaseMaxDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -474,7 +475,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUtcUppercaseMaxDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -531,7 +532,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putUtcMinDateTimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -586,7 +587,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUtcMinDateTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/implementation/package-info.java new file mode 100644 index 0000000000000..d04b9f0ead50a --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestRFC1123DateTimeTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.bodydatetimerfc1123.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/Error.java index a0e8c65702349..53b73e464f7fa 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/ErrorException.java index aee1093a88b0b..0db3d5b1eb04b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodydatetimerfc1123.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/package-info.java index f02dffab5ec47..a8b44bee8577f 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydatetimerfc1123/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestRFC1123DateTimeTestService. + * This package contains the models classes for AutoRestRFC1123DateTimeTestService. * Test Infrastructure for AutoRest. */ package fixtures.bodydatetimerfc1123.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/AutoRestSwaggerBATdictionaryService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/AutoRestSwaggerBATdictionaryService.java index eb3c3c99dd23e..a4788569ca2d8 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/AutoRestSwaggerBATdictionaryService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/AutoRestSwaggerBATdictionaryService.java @@ -10,49 +10,20 @@ package fixtures.bodydictionary; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestSwaggerBATdictionaryService class. */ public interface AutoRestSwaggerBATdictionaryService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Dictionarys object to access its operations. + * @return the Dictionarys object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the DictionaryOperations object to access its operations. - * @return the DictionaryOperations object. - */ - DictionaryOperations getDictionaryOperations(); + Dictionarys dictionarys(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/DictionaryOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/Dictionarys.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/DictionaryOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/Dictionarys.java index 1fd31d6edb98a..b71c63fc313a8 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/DictionaryOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/Dictionarys.java @@ -24,9 +24,9 @@ /** * An instance of this class provides access to all the operations defined - * in DictionaryOperations. + * in Dictionarys. */ -public interface DictionaryOperations { +public interface Dictionarys { /** * Get null dictionary value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/AutoRestSwaggerBATdictionaryServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/implementation/AutoRestSwaggerBATdictionaryServiceImpl.java similarity index 50% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/AutoRestSwaggerBATdictionaryServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/implementation/AutoRestSwaggerBATdictionaryServiceImpl.java index f8e28485b8cb3..ce0e6b7a5e603 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/AutoRestSwaggerBATdictionaryServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/implementation/AutoRestSwaggerBATdictionaryServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodydictionary; +package fixtures.bodydictionary.implementation; +import fixtures.bodydictionary.AutoRestSwaggerBATdictionaryService; +import fixtures.bodydictionary.Dictionarys; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestSwaggerBATdictionaryService class. */ public final class AutoRestSwaggerBATdictionaryServiceImpl extends ServiceClient implements AutoRestSwaggerBATdictionaryService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Dictionarys object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Dictionarys dictionarys; /** - * Gets the DictionaryOperations object to access its operations. - * @return the DictionaryOperations object. + * Gets the Dictionarys object to access its operations. + * @return the Dictionarys object. */ - public DictionaryOperations getDictionaryOperations() { - return new DictionaryOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Dictionarys dictionarys() { + return this.dictionarys; } /** @@ -54,8 +47,18 @@ public AutoRestSwaggerBATdictionaryServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestSwaggerBATdictionaryServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestSwaggerBATdictionaryService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestSwaggerBATdictionaryServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestSwaggerBATdictionaryServiceImpl(String baseUrl) { * Initializes an instance of AutoRestSwaggerBATdictionaryService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestSwaggerBATdictionaryServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestSwaggerBATdictionaryServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.dictionarys = new DictionarysImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/DictionaryOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/DictionaryOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java index 0dfc895dfa5e3..dc0b9227eb8ca 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/DictionaryOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodydictionary; +package fixtures.bodydictionary.implementation; +import retrofit2.Retrofit; +import fixtures.bodydictionary.Dictionarys; import com.google.common.reflect.TypeToken; import com.microsoft.rest.DateTimeRfc1123; import com.microsoft.rest.ServiceCall; @@ -34,34 +36,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in DictionaryOperations. + * in Dictionarys. */ -public final class DictionaryOperationsImpl implements DictionaryOperations { +public final class DictionarysImpl implements Dictionarys { /** The Retrofit service to perform REST calls. */ - private DictionaryService service; + private DictionarysService service; /** The service client containing this operation class. */ - private AutoRestSwaggerBATdictionaryService client; + private AutoRestSwaggerBATdictionaryServiceImpl client; /** - * Initializes an instance of DictionaryOperations. + * Initializes an instance of Dictionarys. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public DictionaryOperationsImpl(Retrofit retrofit, AutoRestSwaggerBATdictionaryService client) { - this.service = retrofit.create(DictionaryService.class); + public DictionarysImpl(Retrofit retrofit, AutoRestSwaggerBATdictionaryServiceImpl client) { + this.service = retrofit.create(DictionarysService.class); this.client = client; } /** - * The interface defining all the services for DictionaryOperations to be + * The interface defining all the services for Dictionarys to be * used by Retrofit to perform actually REST calls. */ - interface DictionaryService { + interface DictionarysService { @Headers("Content-Type: application/json; charset=utf-8") @GET("dictionary/null") Call getNull(); @@ -363,7 +364,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -408,7 +409,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -465,7 +466,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -510,7 +511,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getNullValueDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -555,7 +556,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getNullKeyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -600,7 +601,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getEmptyStringKeyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -645,7 +646,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -690,7 +691,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getBooleanTfftDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -747,7 +748,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBooleanTfftDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -792,7 +793,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getBooleanInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -837,7 +838,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getBooleanInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -882,7 +883,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getIntegerValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -939,7 +940,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putIntegerValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -984,7 +985,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getIntInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1029,7 +1030,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getIntInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1074,7 +1075,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getLongValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1131,7 +1132,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putLongValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1176,7 +1177,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getLongInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1221,7 +1222,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getLongInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1266,7 +1267,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getFloatValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1323,7 +1324,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putFloatValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1368,7 +1369,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getFloatInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1413,7 +1414,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getFloatInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1458,7 +1459,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDoubleValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1515,7 +1516,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDoubleValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1560,7 +1561,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDoubleInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1605,7 +1606,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDoubleInvalidStringDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1650,7 +1651,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getStringValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1707,7 +1708,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putStringValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1752,7 +1753,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getStringWithNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1797,7 +1798,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getStringWithInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1842,7 +1843,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDateValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1899,7 +1900,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDateValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1944,7 +1945,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDateInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1989,7 +1990,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDateInvalidCharsDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2034,7 +2035,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDateTimeValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2091,7 +2092,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDateTimeValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2136,7 +2137,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDateTimeInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2181,7 +2182,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDateTimeInvalidCharsDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2246,7 +2247,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDateTimeRfc1123ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2313,7 +2314,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDateTimeRfc1123ValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2358,7 +2359,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDurationValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2415,7 +2416,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDurationValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2460,7 +2461,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getByteValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2517,7 +2518,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putByteValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2562,7 +2563,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getByteInvalidNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2607,7 +2608,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getBase64UrlDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2652,7 +2653,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getComplexNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2697,7 +2698,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getComplexEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2742,7 +2743,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getComplexItemNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2787,7 +2788,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getComplexItemEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2832,7 +2833,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getComplexValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2889,7 +2890,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putComplexValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2934,7 +2935,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getArrayNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2979,7 +2980,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getArrayEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3024,7 +3025,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getArrayItemNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3069,7 +3070,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getArrayItemEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3114,7 +3115,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getArrayValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3171,7 +3172,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putArrayValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3216,7 +3217,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getDictionaryNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3261,7 +3262,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getDictionaryEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3306,7 +3307,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getDictionaryItemNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3351,7 +3352,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getDictionaryItemEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3396,7 +3397,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse>> getDictionaryValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder>, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder>, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken>>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -3453,7 +3454,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDictionaryValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/implementation/package-info.java new file mode 100644 index 0000000000000..bc173a6b1569b --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestSwaggerBATdictionaryService. + * Test Infrastructure for AutoRest Swagger BAT. + */ +package fixtures.bodydictionary.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/Error.java index c135aa38c5aa5..673de8776ef17 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/ErrorException.java index c18ad55f9be7a..2ff8a001c092d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodydictionary.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/Widget.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/Widget.java index 74c9f83006ff4..88d9f0fb77e07 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/Widget.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/Widget.java @@ -32,7 +32,7 @@ public class Widget { * * @return the integer value */ - public Integer getInteger() { + public Integer integer() { return this.integer; } @@ -40,9 +40,11 @@ public Integer getInteger() { * Set the integer value. * * @param integer the integer value to set + * @return the Widget object itself. */ - public void setInteger(Integer integer) { + public Widget withInteger(Integer integer) { this.integer = integer; + return this; } /** @@ -50,7 +52,7 @@ public void setInteger(Integer integer) { * * @return the stringProperty value */ - public String getStringProperty() { + public String stringProperty() { return this.stringProperty; } @@ -58,9 +60,11 @@ public String getStringProperty() { * Set the stringProperty value. * * @param stringProperty the stringProperty value to set + * @return the Widget object itself. */ - public void setStringProperty(String stringProperty) { + public Widget withStringProperty(String stringProperty) { this.stringProperty = stringProperty; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/package-info.java index 77a48deca6d91..0dac2d0375bc5 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestSwaggerBATdictionaryService. + * This package contains the models classes for AutoRestSwaggerBATdictionaryService. * Test Infrastructure for AutoRest Swagger BAT. */ package fixtures.bodydictionary.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/AutoRestDurationTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/AutoRestDurationTestService.java index fa0aa8bd5832f..b1102b9984fff 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/AutoRestDurationTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/AutoRestDurationTestService.java @@ -10,49 +10,20 @@ package fixtures.bodyduration; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestDurationTestService class. */ public interface AutoRestDurationTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "https://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Durations object to access its operations. + * @return the Durations object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the DurationOperations object to access its operations. - * @return the DurationOperations object. - */ - DurationOperations getDurationOperations(); + Durations durations(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/DurationOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/Durations.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/DurationOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/Durations.java index eb6adc6ca0045..bc8869fed5f64 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/DurationOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/Durations.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in DurationOperations. + * in Durations. */ -public interface DurationOperations { +public interface Durations { /** * Get null duration value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/AutoRestDurationTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/implementation/AutoRestDurationTestServiceImpl.java similarity index 50% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/AutoRestDurationTestServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/implementation/AutoRestDurationTestServiceImpl.java index 5d1a78410fa4d..2152c1ed18c3b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/AutoRestDurationTestServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/implementation/AutoRestDurationTestServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodyduration; +package fixtures.bodyduration.implementation; +import fixtures.bodyduration.AutoRestDurationTestService; +import fixtures.bodyduration.Durations; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestDurationTestService class. */ public final class AutoRestDurationTestServiceImpl extends ServiceClient implements AutoRestDurationTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Durations object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Durations durations; /** - * Gets the DurationOperations object to access its operations. - * @return the DurationOperations object. + * Gets the Durations object to access its operations. + * @return the Durations object. */ - public DurationOperations getDurationOperations() { - return new DurationOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Durations durations() { + return this.durations; } /** @@ -54,8 +47,18 @@ public AutoRestDurationTestServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestDurationTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestDurationTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestDurationTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("https://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestDurationTestServiceImpl(String baseUrl) { * Initializes an instance of AutoRestDurationTestService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestDurationTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestDurationTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.durations = new DurationsImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/DurationOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/implementation/DurationsImpl.java similarity index 94% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/DurationOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/implementation/DurationsImpl.java index 987bc30b5e0db..ad574bd4f78b5 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/DurationOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/implementation/DurationsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodyduration; +package fixtures.bodyduration.implementation; +import retrofit2.Retrofit; +import fixtures.bodyduration.Durations; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -26,34 +28,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in DurationOperations. + * in Durations. */ -public final class DurationOperationsImpl implements DurationOperations { +public final class DurationsImpl implements Durations { /** The Retrofit service to perform REST calls. */ - private DurationService service; + private DurationsService service; /** The service client containing this operation class. */ - private AutoRestDurationTestService client; + private AutoRestDurationTestServiceImpl client; /** - * Initializes an instance of DurationOperations. + * Initializes an instance of Durations. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public DurationOperationsImpl(Retrofit retrofit, AutoRestDurationTestService client) { - this.service = retrofit.create(DurationService.class); + public DurationsImpl(Retrofit retrofit, AutoRestDurationTestServiceImpl client) { + this.service = retrofit.create(DurationsService.class); this.client = client; } /** - * The interface defining all the services for DurationOperations to be + * The interface defining all the services for Durations to be * used by Retrofit to perform actually REST calls. */ - interface DurationService { + interface DurationsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("duration/null") Call getNull(); @@ -111,7 +112,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -166,7 +167,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putPositiveDurationDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -211,7 +212,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getPositiveDurationDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -256,7 +257,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/implementation/package-info.java new file mode 100644 index 0000000000000..559836e1c4e61 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestDurationTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.bodyduration.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/Error.java index 9175e8df594a8..bbdc13474329d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/ErrorException.java index f15e48d7656f3..13f7d35d713eb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodyduration.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/package-info.java index 335761e707b9e..e6156cf72ae7f 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyduration/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestDurationTestService. + * This package contains the models classes for AutoRestDurationTestService. * Test Infrastructure for AutoRest. */ package fixtures.bodyduration.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/AutoRestSwaggerBATFileService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/AutoRestSwaggerBATFileService.java index 065d716d7fd0e..ec8ba625e4eea 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/AutoRestSwaggerBATFileService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/AutoRestSwaggerBATFileService.java @@ -10,49 +10,20 @@ package fixtures.bodyfile; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestSwaggerBATFileService class. */ public interface AutoRestSwaggerBATFileService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Files object to access its operations. + * @return the Files object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the FilesOperations object to access its operations. - * @return the FilesOperations object. - */ - FilesOperations getFilesOperations(); + Files files(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/FilesOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/Files.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/FilesOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/Files.java index dc2fab35888bc..6ffcbfa37cdb5 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/FilesOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/Files.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in FilesOperations. + * in Files. */ -public interface FilesOperations { +public interface Files { /** * Get file. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/AutoRestSwaggerBATFileServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/implementation/AutoRestSwaggerBATFileServiceImpl.java similarity index 51% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/AutoRestSwaggerBATFileServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/implementation/AutoRestSwaggerBATFileServiceImpl.java index f2483361a8816..92a9f9c3db818 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/AutoRestSwaggerBATFileServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/implementation/AutoRestSwaggerBATFileServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodyfile; +package fixtures.bodyfile.implementation; +import fixtures.bodyfile.AutoRestSwaggerBATFileService; +import fixtures.bodyfile.Files; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestSwaggerBATFileService class. */ public final class AutoRestSwaggerBATFileServiceImpl extends ServiceClient implements AutoRestSwaggerBATFileService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Files object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Files files; /** - * Gets the FilesOperations object to access its operations. - * @return the FilesOperations object. + * Gets the Files object to access its operations. + * @return the Files object. */ - public FilesOperations getFilesOperations() { - return new FilesOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Files files() { + return this.files; } /** @@ -54,8 +47,18 @@ public AutoRestSwaggerBATFileServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestSwaggerBATFileServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestSwaggerBATFileService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestSwaggerBATFileServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestSwaggerBATFileServiceImpl(String baseUrl) { * Initializes an instance of AutoRestSwaggerBATFileService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestSwaggerBATFileServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestSwaggerBATFileServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.files = new FilesImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/FilesOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/implementation/FilesImpl.java similarity index 94% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/FilesOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/implementation/FilesImpl.java index 06511befcedf1..eadb1d74f09bf 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/FilesOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/implementation/FilesImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodyfile; +package fixtures.bodyfile.implementation; +import retrofit2.Retrofit; +import fixtures.bodyfile.Files; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -25,31 +27,30 @@ import retrofit2.http.Headers; import retrofit2.http.Streaming; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in FilesOperations. + * in Files. */ -public final class FilesOperationsImpl implements FilesOperations { +public final class FilesImpl implements Files { /** The Retrofit service to perform REST calls. */ private FilesService service; /** The service client containing this operation class. */ - private AutoRestSwaggerBATFileService client; + private AutoRestSwaggerBATFileServiceImpl client; /** - * Initializes an instance of FilesOperations. + * Initializes an instance of Files. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public FilesOperationsImpl(Retrofit retrofit, AutoRestSwaggerBATFileService client) { + public FilesImpl(Retrofit retrofit, AutoRestSwaggerBATFileServiceImpl client) { this.service = retrofit.create(FilesService.class); this.client = client; } /** - * The interface defining all the services for FilesOperations to be + * The interface defining all the services for Files to be * used by Retrofit to perform actually REST calls. */ interface FilesService { @@ -109,7 +110,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getFileDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -154,7 +155,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getFileLargeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -199,7 +200,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyFileDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/implementation/package-info.java new file mode 100644 index 0000000000000..9133b36958a86 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestSwaggerBATFileService. + * Test Infrastructure for AutoRest Swagger BAT. + */ +package fixtures.bodyfile.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/Error.java index ba019e688f265..ae2817647d67d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/ErrorException.java index 7b290a353d3a9..9c496004f78b5 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodyfile.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/package-info.java index 0abcda75f0594..e23a8a3cf35e6 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyfile/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestSwaggerBATFileService. + * This package contains the models classes for AutoRestSwaggerBATFileService. * Test Infrastructure for AutoRest Swagger BAT. */ package fixtures.bodyfile.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/AutoRestSwaggerBATFormDataService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/AutoRestSwaggerBATFormDataService.java index d3064cdef5999..a47624ce0061f 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/AutoRestSwaggerBATFormDataService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/AutoRestSwaggerBATFormDataService.java @@ -10,49 +10,20 @@ package fixtures.bodyformdata; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestSwaggerBATFormDataService class. */ public interface AutoRestSwaggerBATFormDataService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Formdatas object to access its operations. + * @return the Formdatas object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the FormdataOperations object to access its operations. - * @return the FormdataOperations object. - */ - FormdataOperations getFormdataOperations(); + Formdatas formdatas(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/FormdataOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/Formdatas.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/FormdataOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/Formdatas.java index 18ac5bb1b7e4b..71c8d87d6cdb8 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/FormdataOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/Formdatas.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in FormdataOperations. + * in Formdatas. */ -public interface FormdataOperations { +public interface Formdatas { /** * Upload file. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/AutoRestSwaggerBATFormDataServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/implementation/AutoRestSwaggerBATFormDataServiceImpl.java similarity index 50% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/AutoRestSwaggerBATFormDataServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/implementation/AutoRestSwaggerBATFormDataServiceImpl.java index 579fdc06c7fe5..aa9bdabddaa98 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/AutoRestSwaggerBATFormDataServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/implementation/AutoRestSwaggerBATFormDataServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodyformdata; +package fixtures.bodyformdata.implementation; +import fixtures.bodyformdata.AutoRestSwaggerBATFormDataService; +import fixtures.bodyformdata.Formdatas; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestSwaggerBATFormDataService class. */ public final class AutoRestSwaggerBATFormDataServiceImpl extends ServiceClient implements AutoRestSwaggerBATFormDataService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Formdatas object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Formdatas formdatas; /** - * Gets the FormdataOperations object to access its operations. - * @return the FormdataOperations object. + * Gets the Formdatas object to access its operations. + * @return the Formdatas object. */ - public FormdataOperations getFormdataOperations() { - return new FormdataOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Formdatas formdatas() { + return this.formdatas; } /** @@ -54,8 +47,18 @@ public AutoRestSwaggerBATFormDataServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestSwaggerBATFormDataServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestSwaggerBATFormDataService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestSwaggerBATFormDataServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestSwaggerBATFormDataServiceImpl(String baseUrl) { * Initializes an instance of AutoRestSwaggerBATFormDataService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestSwaggerBATFormDataServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestSwaggerBATFormDataServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.formdatas = new FormdatasImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/FormdataOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/implementation/FormdatasImpl.java similarity index 92% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/FormdataOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/implementation/FormdatasImpl.java index 94db4668feedc..5ebdde32d95ec 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/FormdataOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/implementation/FormdatasImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodyformdata; +package fixtures.bodyformdata.implementation; +import retrofit2.Retrofit; +import fixtures.bodyformdata.Formdatas; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -31,34 +33,33 @@ import retrofit2.http.PUT; import retrofit2.http.Streaming; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in FormdataOperations. + * in Formdatas. */ -public final class FormdataOperationsImpl implements FormdataOperations { +public final class FormdatasImpl implements Formdatas { /** The Retrofit service to perform REST calls. */ - private FormdataService service; + private FormdatasService service; /** The service client containing this operation class. */ - private AutoRestSwaggerBATFormDataService client; + private AutoRestSwaggerBATFormDataServiceImpl client; /** - * Initializes an instance of FormdataOperations. + * Initializes an instance of Formdatas. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public FormdataOperationsImpl(Retrofit retrofit, AutoRestSwaggerBATFormDataService client) { - this.service = retrofit.create(FormdataService.class); + public FormdatasImpl(Retrofit retrofit, AutoRestSwaggerBATFormDataServiceImpl client) { + this.service = retrofit.create(FormdatasService.class); this.client = client; } /** - * The interface defining all the services for FormdataOperations to be + * The interface defining all the services for Formdatas to be * used by Retrofit to perform actually REST calls. */ - interface FormdataService { + interface FormdatasService { @Multipart @POST("formdata/stream/uploadfile") @Streaming @@ -131,7 +132,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse uploadFileDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -188,7 +189,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse uploadFileViaBodyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/implementation/package-info.java new file mode 100644 index 0000000000000..fe7fa17669346 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestSwaggerBATFormDataService. + * Test Infrastructure for AutoRest Swagger BAT. + */ +package fixtures.bodyformdata.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/Error.java index 93bf9924e8099..1c758066c61ac 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/ErrorException.java index a4bf5372b9eb8..3967d56f7c46b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodyformdata.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/package-info.java index 1d1122d348f37..c3af409bee867 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyformdata/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestSwaggerBATFormDataService. + * This package contains the models classes for AutoRestSwaggerBATFormDataService. * Test Infrastructure for AutoRest Swagger BAT. */ package fixtures.bodyformdata.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/AutoRestIntegerTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/AutoRestIntegerTestService.java index b9ee7b29664ab..5c24783c6d77a 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/AutoRestIntegerTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/AutoRestIntegerTestService.java @@ -10,49 +10,20 @@ package fixtures.bodyinteger; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestIntegerTestService class. */ public interface AutoRestIntegerTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Ints object to access its operations. + * @return the Ints object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the IntOperations object to access its operations. - * @return the IntOperations object. - */ - IntOperations getIntOperations(); + Ints ints(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/Ints.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/Ints.java index 9710c80eabe31..011e32b76a614 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/Ints.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in IntOperations. + * in Ints. */ -public interface IntOperations { +public interface Ints { /** * Get null Int value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/AutoRestIntegerTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/implementation/AutoRestIntegerTestServiceImpl.java similarity index 51% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/AutoRestIntegerTestServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/implementation/AutoRestIntegerTestServiceImpl.java index 1b3427160c2ec..64a3e90d28fe4 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/AutoRestIntegerTestServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/implementation/AutoRestIntegerTestServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodyinteger; +package fixtures.bodyinteger.implementation; +import fixtures.bodyinteger.AutoRestIntegerTestService; +import fixtures.bodyinteger.Ints; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestIntegerTestService class. */ public final class AutoRestIntegerTestServiceImpl extends ServiceClient implements AutoRestIntegerTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Ints object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Ints ints; /** - * Gets the IntOperations object to access its operations. - * @return the IntOperations object. + * Gets the Ints object to access its operations. + * @return the Ints object. */ - public IntOperations getIntOperations() { - return new IntOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Ints ints() { + return this.ints; } /** @@ -54,8 +47,18 @@ public AutoRestIntegerTestServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestIntegerTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestIntegerTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestIntegerTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestIntegerTestServiceImpl(String baseUrl) { * Initializes an instance of AutoRestIntegerTestService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestIntegerTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestIntegerTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.ints = new IntsImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/implementation/IntsImpl.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/implementation/IntsImpl.java index 134ce02e57ae8..e1227c38f67c2 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/implementation/IntsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodyinteger; +package fixtures.bodyinteger.implementation; +import retrofit2.Retrofit; +import fixtures.bodyinteger.Ints; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -25,34 +27,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in IntOperations. + * in Ints. */ -public final class IntOperationsImpl implements IntOperations { +public final class IntsImpl implements Ints { /** The Retrofit service to perform REST calls. */ - private IntService service; + private IntsService service; /** The service client containing this operation class. */ - private AutoRestIntegerTestService client; + private AutoRestIntegerTestServiceImpl client; /** - * Initializes an instance of IntOperations. + * Initializes an instance of Ints. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public IntOperationsImpl(Retrofit retrofit, AutoRestIntegerTestService client) { - this.service = retrofit.create(IntService.class); + public IntsImpl(Retrofit retrofit, AutoRestIntegerTestServiceImpl client) { + this.service = retrofit.create(IntsService.class); this.client = client; } /** - * The interface defining all the services for IntOperations to be + * The interface defining all the services for Ints to be * used by Retrofit to perform actually REST calls. */ - interface IntService { + interface IntsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("int/null") Call getNull(); @@ -150,7 +151,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -195,7 +196,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -240,7 +241,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getOverflowInt32Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -285,7 +286,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUnderflowInt32Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -330,7 +331,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getOverflowInt64Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -375,7 +376,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUnderflowInt64Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -422,7 +423,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putMax32Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -469,7 +470,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putMax64Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -516,7 +517,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putMin32Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -563,7 +564,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putMin64Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -608,7 +609,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getUnixTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -655,7 +656,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putUnixTimeDateDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -700,7 +701,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidUnixTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -745,7 +746,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullUnixTimeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/implementation/package-info.java new file mode 100644 index 0000000000000..51d1d5394005a --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestIntegerTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.bodyinteger.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/Error.java index 3711adb1058bd..24695bff7ff87 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/ErrorException.java index 352f6f9e9633b..b868744a9f823 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodyinteger.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/package-info.java index b0c73b369a6f6..f47eb23f75878 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestIntegerTestService. + * This package contains the models classes for AutoRestIntegerTestService. * Test Infrastructure for AutoRest. */ package fixtures.bodyinteger.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/AutoRestNumberTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/AutoRestNumberTestService.java index f9902070b7af3..ded80e5f0de51 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/AutoRestNumberTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/AutoRestNumberTestService.java @@ -10,49 +10,20 @@ package fixtures.bodynumber; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestNumberTestService class. */ public interface AutoRestNumberTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "https://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Numbers object to access its operations. + * @return the Numbers object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the NumberOperations object to access its operations. - * @return the NumberOperations object. - */ - NumberOperations getNumberOperations(); + Numbers numbers(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/NumberOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/Numbers.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/NumberOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/Numbers.java index d12b81146b25f..b25ea99e831d3 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/NumberOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/Numbers.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in NumberOperations. + * in Numbers. */ -public interface NumberOperations { +public interface Numbers { /** * Get null Number value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/AutoRestNumberTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/implementation/AutoRestNumberTestServiceImpl.java similarity index 50% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/AutoRestNumberTestServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/implementation/AutoRestNumberTestServiceImpl.java index 387798d254e91..0138bb4840bed 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/AutoRestNumberTestServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/implementation/AutoRestNumberTestServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.bodynumber; +package fixtures.bodynumber.implementation; +import fixtures.bodynumber.AutoRestNumberTestService; +import fixtures.bodynumber.Numbers; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestNumberTestService class. */ public final class AutoRestNumberTestServiceImpl extends ServiceClient implements AutoRestNumberTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Numbers object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Numbers numbers; /** - * Gets the NumberOperations object to access its operations. - * @return the NumberOperations object. + * Gets the Numbers object to access its operations. + * @return the Numbers object. */ - public NumberOperations getNumberOperations() { - return new NumberOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Numbers numbers() { + return this.numbers; } /** @@ -54,8 +47,18 @@ public AutoRestNumberTestServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestNumberTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestNumberTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestNumberTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("https://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestNumberTestServiceImpl(String baseUrl) { * Initializes an instance of AutoRestNumberTestService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestNumberTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestNumberTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.numbers = new NumbersImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/NumberOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/implementation/NumbersImpl.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/NumberOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/implementation/NumbersImpl.java index 63b156894fe55..62a9dc79d287c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/NumberOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/implementation/NumbersImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodynumber; +package fixtures.bodynumber.implementation; +import retrofit2.Retrofit; +import fixtures.bodynumber.Numbers; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -26,34 +28,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in NumberOperations. + * in Numbers. */ -public final class NumberOperationsImpl implements NumberOperations { +public final class NumbersImpl implements Numbers { /** The Retrofit service to perform REST calls. */ - private NumberService service; + private NumbersService service; /** The service client containing this operation class. */ - private AutoRestNumberTestService client; + private AutoRestNumberTestServiceImpl client; /** - * Initializes an instance of NumberOperations. + * Initializes an instance of Numbers. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public NumberOperationsImpl(Retrofit retrofit, AutoRestNumberTestService client) { - this.service = retrofit.create(NumberService.class); + public NumbersImpl(Retrofit retrofit, AutoRestNumberTestServiceImpl client) { + this.service = retrofit.create(NumbersService.class); this.client = client; } /** - * The interface defining all the services for NumberOperations to be + * The interface defining all the services for Numbers to be * used by Retrofit to perform actually REST calls. */ - interface NumberService { + interface NumbersService { @Headers("Content-Type: application/json; charset=utf-8") @GET("number/null") Call getNull(); @@ -191,7 +192,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -236,7 +237,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidFloatDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -281,7 +282,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDoubleDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -326,7 +327,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getInvalidDecimalDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -373,7 +374,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBigFloatDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -418,7 +419,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBigFloatDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -465,7 +466,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBigDoubleDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -510,7 +511,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBigDoubleDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -557,7 +558,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBigDoublePositiveDecimalDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -602,7 +603,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBigDoublePositiveDecimalDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -649,7 +650,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBigDoubleNegativeDecimalDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -694,7 +695,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBigDoubleNegativeDecimalDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -749,7 +750,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBigDecimalDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -794,7 +795,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBigDecimalDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -849,7 +850,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBigDecimalPositiveDecimalDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -894,7 +895,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBigDecimalPositiveDecimalDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -949,7 +950,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBigDecimalNegativeDecimalDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -994,7 +995,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBigDecimalNegativeDecimalDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1041,7 +1042,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putSmallFloatDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1086,7 +1087,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getSmallFloatDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1133,7 +1134,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putSmallDoubleDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1178,7 +1179,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getSmallDoubleDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1233,7 +1234,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putSmallDecimalDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1278,7 +1279,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getSmallDecimalDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/implementation/package-info.java new file mode 100644 index 0000000000000..de3dfc4f90088 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestNumberTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.bodynumber.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/Error.java index 722247a1a21dd..896973c03c28f 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/ErrorException.java index a253af99f63da..81566f4db37f7 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodynumber.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/package-info.java index 68f8c88495768..ca2d802862f5a 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodynumber/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestNumberTestService. + * This package contains the models classes for AutoRestNumberTestService. * Test Infrastructure for AutoRest. */ package fixtures.bodynumber.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/AutoRestSwaggerBATService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/AutoRestSwaggerBATService.java index 8736c6a7b8ccc..5472384555ac9 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/AutoRestSwaggerBATService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/AutoRestSwaggerBATService.java @@ -10,55 +10,26 @@ package fixtures.bodystring; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestSwaggerBATService class. */ public interface AutoRestSwaggerBATService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Strings object to access its operations. + * @return the Strings object. */ - List getClientInterceptors(); + Strings strings(); /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. + * Gets the Enums object to access its operations. + * @return the Enums object. */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the StringOperations object to access its operations. - * @return the StringOperations object. - */ - StringOperations getStringOperations(); - - /** - * Gets the EnumOperations object to access its operations. - * @return the EnumOperations object. - */ - EnumOperations getEnumOperations(); + Enums enums(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/AutoRestSwaggerBATServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/AutoRestSwaggerBATServiceImpl.java deleted file mode 100644 index 9242866836dd9..0000000000000 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/AutoRestSwaggerBATServiceImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -package fixtures.bodystring; - -import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; - -/** - * Initializes a new instance of the AutoRestSwaggerBATService class. - */ -public final class AutoRestSwaggerBATServiceImpl extends ServiceClient implements AutoRestSwaggerBATService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - - /** - * Gets the StringOperations object to access its operations. - * @return the StringOperations object. - */ - public StringOperations getStringOperations() { - return new StringOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the EnumOperations object to access its operations. - * @return the EnumOperations object. - */ - public EnumOperations getEnumOperations() { - return new EnumOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Initializes an instance of AutoRestSwaggerBATService client. - */ - public AutoRestSwaggerBATServiceImpl() { - this("http://localhost"); - } - - /** - * Initializes an instance of AutoRestSwaggerBATService client. - * - * @param baseUrl the base URL of the host - */ - public AutoRestSwaggerBATServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - /** - * Initializes an instance of AutoRestSwaggerBATService client. - * - * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} - */ - public AutoRestSwaggerBATServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); - } -} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/EnumOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/Enums.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/EnumOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/Enums.java index 29fe9f9c71084..b8b7dbf97116d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/EnumOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/Enums.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in EnumOperations. + * in Enums. */ -public interface EnumOperations { +public interface Enums { /** * Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/StringOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/Strings.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/StringOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/Strings.java index 0107642a2747d..a3d90ec9deb99 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/StringOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/Strings.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in StringOperations. + * in Strings. */ -public interface StringOperations { +public interface Strings { /** * Get null string value value. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/AutoRestSwaggerBATServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/AutoRestSwaggerBATServiceImpl.java new file mode 100644 index 0000000000000..e53baa3401003 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/AutoRestSwaggerBATServiceImpl.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.bodystring.implementation; + +import fixtures.bodystring.AutoRestSwaggerBATService; +import fixtures.bodystring.Strings; +import fixtures.bodystring.Enums; +import com.microsoft.rest.ServiceClient; +import okhttp3.OkHttpClient; +import retrofit2.Retrofit; + +/** + * Initializes a new instance of the AutoRestSwaggerBATService class. + */ +public final class AutoRestSwaggerBATServiceImpl extends ServiceClient implements AutoRestSwaggerBATService { + + /** + * The Strings object to access its operations. + */ + private Strings strings; + + /** + * Gets the Strings object to access its operations. + * @return the Strings object. + */ + public Strings strings() { + return this.strings; + } + + /** + * The Enums object to access its operations. + */ + private Enums enums; + + /** + * Gets the Enums object to access its operations. + * @return the Enums object. + */ + public Enums enums() { + return this.enums; + } + + /** + * Initializes an instance of AutoRestSwaggerBATService client. + */ + public AutoRestSwaggerBATServiceImpl() { + this("http://localhost"); + } + + /** + * Initializes an instance of AutoRestSwaggerBATService client. + * + * @param baseUrl the base URL of the host + */ + public AutoRestSwaggerBATServiceImpl(String baseUrl) { + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestSwaggerBATService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestSwaggerBATServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); + initialize(); + } + + /** + * Initializes an instance of AutoRestSwaggerBATService client. + * + * @param baseUrl the base URL of the host + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestSwaggerBATServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); + initialize(); + } + + private void initialize() { + this.strings = new StringsImpl(retrofit(), this); + this.enums = new EnumsImpl(retrofit(), this); + } +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/EnumOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/EnumsImpl.java similarity index 92% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/EnumOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/EnumsImpl.java index b8fcce6f98bde..5208f8b22344d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/EnumOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/EnumsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodystring; +package fixtures.bodystring.implementation; +import retrofit2.Retrofit; +import fixtures.bodystring.Enums; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -26,34 +28,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in EnumOperations. + * in Enums. */ -public final class EnumOperationsImpl implements EnumOperations { +public final class EnumsImpl implements Enums { /** The Retrofit service to perform REST calls. */ - private EnumService service; + private EnumsService service; /** The service client containing this operation class. */ - private AutoRestSwaggerBATService client; + private AutoRestSwaggerBATServiceImpl client; /** - * Initializes an instance of EnumOperations. + * Initializes an instance of Enums. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public EnumOperationsImpl(Retrofit retrofit, AutoRestSwaggerBATService client) { - this.service = retrofit.create(EnumService.class); + public EnumsImpl(Retrofit retrofit, AutoRestSwaggerBATServiceImpl client) { + this.service = retrofit.create(EnumsService.class); this.client = client; } /** - * The interface defining all the services for EnumOperations to be + * The interface defining all the services for Enums to be * used by Retrofit to perform actually REST calls. */ - interface EnumService { + interface EnumsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("string/enum/notExpandable") Call getNotExpandable(); @@ -103,7 +104,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNotExpandableDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -158,7 +159,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putNotExpandableDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/StringOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/StringsImpl.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/StringOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/StringsImpl.java index c4cb06e5903fe..7154cd32cce7b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/StringOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/StringsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.bodystring; +package fixtures.bodystring.implementation; +import retrofit2.Retrofit; +import fixtures.bodystring.Strings; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -25,34 +27,33 @@ import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in StringOperations. + * in Strings. */ -public final class StringOperationsImpl implements StringOperations { +public final class StringsImpl implements Strings { /** The Retrofit service to perform REST calls. */ - private StringService service; + private StringsService service; /** The service client containing this operation class. */ - private AutoRestSwaggerBATService client; + private AutoRestSwaggerBATServiceImpl client; /** - * Initializes an instance of StringOperations. + * Initializes an instance of Strings. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public StringOperationsImpl(Retrofit retrofit, AutoRestSwaggerBATService client) { - this.service = retrofit.create(StringService.class); + public StringsImpl(Retrofit retrofit, AutoRestSwaggerBATServiceImpl client) { + this.service = retrofit.create(StringsService.class); this.client = client; } /** - * The interface defining all the services for StringOperations to be + * The interface defining all the services for Strings to be * used by Retrofit to perform actually REST calls. */ - interface StringService { + interface StringsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("string/null") Call getNull(); @@ -146,7 +147,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -233,7 +234,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -278,7 +279,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -333,7 +334,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -378,7 +379,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getMbcsDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -433,7 +434,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putMbcsDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -478,7 +479,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getWhitespaceDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -533,7 +534,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putWhitespaceDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -578,7 +579,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNotProvidedDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -623,7 +624,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBase64EncodedDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -668,7 +669,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBase64UrlEncodedDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -723,7 +724,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putBase64UrlEncodedDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -768,7 +769,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNullBase64UrlEncodedDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/package-info.java new file mode 100644 index 0000000000000..5d25ec788e6f8 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestSwaggerBATService. + * Test Infrastructure for AutoRest Swagger BAT. + */ +package fixtures.bodystring.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/Colors.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/Colors.java index d87da877c4845..c7530f543291e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/Colors.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/Colors.java @@ -33,16 +33,6 @@ public enum Colors { this.value = value; } - /** - * Gets the serialized value for a Colors instance. - * - * @return the serialized value. - */ - @JsonValue - public String toValue() { - return this.value; - } - /** * Parses a serialized value to a Colors instance. * @@ -50,18 +40,19 @@ public String toValue() { * @return the parsed Colors object, or null if unable to parse. */ @JsonCreator - public static Colors fromValue(String value) { + public static Colors fromString(String value) { Colors[] items = Colors.values(); for (Colors item : items) { - if (item.toValue().equals(value)) { + if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; } + @JsonValue @Override public String toString() { - return toValue(); + return this.value; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/Error.java index 23a6461b17445..5900fea176cb8 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/ErrorException.java index 4071e585136af..e23eb86692c6e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.bodystring.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/package-info.java index e0ac98bc93e66..7f572801a56f4 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodystring/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestSwaggerBATService. + * This package contains the models classes for AutoRestSwaggerBATService. * Test Infrastructure for AutoRest Swagger BAT. */ package fixtures.bodystring.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClient.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClient.java index c097186557427..ee07f1776983b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClient.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClient.java @@ -10,63 +10,35 @@ package fixtures.custombaseuri; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestParameterizedHostTestClient class. */ public interface AutoRestParameterizedHostTestClient { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * The default base URL. */ - JacksonMapperAdapter getMapperAdapter(); + String DEFAULT_BASE_URL = "http://{accountName}{host}"; /** * Gets A string value that is used as a global part of the parameterized host. * * @return the host value. */ - String getHost(); + String host(); /** * Sets A string value that is used as a global part of the parameterized host. * * @param host the host value. + * @return the service client itself */ - void setHost(String host); + AutoRestParameterizedHostTestClient withHost(String host); /** - * Gets the PathsOperations object to access its operations. - * @return the PathsOperations object. + * Gets the Paths object to access its operations. + * @return the Paths object. */ - PathsOperations getPathsOperations(); + Paths paths(); } diff --git a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/Paths.java similarity index 96% rename from AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/Paths.java index 89c0b4d4d11c9..1566930565597 100644 --- a/AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/Paths.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in PathsOperations. + * in Paths. */ -public interface PathsOperations { +public interface Paths { /** * Get a 200 to test a valid base uri. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClientImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/implementation/AutoRestParameterizedHostTestClientImpl.java similarity index 53% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClientImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/implementation/AutoRestParameterizedHostTestClientImpl.java index dcb01c24ee8ee..f51e4c4f87ca1 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/AutoRestParameterizedHostTestClientImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/implementation/AutoRestParameterizedHostTestClientImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.custombaseuri; +package fixtures.custombaseuri.implementation; +import fixtures.custombaseuri.AutoRestParameterizedHostTestClient; +import fixtures.custombaseuri.Paths; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,19 +20,6 @@ * Initializes a new instance of the AutoRestParameterizedHostTestClient class. */ public final class AutoRestParameterizedHostTestClientImpl extends ServiceClient implements AutoRestParameterizedHostTestClient { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } /** A string value that is used as a global part of the parameterized host. */ private String host; @@ -41,7 +29,7 @@ public AutoRestBaseUrl getBaseUrl() { * * @return the host value. */ - public String getHost() { + public String host() { return this.host; } @@ -49,17 +37,24 @@ public String getHost() { * Sets A string value that is used as a global part of the parameterized host. * * @param host the host value. + * @return the service client itself */ - public void setHost(String host) { + public AutoRestParameterizedHostTestClientImpl withHost(String host) { this.host = host; + return this; } /** - * Gets the PathsOperations object to access its operations. - * @return the PathsOperations object. + * The Paths object to access its operations. + */ + private Paths paths; + + /** + * Gets the Paths object to access its operations. + * @return the Paths object. */ - public PathsOperations getPathsOperations() { - return new PathsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Paths paths() { + return this.paths; } /** @@ -75,26 +70,35 @@ public AutoRestParameterizedHostTestClientImpl() { * @param baseUrl the base URL of the host */ private AutoRestParameterizedHostTestClientImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); initialize(); } /** * Initializes an instance of AutoRestParameterizedHostTestClient client. * - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestParameterizedHostTestClientImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://{accountName}{host}", clientBuilder, restBuilder); + initialize(); + } + + /** + * Initializes an instance of AutoRestParameterizedHostTestClient client. + * + * @param baseUrl the base URL of the host + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestParameterizedHostTestClientImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl("http://{accountName}{host}"); + private AutoRestParameterizedHostTestClientImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.host = "host"; + this.paths = new PathsImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsImpl.java similarity index 78% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsImpl.java index f9e7d005a3bbd..d98eda484dd7d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/PathsOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/implementation/PathsImpl.java @@ -8,8 +8,11 @@ * regenerated. */ -package fixtures.custombaseuri; +package fixtures.custombaseuri.implementation; +import retrofit2.Retrofit; +import fixtures.custombaseuri.Paths; +import com.google.common.base.Joiner; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -21,39 +24,39 @@ import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; +import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in PathsOperations. + * in Paths. */ -public final class PathsOperationsImpl implements PathsOperations { +public final class PathsImpl implements Paths { /** The Retrofit service to perform REST calls. */ private PathsService service; /** The service client containing this operation class. */ - private AutoRestParameterizedHostTestClient client; + private AutoRestParameterizedHostTestClientImpl client; /** - * Initializes an instance of PathsOperations. + * Initializes an instance of Paths. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PathsOperationsImpl(Retrofit retrofit, AutoRestParameterizedHostTestClient client) { + public PathsImpl(Retrofit retrofit, AutoRestParameterizedHostTestClientImpl client) { this.service = retrofit.create(PathsService.class); this.client = client; } /** - * The interface defining all the services for PathsOperations to be + * The interface defining all the services for Paths to be * used by Retrofit to perform actually REST calls. */ interface PathsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("customuri") - Call getEmpty(); + Call getEmpty(@Header("x-ms-parameterized-host") String parameterizedHost); } @@ -70,12 +73,11 @@ public ServiceResponse getEmpty(String accountName) throws ErrorException, if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } - if (this.client.getHost() == null) { - throw new IllegalArgumentException("Parameter this.client.getHost() is required and cannot be null."); + if (this.client.host() == null) { + throw new IllegalArgumentException("Parameter this.client.host() is required and cannot be null."); } - this.client.getBaseUrl().set("{accountName}", accountName); - this.client.getBaseUrl().set("{host}", this.client.getHost()); - Call call = service.getEmpty(); + String parameterizedHost = Joiner.on(", ").join("{accountName}", accountName, "{host}", this.client.host()); + Call call = service.getEmpty(parameterizedHost); return getEmptyDelegate(call.execute()); } @@ -95,13 +97,12 @@ public ServiceCall getEmptyAsync(String accountName, final ServiceCallback serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); return null; } - if (this.client.getHost() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getHost() is required and cannot be null.")); + if (this.client.host() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.host() is required and cannot be null.")); return null; } - this.client.getBaseUrl().set("{accountName}", accountName); - this.client.getBaseUrl().set("{host}", this.client.getHost()); - Call call = service.getEmpty(); + String parameterizedHost = Joiner.on(", ").join("{accountName}", accountName, "{host}", this.client.host()); + Call call = service.getEmpty(parameterizedHost); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -117,7 +118,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/implementation/package-info.java new file mode 100644 index 0000000000000..9449c1aeeb63c --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestParameterizedHostTestClient. + * Test Infrastructure for AutoRest. + */ +package fixtures.custombaseuri.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/Error.java index afdbef2ab489b..2242e90360cbe 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/ErrorException.java index c2f868b6dcaa5..eb2624f4f3bbb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.custombaseuri.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/package-info.java index 9f9b5368cdf7e..22f43a621543e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseuri/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestParameterizedHostTestClient. + * This package contains the models classes for AutoRestParameterizedHostTestClient. * Test Infrastructure for AutoRest. */ package fixtures.custombaseuri.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/AutoRestParameterizedCustomHostTestClient.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/AutoRestParameterizedCustomHostTestClient.java index 7c5bb29be05d4..52d0ee491aead 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/AutoRestParameterizedCustomHostTestClient.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/AutoRestParameterizedCustomHostTestClient.java @@ -10,77 +10,50 @@ package fixtures.custombaseurimoreoptions; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestParameterizedCustomHostTestClient class. */ public interface AutoRestParameterizedCustomHostTestClient { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * The default base URL. */ - JacksonMapperAdapter getMapperAdapter(); + String DEFAULT_BASE_URL = "{vault}{secret}{dnsSuffix}"; /** * Gets The subscription id with value 'test12'.. * * @return the subscriptionId value. */ - String getSubscriptionId(); + String subscriptionId(); /** * Sets The subscription id with value 'test12'.. * * @param subscriptionId the subscriptionId value. + * @return the service client itself */ - void setSubscriptionId(String subscriptionId); + AutoRestParameterizedCustomHostTestClient withSubscriptionId(String subscriptionId); /** * Gets A string value that is used as a global part of the parameterized host. Default value 'host'.. * * @return the dnsSuffix value. */ - String getDnsSuffix(); + String dnsSuffix(); /** * Sets A string value that is used as a global part of the parameterized host. Default value 'host'.. * * @param dnsSuffix the dnsSuffix value. + * @return the service client itself */ - void setDnsSuffix(String dnsSuffix); + AutoRestParameterizedCustomHostTestClient withDnsSuffix(String dnsSuffix); /** - * Gets the PathsOperations object to access its operations. - * @return the PathsOperations object. + * Gets the Paths object to access its operations. + * @return the Paths object. */ - PathsOperations getPathsOperations(); + Paths paths(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/PathsOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/Paths.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/PathsOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/Paths.java index 6273f3426d73c..914e8cf635db7 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/PathsOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/Paths.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in PathsOperations. + * in Paths. */ -public interface PathsOperations { +public interface Paths { /** * Get a 200 to test a valid base uri. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/AutoRestParameterizedCustomHostTestClientImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/implementation/AutoRestParameterizedCustomHostTestClientImpl.java similarity index 56% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/AutoRestParameterizedCustomHostTestClientImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/implementation/AutoRestParameterizedCustomHostTestClientImpl.java index ad9fe946dc423..5bd5a91ea3fc6 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/AutoRestParameterizedCustomHostTestClientImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/implementation/AutoRestParameterizedCustomHostTestClientImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.custombaseurimoreoptions; +package fixtures.custombaseurimoreoptions.implementation; +import fixtures.custombaseurimoreoptions.AutoRestParameterizedCustomHostTestClient; +import fixtures.custombaseurimoreoptions.Paths; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,19 +20,6 @@ * Initializes a new instance of the AutoRestParameterizedCustomHostTestClient class. */ public final class AutoRestParameterizedCustomHostTestClientImpl extends ServiceClient implements AutoRestParameterizedCustomHostTestClient { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } /** The subscription id with value 'test12'. */ private String subscriptionId; @@ -41,7 +29,7 @@ public AutoRestBaseUrl getBaseUrl() { * * @return the subscriptionId value. */ - public String getSubscriptionId() { + public String subscriptionId() { return this.subscriptionId; } @@ -49,9 +37,11 @@ public String getSubscriptionId() { * Sets The subscription id with value 'test12'. * * @param subscriptionId the subscriptionId value. + * @return the service client itself */ - public void setSubscriptionId(String subscriptionId) { + public AutoRestParameterizedCustomHostTestClientImpl withSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; + return this; } /** A string value that is used as a global part of the parameterized host. Default value 'host'. */ @@ -62,7 +52,7 @@ public void setSubscriptionId(String subscriptionId) { * * @return the dnsSuffix value. */ - public String getDnsSuffix() { + public String dnsSuffix() { return this.dnsSuffix; } @@ -70,17 +60,24 @@ public String getDnsSuffix() { * Sets A string value that is used as a global part of the parameterized host. Default value 'host'. * * @param dnsSuffix the dnsSuffix value. + * @return the service client itself */ - public void setDnsSuffix(String dnsSuffix) { + public AutoRestParameterizedCustomHostTestClientImpl withDnsSuffix(String dnsSuffix) { this.dnsSuffix = dnsSuffix; + return this; } /** - * Gets the PathsOperations object to access its operations. - * @return the PathsOperations object. + * The Paths object to access its operations. + */ + private Paths paths; + + /** + * Gets the Paths object to access its operations. + * @return the Paths object. */ - public PathsOperations getPathsOperations() { - return new PathsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Paths paths() { + return this.paths; } /** @@ -96,26 +93,35 @@ public AutoRestParameterizedCustomHostTestClientImpl() { * @param baseUrl the base URL of the host */ private AutoRestParameterizedCustomHostTestClientImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); initialize(); } /** * Initializes an instance of AutoRestParameterizedCustomHostTestClient client. * - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestParameterizedCustomHostTestClientImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("{vault}{secret}{dnsSuffix}", clientBuilder, restBuilder); + initialize(); + } + + /** + * Initializes an instance of AutoRestParameterizedCustomHostTestClient client. + * + * @param baseUrl the base URL of the host + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestParameterizedCustomHostTestClientImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl("{vault}{secret}{dnsSuffix}"); + private AutoRestParameterizedCustomHostTestClientImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.dnsSuffix = "host"; + this.paths = new PathsImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/PathsOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/implementation/PathsImpl.java similarity index 79% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/PathsOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/implementation/PathsImpl.java index 13994720257bd..b3c16a5b7e013 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/PathsOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/implementation/PathsImpl.java @@ -8,8 +8,11 @@ * regenerated. */ -package fixtures.custombaseurimoreoptions; +package fixtures.custombaseurimoreoptions.implementation; +import retrofit2.Retrofit; +import fixtures.custombaseurimoreoptions.Paths; +import com.google.common.base.Joiner; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -21,41 +24,41 @@ import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; +import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.Path; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in PathsOperations. + * in Paths. */ -public final class PathsOperationsImpl implements PathsOperations { +public final class PathsImpl implements Paths { /** The Retrofit service to perform REST calls. */ private PathsService service; /** The service client containing this operation class. */ - private AutoRestParameterizedCustomHostTestClient client; + private AutoRestParameterizedCustomHostTestClientImpl client; /** - * Initializes an instance of PathsOperations. + * Initializes an instance of Paths. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PathsOperationsImpl(Retrofit retrofit, AutoRestParameterizedCustomHostTestClient client) { + public PathsImpl(Retrofit retrofit, AutoRestParameterizedCustomHostTestClientImpl client) { this.service = retrofit.create(PathsService.class); this.client = client; } /** - * The interface defining all the services for PathsOperations to be + * The interface defining all the services for Paths to be * used by Retrofit to perform actually REST calls. */ interface PathsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("customuri/{subscriptionId}/{keyName}") - Call getEmpty(@Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Query("keyVersion") String keyVersion); + Call getEmpty(@Path("keyName") String keyName, @Path("subscriptionId") String subscriptionId, @Query("keyVersion") String keyVersion, @Header("x-ms-parameterized-host") String parameterizedHost); } @@ -77,20 +80,18 @@ public ServiceResponse getEmpty(String vault, String secret, String keyNam if (secret == null) { throw new IllegalArgumentException("Parameter secret is required and cannot be null."); } - if (this.client.getDnsSuffix() == null) { - throw new IllegalArgumentException("Parameter this.client.getDnsSuffix() is required and cannot be null."); + if (this.client.dnsSuffix() == null) { + throw new IllegalArgumentException("Parameter this.client.dnsSuffix() is required and cannot be null."); } if (keyName == null) { throw new IllegalArgumentException("Parameter keyName is required and cannot be null."); } - if (this.client.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String keyVersion = null; - this.client.getBaseUrl().set("{vault}", vault); - this.client.getBaseUrl().set("{secret}", secret); - this.client.getBaseUrl().set("{dnsSuffix}", this.client.getDnsSuffix()); - Call call = service.getEmpty(keyName, this.client.getSubscriptionId(), keyVersion); + String parameterizedHost = Joiner.on(", ").join("{vault}", vault, "{secret}", secret, "{dnsSuffix}", this.client.dnsSuffix()); + Call call = service.getEmpty(keyName, this.client.subscriptionId(), keyVersion, parameterizedHost); return getEmptyDelegate(call.execute()); } @@ -116,23 +117,21 @@ public ServiceCall getEmptyAsync(String vault, String secret, String keyName, fi serviceCallback.failure(new IllegalArgumentException("Parameter secret is required and cannot be null.")); return null; } - if (this.client.getDnsSuffix() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getDnsSuffix() is required and cannot be null.")); + if (this.client.dnsSuffix() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.dnsSuffix() is required and cannot be null.")); return null; } if (keyName == null) { serviceCallback.failure(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); return null; } - if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); return null; } final String keyVersion = null; - this.client.getBaseUrl().set("{vault}", vault); - this.client.getBaseUrl().set("{secret}", secret); - this.client.getBaseUrl().set("{dnsSuffix}", this.client.getDnsSuffix()); - Call call = service.getEmpty(keyName, this.client.getSubscriptionId(), keyVersion); + String parameterizedHost = Joiner.on(", ").join("{vault}", vault, "{secret}", secret, "{dnsSuffix}", this.client.dnsSuffix()); + Call call = service.getEmpty(keyName, this.client.subscriptionId(), keyVersion, parameterizedHost); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -166,19 +165,17 @@ public ServiceResponse getEmpty(String vault, String secret, String keyNam if (secret == null) { throw new IllegalArgumentException("Parameter secret is required and cannot be null."); } - if (this.client.getDnsSuffix() == null) { - throw new IllegalArgumentException("Parameter this.client.getDnsSuffix() is required and cannot be null."); + if (this.client.dnsSuffix() == null) { + throw new IllegalArgumentException("Parameter this.client.dnsSuffix() is required and cannot be null."); } if (keyName == null) { throw new IllegalArgumentException("Parameter keyName is required and cannot be null."); } - if (this.client.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - this.client.getBaseUrl().set("{vault}", vault); - this.client.getBaseUrl().set("{secret}", secret); - this.client.getBaseUrl().set("{dnsSuffix}", this.client.getDnsSuffix()); - Call call = service.getEmpty(keyName, this.client.getSubscriptionId(), keyVersion); + String parameterizedHost = Joiner.on(", ").join("{vault}", vault, "{secret}", secret, "{dnsSuffix}", this.client.dnsSuffix()); + Call call = service.getEmpty(keyName, this.client.subscriptionId(), keyVersion, parameterizedHost); return getEmptyDelegate(call.execute()); } @@ -205,22 +202,20 @@ public ServiceCall getEmptyAsync(String vault, String secret, String keyName, St serviceCallback.failure(new IllegalArgumentException("Parameter secret is required and cannot be null.")); return null; } - if (this.client.getDnsSuffix() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getDnsSuffix() is required and cannot be null.")); + if (this.client.dnsSuffix() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.dnsSuffix() is required and cannot be null.")); return null; } if (keyName == null) { serviceCallback.failure(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); return null; } - if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + if (this.client.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.")); return null; } - this.client.getBaseUrl().set("{vault}", vault); - this.client.getBaseUrl().set("{secret}", secret); - this.client.getBaseUrl().set("{dnsSuffix}", this.client.getDnsSuffix()); - Call call = service.getEmpty(keyName, this.client.getSubscriptionId(), keyVersion); + String parameterizedHost = Joiner.on(", ").join("{vault}", vault, "{secret}", secret, "{dnsSuffix}", this.client.dnsSuffix()); + Call call = service.getEmpty(keyName, this.client.subscriptionId(), keyVersion, parameterizedHost); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -236,7 +231,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/implementation/package-info.java new file mode 100644 index 0000000000000..01d064921d8dc --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestParameterizedCustomHostTestClient. + * Test Infrastructure for AutoRest. + */ +package fixtures.custombaseurimoreoptions.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/Error.java index 73232cf4ed434..2dc7365ca7f95 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/ErrorException.java index 0c4458e200dac..1996069405760 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.custombaseurimoreoptions.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/package-info.java index b5c9a91ec97d8..2d0c4f8f354ab 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/custombaseurimoreoptions/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestParameterizedCustomHostTestClient. + * This package contains the models classes for AutoRestParameterizedCustomHostTestClient. * Test Infrastructure for AutoRest. */ package fixtures.custombaseurimoreoptions.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/AutoRestSwaggerBATHeaderService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/AutoRestSwaggerBATHeaderService.java index 62bc93aa707ab..86ddf6a776a1c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/AutoRestSwaggerBATHeaderService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/AutoRestSwaggerBATHeaderService.java @@ -10,49 +10,20 @@ package fixtures.header; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestSwaggerBATHeaderService class. */ public interface AutoRestSwaggerBATHeaderService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the Headers object to access its operations. + * @return the Headers object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the HeaderOperations object to access its operations. - * @return the HeaderOperations object. - */ - HeaderOperations getHeaderOperations(); + Headers headers(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/HeaderOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/Headers.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/HeaderOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/Headers.java index a7281ac020fc8..0cd04baf9684f 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/HeaderOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/Headers.java @@ -37,9 +37,9 @@ /** * An instance of this class provides access to all the operations defined - * in HeaderOperations. + * in Headers. */ -public interface HeaderOperations { +public interface Headers { /** * Send a post request with header value "User-Agent": "overwrite". * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/AutoRestSwaggerBATHeaderServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/implementation/AutoRestSwaggerBATHeaderServiceImpl.java similarity index 51% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/AutoRestSwaggerBATHeaderServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/implementation/AutoRestSwaggerBATHeaderServiceImpl.java index 6dc2c0a1db197..27bfc1b04846b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/AutoRestSwaggerBATHeaderServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/implementation/AutoRestSwaggerBATHeaderServiceImpl.java @@ -8,10 +8,11 @@ * regenerated. */ -package fixtures.header; +package fixtures.header.implementation; +import fixtures.header.AutoRestSwaggerBATHeaderService; +import fixtures.header.Headers; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,26 +20,18 @@ * Initializes a new instance of the AutoRestSwaggerBATHeaderService class. */ public final class AutoRestSwaggerBATHeaderServiceImpl extends ServiceClient implements AutoRestSwaggerBATHeaderService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. + * The Headers object to access its operations. */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } + private Headers headers; /** - * Gets the HeaderOperations object to access its operations. - * @return the HeaderOperations object. + * Gets the Headers object to access its operations. + * @return the Headers object. */ - public HeaderOperations getHeaderOperations() { - return new HeaderOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Headers headers() { + return this.headers; } /** @@ -54,8 +47,18 @@ public AutoRestSwaggerBATHeaderServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestSwaggerBATHeaderServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestSwaggerBATHeaderService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestSwaggerBATHeaderServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -63,18 +66,15 @@ public AutoRestSwaggerBATHeaderServiceImpl(String baseUrl) { * Initializes an instance of AutoRestSwaggerBATHeaderService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestSwaggerBATHeaderServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestSwaggerBATHeaderServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.headers = new HeadersImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/HeaderOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/implementation/HeadersImpl.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/HeaderOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/implementation/HeadersImpl.java index fb0c9f8b0db51..5142726ae95ec 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/HeaderOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/implementation/HeadersImpl.java @@ -8,8 +8,9 @@ * regenerated. */ -package fixtures.header; +package fixtures.header.implementation; +import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.rest.DateTimeRfc1123; import com.microsoft.rest.ServiceCall; @@ -45,34 +46,33 @@ import retrofit2.http.Headers; import retrofit2.http.POST; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HeaderOperations. + * in Headers. */ -public final class HeaderOperationsImpl implements HeaderOperations { +public final class HeadersImpl implements fixtures.header.Headers { /** The Retrofit service to perform REST calls. */ - private HeaderService service; + private HeadersService service; /** The service client containing this operation class. */ - private AutoRestSwaggerBATHeaderService client; + private AutoRestSwaggerBATHeaderServiceImpl client; /** - * Initializes an instance of HeaderOperations. + * Initializes an instance of Headers. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HeaderOperationsImpl(Retrofit retrofit, AutoRestSwaggerBATHeaderService client) { - this.service = retrofit.create(HeaderService.class); + public HeadersImpl(Retrofit retrofit, AutoRestSwaggerBATHeaderServiceImpl client) { + this.service = retrofit.create(HeadersService.class); this.client = client; } /** - * The interface defining all the services for HeaderOperations to be + * The interface defining all the services for Headers to be * used by Retrofit to perform actually REST calls. */ - interface HeaderService { + interface HeadersService { @Headers("Content-Type: application/json; charset=utf-8") @POST("header/param/existingkey") Call paramExistingKey(@Header("User-Agent") String userAgent); @@ -240,7 +240,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramExistingKeyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -285,7 +285,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseExistingKeyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseExistingKeyHeaders.class); @@ -340,7 +340,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramProtectedKeyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -385,7 +385,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseProtectedKeyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseProtectedKeyHeaders.class); @@ -442,7 +442,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramIntegerDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -497,7 +497,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseIntegerDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseIntegerHeaders.class); @@ -554,7 +554,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramLongDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -609,7 +609,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseLongDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseLongHeaders.class); @@ -666,7 +666,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramFloatDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -721,7 +721,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseFloatDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseFloatHeaders.class); @@ -778,7 +778,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramDoubleDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -833,7 +833,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseDoubleDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseDoubleHeaders.class); @@ -890,7 +890,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramBoolDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -945,7 +945,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseBoolDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseBoolHeaders.class); @@ -1052,7 +1052,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramStringDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1107,7 +1107,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseStringDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseStringHeaders.class); @@ -1171,7 +1171,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramDateDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1226,7 +1226,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseDateDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseDateHeaders.class); @@ -1290,7 +1290,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramDatetimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1345,7 +1345,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseDatetimeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseDatetimeHeaders.class); @@ -1364,7 +1364,11 @@ public ServiceResponse paramDatetimeRfc1123(String scenario) throws ErrorE if (scenario == null) { throw new IllegalArgumentException("Parameter scenario is required and cannot be null."); } - final DateTimeRfc1123 valueConverted = null; + final DateTime value = null; + DateTimeRfc1123 valueConverted = null; + if (value != null) { + valueConverted = new DateTimeRfc1123(value); + } Call call = service.paramDatetimeRfc1123(scenario, valueConverted); return paramDatetimeRfc1123Delegate(call.execute()); } @@ -1385,7 +1389,11 @@ public ServiceCall paramDatetimeRfc1123Async(String scenario, final ServiceCallb serviceCallback.failure(new IllegalArgumentException("Parameter scenario is required and cannot be null.")); return null; } - final DateTimeRfc1123 valueConverted = null; + final DateTime value = null; + DateTimeRfc1123 valueConverted = null; + if (value != null) { + valueConverted = new DateTimeRfc1123(value); + } Call call = service.paramDatetimeRfc1123(scenario, valueConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -1460,7 +1468,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramDatetimeRfc1123Delegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1515,7 +1523,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseDatetimeRfc1123Delegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseDatetimeRfc1123Headers.class); @@ -1579,7 +1587,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramDurationDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1634,7 +1642,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseDurationDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseDurationHeaders.class); @@ -1700,7 +1708,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramByteDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1755,7 +1763,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseByteDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseByteHeaders.class); @@ -1862,7 +1870,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse paramEnumDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1917,7 +1925,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders responseEnumDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HeaderResponseEnumHeaders.class); @@ -1962,7 +1970,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse customRequestIdDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/implementation/package-info.java new file mode 100644 index 0000000000000..15a0688d044eb --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestSwaggerBATHeaderService. + * Test Infrastructure for AutoRest. + */ +package fixtures.header.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/Error.java index a2d08b21c0392..1473767a7367e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/ErrorException.java index 9b8159a6a0d10..5823137794368 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.header.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/GreyscaleColors.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/GreyscaleColors.java index c69abd1e6071f..538127558fdd9 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/GreyscaleColors.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/GreyscaleColors.java @@ -33,16 +33,6 @@ public enum GreyscaleColors { this.value = value; } - /** - * Gets the serialized value for a GreyscaleColors instance. - * - * @return the serialized value. - */ - @JsonValue - public String toValue() { - return this.value; - } - /** * Parses a serialized value to a GreyscaleColors instance. * @@ -50,18 +40,19 @@ public String toValue() { * @return the parsed GreyscaleColors object, or null if unable to parse. */ @JsonCreator - public static GreyscaleColors fromValue(String value) { + public static GreyscaleColors fromString(String value) { GreyscaleColors[] items = GreyscaleColors.values(); for (GreyscaleColors item : items) { - if (item.toValue().equals(value)) { + if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; } + @JsonValue @Override public String toString() { - return toValue(); + return this.value; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseBoolHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseBoolHeaders.java index 17a61364b5cc7..c9926e16ca7dd 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseBoolHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseBoolHeaders.java @@ -25,7 +25,7 @@ public class HeaderResponseBoolHeaders { * * @return the value value */ - public Boolean getValue() { + public Boolean value() { return this.value; } @@ -33,9 +33,11 @@ public Boolean getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseBoolHeaders object itself. */ - public void setValue(Boolean value) { + public HeaderResponseBoolHeaders withValue(Boolean value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseByteHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseByteHeaders.java index 3e9bb0f11ba70..ee31858d4cc39 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseByteHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseByteHeaders.java @@ -25,7 +25,7 @@ public class HeaderResponseByteHeaders { * * @return the value value */ - public byte[] getValue() { + public byte[] value() { return this.value; } @@ -33,9 +33,11 @@ public byte[] getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseByteHeaders object itself. */ - public void setValue(byte[] value) { + public HeaderResponseByteHeaders withValue(byte[] value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDateHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDateHeaders.java index e27ccdf36bece..ea8cde01f21a6 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDateHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDateHeaders.java @@ -26,7 +26,7 @@ public class HeaderResponseDateHeaders { * * @return the value value */ - public LocalDate getValue() { + public LocalDate value() { return this.value; } @@ -34,9 +34,11 @@ public LocalDate getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseDateHeaders object itself. */ - public void setValue(LocalDate value) { + public HeaderResponseDateHeaders withValue(LocalDate value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDatetimeHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDatetimeHeaders.java index fb89ec8dd4d06..0576025e3d9fa 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDatetimeHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDatetimeHeaders.java @@ -27,7 +27,7 @@ public class HeaderResponseDatetimeHeaders { * * @return the value value */ - public DateTime getValue() { + public DateTime value() { return this.value; } @@ -35,9 +35,11 @@ public DateTime getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseDatetimeHeaders object itself. */ - public void setValue(DateTime value) { + public HeaderResponseDatetimeHeaders withValue(DateTime value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDatetimeRfc1123Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDatetimeRfc1123Headers.java index 9728eb3f4d64a..f745316c3d418 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDatetimeRfc1123Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDatetimeRfc1123Headers.java @@ -28,7 +28,7 @@ public class HeaderResponseDatetimeRfc1123Headers { * * @return the value value */ - public DateTime getValue() { + public DateTime value() { if (this.value == null) { return null; } @@ -39,9 +39,11 @@ public DateTime getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseDatetimeRfc1123Headers object itself. */ - public void setValue(DateTime value) { + public HeaderResponseDatetimeRfc1123Headers withValue(DateTime value) { this.value = new DateTimeRfc1123(value); + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDoubleHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDoubleHeaders.java index a7607400876c4..7faf15290ab1e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDoubleHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDoubleHeaders.java @@ -25,7 +25,7 @@ public class HeaderResponseDoubleHeaders { * * @return the value value */ - public Double getValue() { + public Double value() { return this.value; } @@ -33,9 +33,11 @@ public Double getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseDoubleHeaders object itself. */ - public void setValue(Double value) { + public HeaderResponseDoubleHeaders withValue(Double value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDurationHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDurationHeaders.java index 128c95e473b8b..9fa553ed57cf2 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDurationHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseDurationHeaders.java @@ -26,7 +26,7 @@ public class HeaderResponseDurationHeaders { * * @return the value value */ - public Period getValue() { + public Period value() { return this.value; } @@ -34,9 +34,11 @@ public Period getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseDurationHeaders object itself. */ - public void setValue(Period value) { + public HeaderResponseDurationHeaders withValue(Period value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseEnumHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseEnumHeaders.java index b136c45b25398..32502d1a57d6d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseEnumHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseEnumHeaders.java @@ -25,7 +25,7 @@ public class HeaderResponseEnumHeaders { * * @return the value value */ - public GreyscaleColors getValue() { + public GreyscaleColors value() { return this.value; } @@ -33,9 +33,11 @@ public GreyscaleColors getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseEnumHeaders object itself. */ - public void setValue(GreyscaleColors value) { + public HeaderResponseEnumHeaders withValue(GreyscaleColors value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseExistingKeyHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseExistingKeyHeaders.java index 3371decf429d3..60008594b0d76 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseExistingKeyHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseExistingKeyHeaders.java @@ -27,7 +27,7 @@ public class HeaderResponseExistingKeyHeaders { * * @return the userAgent value */ - public String getUserAgent() { + public String userAgent() { return this.userAgent; } @@ -35,9 +35,11 @@ public String getUserAgent() { * Set the userAgent value. * * @param userAgent the userAgent value to set + * @return the HeaderResponseExistingKeyHeaders object itself. */ - public void setUserAgent(String userAgent) { + public HeaderResponseExistingKeyHeaders withUserAgent(String userAgent) { this.userAgent = userAgent; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseFloatHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseFloatHeaders.java index 952a345855fa0..a0054caf7384b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseFloatHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseFloatHeaders.java @@ -25,7 +25,7 @@ public class HeaderResponseFloatHeaders { * * @return the value value */ - public Double getValue() { + public Double value() { return this.value; } @@ -33,9 +33,11 @@ public Double getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseFloatHeaders object itself. */ - public void setValue(Double value) { + public HeaderResponseFloatHeaders withValue(Double value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseIntegerHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseIntegerHeaders.java index bec5b8666d99a..4e9f9ee33aa5d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseIntegerHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseIntegerHeaders.java @@ -25,7 +25,7 @@ public class HeaderResponseIntegerHeaders { * * @return the value value */ - public Integer getValue() { + public Integer value() { return this.value; } @@ -33,9 +33,11 @@ public Integer getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseIntegerHeaders object itself. */ - public void setValue(Integer value) { + public HeaderResponseIntegerHeaders withValue(Integer value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseLongHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseLongHeaders.java index 5559369219367..c38f78e88de18 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseLongHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseLongHeaders.java @@ -25,7 +25,7 @@ public class HeaderResponseLongHeaders { * * @return the value value */ - public Long getValue() { + public Long value() { return this.value; } @@ -33,9 +33,11 @@ public Long getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseLongHeaders object itself. */ - public void setValue(Long value) { + public HeaderResponseLongHeaders withValue(Long value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseProtectedKeyHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseProtectedKeyHeaders.java index 938fd170bad62..d601d9862d758 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseProtectedKeyHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseProtectedKeyHeaders.java @@ -27,7 +27,7 @@ public class HeaderResponseProtectedKeyHeaders { * * @return the contentType value */ - public String getContentType() { + public String contentType() { return this.contentType; } @@ -35,9 +35,11 @@ public String getContentType() { * Set the contentType value. * * @param contentType the contentType value to set + * @return the HeaderResponseProtectedKeyHeaders object itself. */ - public void setContentType(String contentType) { + public HeaderResponseProtectedKeyHeaders withContentType(String contentType) { this.contentType = contentType; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseStringHeaders.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseStringHeaders.java index a08f614d77074..45d28e1c16b39 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseStringHeaders.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/HeaderResponseStringHeaders.java @@ -26,7 +26,7 @@ public class HeaderResponseStringHeaders { * * @return the value value */ - public String getValue() { + public String value() { return this.value; } @@ -34,9 +34,11 @@ public String getValue() { * Set the value value. * * @param value the value value to set + * @return the HeaderResponseStringHeaders object itself. */ - public void setValue(String value) { + public HeaderResponseStringHeaders withValue(String value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/package-info.java index f64384c588f59..fd5f044781203 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/header/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestSwaggerBATHeaderService. + * This package contains the models classes for AutoRestSwaggerBATHeaderService. * Test Infrastructure for AutoRest. */ package fixtures.header.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/AutoRestHttpInfrastructureTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/AutoRestHttpInfrastructureTestService.java index faf11e6007810..a5eae57150b80 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/AutoRestHttpInfrastructureTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/AutoRestHttpInfrastructureTestService.java @@ -10,85 +10,56 @@ package fixtures.http; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestHttpInfrastructureTestService class. */ public interface AutoRestHttpInfrastructureTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the HttpFailures object to access its operations. + * @return the HttpFailures object. */ - List getClientInterceptors(); + HttpFailures httpFailures(); /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. + * Gets the HttpSuccess object to access its operations. + * @return the HttpSuccess object. */ - void setLogLevel(Level logLevel); + HttpSuccess httpSuccess(); /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * Gets the HttpRedirects object to access its operations. + * @return the HttpRedirects object. */ - JacksonMapperAdapter getMapperAdapter(); + HttpRedirects httpRedirects(); /** - * Gets the HttpFailureOperations object to access its operations. - * @return the HttpFailureOperations object. + * Gets the HttpClientFailures object to access its operations. + * @return the HttpClientFailures object. */ - HttpFailureOperations getHttpFailureOperations(); + HttpClientFailures httpClientFailures(); /** - * Gets the HttpSuccessOperations object to access its operations. - * @return the HttpSuccessOperations object. + * Gets the HttpServerFailures object to access its operations. + * @return the HttpServerFailures object. */ - HttpSuccessOperations getHttpSuccessOperations(); + HttpServerFailures httpServerFailures(); /** - * Gets the HttpRedirectsOperations object to access its operations. - * @return the HttpRedirectsOperations object. + * Gets the HttpRetrys object to access its operations. + * @return the HttpRetrys object. */ - HttpRedirectsOperations getHttpRedirectsOperations(); + HttpRetrys httpRetrys(); /** - * Gets the HttpClientFailureOperations object to access its operations. - * @return the HttpClientFailureOperations object. + * Gets the MultipleResponses object to access its operations. + * @return the MultipleResponses object. */ - HttpClientFailureOperations getHttpClientFailureOperations(); - - /** - * Gets the HttpServerFailureOperations object to access its operations. - * @return the HttpServerFailureOperations object. - */ - HttpServerFailureOperations getHttpServerFailureOperations(); - - /** - * Gets the HttpRetryOperations object to access its operations. - * @return the HttpRetryOperations object. - */ - HttpRetryOperations getHttpRetryOperations(); - - /** - * Gets the MultipleResponsesOperations object to access its operations. - * @return the MultipleResponsesOperations object. - */ - MultipleResponsesOperations getMultipleResponsesOperations(); + MultipleResponses multipleResponses(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/AutoRestHttpInfrastructureTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/AutoRestHttpInfrastructureTestServiceImpl.java deleted file mode 100644 index 77dcab722a171..0000000000000 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/AutoRestHttpInfrastructureTestServiceImpl.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -package fixtures.http; - -import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; - -/** - * Initializes a new instance of the AutoRestHttpInfrastructureTestService class. - */ -public final class AutoRestHttpInfrastructureTestServiceImpl extends ServiceClient implements AutoRestHttpInfrastructureTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - - /** - * Gets the HttpFailureOperations object to access its operations. - * @return the HttpFailureOperations object. - */ - public HttpFailureOperations getHttpFailureOperations() { - return new HttpFailureOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the HttpSuccessOperations object to access its operations. - * @return the HttpSuccessOperations object. - */ - public HttpSuccessOperations getHttpSuccessOperations() { - return new HttpSuccessOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the HttpRedirectsOperations object to access its operations. - * @return the HttpRedirectsOperations object. - */ - public HttpRedirectsOperations getHttpRedirectsOperations() { - return new HttpRedirectsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the HttpClientFailureOperations object to access its operations. - * @return the HttpClientFailureOperations object. - */ - public HttpClientFailureOperations getHttpClientFailureOperations() { - return new HttpClientFailureOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the HttpServerFailureOperations object to access its operations. - * @return the HttpServerFailureOperations object. - */ - public HttpServerFailureOperations getHttpServerFailureOperations() { - return new HttpServerFailureOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the HttpRetryOperations object to access its operations. - * @return the HttpRetryOperations object. - */ - public HttpRetryOperations getHttpRetryOperations() { - return new HttpRetryOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the MultipleResponsesOperations object to access its operations. - * @return the MultipleResponsesOperations object. - */ - public MultipleResponsesOperations getMultipleResponsesOperations() { - return new MultipleResponsesOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Initializes an instance of AutoRestHttpInfrastructureTestService client. - */ - public AutoRestHttpInfrastructureTestServiceImpl() { - this("http://localhost"); - } - - /** - * Initializes an instance of AutoRestHttpInfrastructureTestService client. - * - * @param baseUrl the base URL of the host - */ - public AutoRestHttpInfrastructureTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - /** - * Initializes an instance of AutoRestHttpInfrastructureTestService client. - * - * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} - */ - public AutoRestHttpInfrastructureTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); - } -} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpClientFailureOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpClientFailures.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpClientFailureOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpClientFailures.java index 2b8620575a002..170c1ce7cb6b6 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpClientFailureOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpClientFailures.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in HttpClientFailureOperations. + * in HttpClientFailures. */ -public interface HttpClientFailureOperations { +public interface HttpClientFailures { /** * Return 400 status code - should be represented in the client as an error. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpFailureOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpFailures.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpFailureOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpFailures.java index d3b55c77fbefb..ce36d6caea4ed 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpFailureOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpFailures.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in HttpFailureOperations. + * in HttpFailures. */ -public interface HttpFailureOperations { +public interface HttpFailures { /** * Get empty error form server. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirectsOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirects.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirectsOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirects.java index f1ece0c1b3c4c..640618db3b689 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirectsOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirects.java @@ -34,9 +34,9 @@ /** * An instance of this class provides access to all the operations defined - * in HttpRedirectsOperations. + * in HttpRedirects. */ -public interface HttpRedirectsOperations { +public interface HttpRedirects { /** * Return 300 status code and redirect to /http/success/200. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRetryOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRetrys.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRetryOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRetrys.java index fafdc907015d8..49fac25836640 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRetryOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRetrys.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in HttpRetryOperations. + * in HttpRetrys. */ -public interface HttpRetryOperations { +public interface HttpRetrys { /** * Return 408 status code, then 200 after retry. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpServerFailureOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpServerFailures.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpServerFailureOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpServerFailures.java index e5b3a0faf5945..743246df404eb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpServerFailureOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpServerFailures.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in HttpServerFailureOperations. + * in HttpServerFailures. */ -public interface HttpServerFailureOperations { +public interface HttpServerFailures { /** * Return 501 status code - should be represented in the client as an error. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpSuccessOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpSuccess.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpSuccessOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpSuccess.java index f47159a00177d..21bb6d1005cae 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpSuccessOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpSuccess.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in HttpSuccessOperations. + * in HttpSuccess. */ -public interface HttpSuccessOperations { +public interface HttpSuccess { /** * Return 200 status code if successful. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponsesOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponses.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponsesOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponses.java index 71f6700c378c8..0a44802e639d7 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponsesOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponses.java @@ -21,9 +21,9 @@ /** * An instance of this class provides access to all the operations defined - * in MultipleResponsesOperations. + * in MultipleResponses. */ -public interface MultipleResponsesOperations { +public interface MultipleResponses { /** * Send a 200 response with valid payload: {'statusCode': '200'}. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/AutoRestHttpInfrastructureTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/AutoRestHttpInfrastructureTestServiceImpl.java new file mode 100644 index 0000000000000..4318869a7eebc --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/AutoRestHttpInfrastructureTestServiceImpl.java @@ -0,0 +1,170 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.http.implementation; + +import fixtures.http.AutoRestHttpInfrastructureTestService; +import fixtures.http.HttpFailures; +import fixtures.http.HttpSuccess; +import fixtures.http.HttpRedirects; +import fixtures.http.HttpClientFailures; +import fixtures.http.HttpServerFailures; +import fixtures.http.HttpRetrys; +import fixtures.http.MultipleResponses; +import com.microsoft.rest.ServiceClient; +import okhttp3.OkHttpClient; +import retrofit2.Retrofit; + +/** + * Initializes a new instance of the AutoRestHttpInfrastructureTestService class. + */ +public final class AutoRestHttpInfrastructureTestServiceImpl extends ServiceClient implements AutoRestHttpInfrastructureTestService { + + /** + * The HttpFailures object to access its operations. + */ + private HttpFailures httpFailures; + + /** + * Gets the HttpFailures object to access its operations. + * @return the HttpFailures object. + */ + public HttpFailures httpFailures() { + return this.httpFailures; + } + + /** + * The HttpSuccess object to access its operations. + */ + private HttpSuccess httpSuccess; + + /** + * Gets the HttpSuccess object to access its operations. + * @return the HttpSuccess object. + */ + public HttpSuccess httpSuccess() { + return this.httpSuccess; + } + + /** + * The HttpRedirects object to access its operations. + */ + private HttpRedirects httpRedirects; + + /** + * Gets the HttpRedirects object to access its operations. + * @return the HttpRedirects object. + */ + public HttpRedirects httpRedirects() { + return this.httpRedirects; + } + + /** + * The HttpClientFailures object to access its operations. + */ + private HttpClientFailures httpClientFailures; + + /** + * Gets the HttpClientFailures object to access its operations. + * @return the HttpClientFailures object. + */ + public HttpClientFailures httpClientFailures() { + return this.httpClientFailures; + } + + /** + * The HttpServerFailures object to access its operations. + */ + private HttpServerFailures httpServerFailures; + + /** + * Gets the HttpServerFailures object to access its operations. + * @return the HttpServerFailures object. + */ + public HttpServerFailures httpServerFailures() { + return this.httpServerFailures; + } + + /** + * The HttpRetrys object to access its operations. + */ + private HttpRetrys httpRetrys; + + /** + * Gets the HttpRetrys object to access its operations. + * @return the HttpRetrys object. + */ + public HttpRetrys httpRetrys() { + return this.httpRetrys; + } + + /** + * The MultipleResponses object to access its operations. + */ + private MultipleResponses multipleResponses; + + /** + * Gets the MultipleResponses object to access its operations. + * @return the MultipleResponses object. + */ + public MultipleResponses multipleResponses() { + return this.multipleResponses; + } + + /** + * Initializes an instance of AutoRestHttpInfrastructureTestService client. + */ + public AutoRestHttpInfrastructureTestServiceImpl() { + this("http://localhost"); + } + + /** + * Initializes an instance of AutoRestHttpInfrastructureTestService client. + * + * @param baseUrl the base URL of the host + */ + public AutoRestHttpInfrastructureTestServiceImpl(String baseUrl) { + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestHttpInfrastructureTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestHttpInfrastructureTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); + initialize(); + } + + /** + * Initializes an instance of AutoRestHttpInfrastructureTestService client. + * + * @param baseUrl the base URL of the host + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestHttpInfrastructureTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); + initialize(); + } + + private void initialize() { + this.httpFailures = new HttpFailuresImpl(retrofit(), this); + this.httpSuccess = new HttpSuccessImpl(retrofit(), this); + this.httpRedirects = new HttpRedirectsImpl(retrofit(), this); + this.httpClientFailures = new HttpClientFailuresImpl(retrofit(), this); + this.httpServerFailures = new HttpServerFailuresImpl(retrofit(), this); + this.httpRetrys = new HttpRetrysImpl(retrofit(), this); + this.multipleResponses = new MultipleResponsesImpl(retrofit(), this); + } +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpClientFailureOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpClientFailuresImpl.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpClientFailureOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpClientFailuresImpl.java index bd6d6718be372..15bdc00ea3a83 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpClientFailureOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpClientFailuresImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.http; +package fixtures.http.implementation; +import retrofit2.Retrofit; +import fixtures.http.HttpClientFailures; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -30,34 +32,33 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HttpClientFailureOperations. + * in HttpClientFailures. */ -public final class HttpClientFailureOperationsImpl implements HttpClientFailureOperations { +public final class HttpClientFailuresImpl implements HttpClientFailures { /** The Retrofit service to perform REST calls. */ - private HttpClientFailureService service; + private HttpClientFailuresService service; /** The service client containing this operation class. */ - private AutoRestHttpInfrastructureTestService client; + private AutoRestHttpInfrastructureTestServiceImpl client; /** - * Initializes an instance of HttpClientFailureOperations. + * Initializes an instance of HttpClientFailures. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HttpClientFailureOperationsImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestService client) { - this.service = retrofit.create(HttpClientFailureService.class); + public HttpClientFailuresImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestServiceImpl client) { + this.service = retrofit.create(HttpClientFailuresService.class); this.client = client; } /** - * The interface defining all the services for HttpClientFailureOperations to be + * The interface defining all the services for HttpClientFailures to be * used by Retrofit to perform actually REST calls. */ - interface HttpClientFailureService { + interface HttpClientFailuresService { @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/failure/client/400") Call head400(); @@ -191,7 +192,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head400Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .buildEmpty(response); } @@ -235,7 +236,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get400Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -321,7 +322,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put400Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -407,7 +408,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse patch400Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -493,7 +494,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse post400Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -579,7 +580,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse delete400Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -623,7 +624,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head401Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .buildEmpty(response); } @@ -667,7 +668,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get402Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -711,7 +712,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get403Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -797,7 +798,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put404Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -883,7 +884,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse patch405Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -969,7 +970,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse post406Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1055,7 +1056,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse delete407Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1141,7 +1142,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put409Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1185,7 +1186,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head410Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .buildEmpty(response); } @@ -1229,7 +1230,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get411Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1273,7 +1274,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get412Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1359,7 +1360,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put413Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1445,7 +1446,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse patch414Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1531,7 +1532,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse post415Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1575,7 +1576,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get416Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1661,7 +1662,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse delete417Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1705,7 +1706,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head429Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .buildEmpty(response); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpFailureOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpFailuresImpl.java similarity index 91% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpFailureOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpFailuresImpl.java index 9329c4827f5a0..a1d2d81ef5eaf 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpFailureOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpFailuresImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.http; +package fixtures.http.implementation; +import retrofit2.Retrofit; +import fixtures.http.HttpFailures; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -24,34 +26,33 @@ import retrofit2.http.GET; import retrofit2.http.Headers; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HttpFailureOperations. + * in HttpFailures. */ -public final class HttpFailureOperationsImpl implements HttpFailureOperations { +public final class HttpFailuresImpl implements HttpFailures { /** The Retrofit service to perform REST calls. */ - private HttpFailureService service; + private HttpFailuresService service; /** The service client containing this operation class. */ - private AutoRestHttpInfrastructureTestService client; + private AutoRestHttpInfrastructureTestServiceImpl client; /** - * Initializes an instance of HttpFailureOperations. + * Initializes an instance of HttpFailures. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HttpFailureOperationsImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestService client) { - this.service = retrofit.create(HttpFailureService.class); + public HttpFailuresImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestServiceImpl client) { + this.service = retrofit.create(HttpFailuresService.class); this.client = client; } /** - * The interface defining all the services for HttpFailureOperations to be + * The interface defining all the services for HttpFailures to be * used by Retrofit to perform actually REST calls. */ - interface HttpFailureService { + interface HttpFailuresService { @Headers("Content-Type: application/json; charset=utf-8") @GET("http/failure/emptybody/error") Call getEmptyError(); @@ -105,7 +106,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getEmptyErrorDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -150,7 +151,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNoModelErrorDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } @@ -194,7 +195,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNoModelEmptyDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirectsOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpRedirectsImpl.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirectsOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpRedirectsImpl.java index d422aab756c84..9f38bb7d2b90a 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirectsOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpRedirectsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.http; +package fixtures.http.implementation; +import retrofit2.Retrofit; +import fixtures.http.HttpRedirects; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -46,31 +48,30 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HttpRedirectsOperations. + * in HttpRedirects. */ -public final class HttpRedirectsOperationsImpl implements HttpRedirectsOperations { +public final class HttpRedirectsImpl implements HttpRedirects { /** The Retrofit service to perform REST calls. */ private HttpRedirectsService service; /** The service client containing this operation class. */ - private AutoRestHttpInfrastructureTestService client; + private AutoRestHttpInfrastructureTestServiceImpl client; /** - * Initializes an instance of HttpRedirectsOperations. + * Initializes an instance of HttpRedirects. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HttpRedirectsOperationsImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestService client) { + public HttpRedirectsImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestServiceImpl client) { this.service = retrofit.create(HttpRedirectsService.class); this.client = client; } /** - * The interface defining all the services for HttpRedirectsOperations to be + * The interface defining all the services for HttpRedirects to be * used by Retrofit to perform actually REST calls. */ interface HttpRedirectsService { @@ -175,7 +176,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponseWithHeaders head300Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(300, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -221,7 +222,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders, HttpRedirectsGet300Headers> get300Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.client.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(300, new TypeToken>() { }.getType()) .registerError(ErrorException.class) @@ -267,7 +268,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponseWithHeaders head301Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(301, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -313,7 +314,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders get301Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(301, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -401,7 +402,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders put301Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(301, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HttpRedirectsPut301Headers.class); @@ -446,7 +447,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponseWithHeaders head302Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(302, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -492,7 +493,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders get302Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(302, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -580,7 +581,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders patch302Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(302, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildWithHeaders(response, HttpRedirectsPatch302Headers.class); @@ -667,7 +668,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders post303Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(303, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -713,7 +714,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponseWithHeaders head307Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(307, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -759,7 +760,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders get307Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(307, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -847,7 +848,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders put307Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(307, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -935,7 +936,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders patch307Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(307, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -1023,7 +1024,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders post307Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(307, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -1111,7 +1112,7 @@ public void onResponse(Call call, Response response) } private ServiceResponseWithHeaders delete307Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(307, new TypeToken() { }.getType()) .registerError(ErrorException.class) diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRetryOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpRetrysImpl.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRetryOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpRetrysImpl.java index d3ba17ef439c6..3edfff16fbc64 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRetryOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpRetrysImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.http; +package fixtures.http.implementation; +import retrofit2.Retrofit; +import fixtures.http.HttpRetrys; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -30,34 +32,33 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HttpRetryOperations. + * in HttpRetrys. */ -public final class HttpRetryOperationsImpl implements HttpRetryOperations { +public final class HttpRetrysImpl implements HttpRetrys { /** The Retrofit service to perform REST calls. */ - private HttpRetryService service; + private HttpRetrysService service; /** The service client containing this operation class. */ - private AutoRestHttpInfrastructureTestService client; + private AutoRestHttpInfrastructureTestServiceImpl client; /** - * Initializes an instance of HttpRetryOperations. + * Initializes an instance of HttpRetrys. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HttpRetryOperationsImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestService client) { - this.service = retrofit.create(HttpRetryService.class); + public HttpRetrysImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestServiceImpl client) { + this.service = retrofit.create(HttpRetrysService.class); this.client = client; } /** - * The interface defining all the services for HttpRetryOperations to be + * The interface defining all the services for HttpRetrys to be * used by Retrofit to perform actually REST calls. */ - interface HttpRetryService { + interface HttpRetrysService { @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/retry/408") Call head408(); @@ -131,7 +132,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head408Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildEmpty(response); @@ -218,7 +219,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put500Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -305,7 +306,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse patch500Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -350,7 +351,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get502Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -437,7 +438,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse post503Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -524,7 +525,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse delete503Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -611,7 +612,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put504Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -698,7 +699,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse patch504Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpServerFailureOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpServerFailuresImpl.java similarity index 95% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpServerFailureOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpServerFailuresImpl.java index 1ea87e8af11a7..505422a9627dc 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpServerFailureOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpServerFailuresImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.http; +package fixtures.http.implementation; +import retrofit2.Retrofit; +import fixtures.http.HttpServerFailures; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -28,34 +30,33 @@ import retrofit2.http.HTTP; import retrofit2.http.POST; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HttpServerFailureOperations. + * in HttpServerFailures. */ -public final class HttpServerFailureOperationsImpl implements HttpServerFailureOperations { +public final class HttpServerFailuresImpl implements HttpServerFailures { /** The Retrofit service to perform REST calls. */ - private HttpServerFailureService service; + private HttpServerFailuresService service; /** The service client containing this operation class. */ - private AutoRestHttpInfrastructureTestService client; + private AutoRestHttpInfrastructureTestServiceImpl client; /** - * Initializes an instance of HttpServerFailureOperations. + * Initializes an instance of HttpServerFailures. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HttpServerFailureOperationsImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestService client) { - this.service = retrofit.create(HttpServerFailureService.class); + public HttpServerFailuresImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestServiceImpl client) { + this.service = retrofit.create(HttpServerFailuresService.class); this.client = client; } /** - * The interface defining all the services for HttpServerFailureOperations to be + * The interface defining all the services for HttpServerFailures to be * used by Retrofit to perform actually REST calls. */ - interface HttpServerFailureService { + interface HttpServerFailuresService { @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/failure/server/501") Call head501(); @@ -113,7 +114,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head501Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .buildEmpty(response); } @@ -157,7 +158,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get501Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -243,7 +244,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse post505Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -329,7 +330,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse delete505Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpSuccessOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpSuccessImpl.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpSuccessOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpSuccessImpl.java index 09ab15c84944e..0bccc3aa45973 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpSuccessOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/HttpSuccessImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.http; +package fixtures.http.implementation; +import retrofit2.Retrofit; +import fixtures.http.HttpSuccess; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -30,31 +32,30 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in HttpSuccessOperations. + * in HttpSuccess. */ -public final class HttpSuccessOperationsImpl implements HttpSuccessOperations { +public final class HttpSuccessImpl implements HttpSuccess { /** The Retrofit service to perform REST calls. */ private HttpSuccessService service; /** The service client containing this operation class. */ - private AutoRestHttpInfrastructureTestService client; + private AutoRestHttpInfrastructureTestServiceImpl client; /** - * Initializes an instance of HttpSuccessOperations. + * Initializes an instance of HttpSuccess. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public HttpSuccessOperationsImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestService client) { + public HttpSuccessImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestServiceImpl client) { this.service = retrofit.create(HttpSuccessService.class); this.client = client; } /** - * The interface defining all the services for HttpSuccessOperations to be + * The interface defining all the services for HttpSuccess to be * used by Retrofit to perform actually REST calls. */ interface HttpSuccessService { @@ -171,7 +172,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head200Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildEmpty(response); @@ -216,7 +217,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -303,7 +304,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put200Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -390,7 +391,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse patch200Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -477,7 +478,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse post200Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -564,7 +565,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse delete200Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -651,7 +652,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put201Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(201, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -738,7 +739,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse post201Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(201, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -825,7 +826,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put202Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -912,7 +913,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse patch202Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -999,7 +1000,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse post202Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1086,7 +1087,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse delete202Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1131,7 +1132,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head204Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) .buildEmpty(response); @@ -1218,7 +1219,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse put204Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1305,7 +1306,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse patch204Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1392,7 +1393,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse post204Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1479,7 +1480,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse delete204Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1524,7 +1525,7 @@ public void onResponse(Call call, Response response) { } private ServiceResponse head404Delegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(204, new TypeToken() { }.getType()) .register(404, new TypeToken() { }.getType()) .registerError(ErrorException.class) diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponsesOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/MultipleResponsesImpl.java similarity index 98% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponsesOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/MultipleResponsesImpl.java index da92a8d2647ed..fae0286d1a1cc 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponsesOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/MultipleResponsesImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.http; +package fixtures.http.implementation; +import retrofit2.Retrofit; +import fixtures.http.MultipleResponses; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -29,31 +31,30 @@ import retrofit2.http.GET; import retrofit2.http.Headers; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in MultipleResponsesOperations. + * in MultipleResponses. */ -public final class MultipleResponsesOperationsImpl implements MultipleResponsesOperations { +public final class MultipleResponsesImpl implements MultipleResponses { /** The Retrofit service to perform REST calls. */ private MultipleResponsesService service; /** The service client containing this operation class. */ - private AutoRestHttpInfrastructureTestService client; + private AutoRestHttpInfrastructureTestServiceImpl client; /** - * Initializes an instance of MultipleResponsesOperations. + * Initializes an instance of MultipleResponses. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public MultipleResponsesOperationsImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestService client) { + public MultipleResponsesImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestServiceImpl client) { this.service = retrofit.create(MultipleResponsesService.class); this.client = client; } /** - * The interface defining all the services for MultipleResponsesOperations to be + * The interface defining all the services for MultipleResponses to be * used by Retrofit to perform actually REST calls. */ interface MultipleResponsesService { @@ -234,7 +235,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200Model204NoModelDefaultError200ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -280,7 +281,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200Model204NoModelDefaultError204ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -326,7 +327,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200Model204NoModelDefaultError201InvalidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -372,7 +373,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200Model204NoModelDefaultError202NoneDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -418,7 +419,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200Model204NoModelDefaultError400ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -464,7 +465,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200Model201ModelDefaultError200ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -510,7 +511,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200Model201ModelDefaultError201ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -556,7 +557,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200Model201ModelDefaultError400ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -602,7 +603,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA201ModelC404ModelDDefaultError200ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .register(404, new TypeToken() { }.getType()) @@ -649,7 +650,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA201ModelC404ModelDDefaultError201ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .register(404, new TypeToken() { }.getType()) @@ -696,7 +697,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA201ModelC404ModelDDefaultError404ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .register(404, new TypeToken() { }.getType()) @@ -743,7 +744,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA201ModelC404ModelDDefaultError400ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) .register(404, new TypeToken() { }.getType()) @@ -790,7 +791,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get202None204NoneDefaultError202NoneDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -836,7 +837,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get202None204NoneDefaultError204NoneDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -882,7 +883,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get202None204NoneDefaultError400ValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .registerError(ErrorException.class) @@ -928,7 +929,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get202None204NoneDefaultNone202InvalidDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .build(response); @@ -973,7 +974,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get202None204NoneDefaultNone204NoneDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .build(response); @@ -1018,7 +1019,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get202None204NoneDefaultNone400NoneDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .build(response); @@ -1063,7 +1064,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get202None204NoneDefaultNone400InvalidDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(202, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) .build(response); @@ -1108,7 +1109,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDefaultModelA200ValidDelegate(Response response) throws MyException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(MyException.class) .build(response); } @@ -1152,7 +1153,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDefaultModelA200NoneDelegate(Response response) throws MyException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(MyException.class) .build(response); } @@ -1196,7 +1197,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDefaultModelA400ValidDelegate(Response response) throws MyException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(MyException.class) .build(response); } @@ -1240,7 +1241,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDefaultModelA400NoneDelegate(Response response) throws MyException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(MyException.class) .build(response); } @@ -1284,7 +1285,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDefaultNone200InvalidDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .build(response); } @@ -1327,7 +1328,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDefaultNone200NoneDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .build(response); } @@ -1370,7 +1371,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDefaultNone400InvalidDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .build(response); } @@ -1413,7 +1414,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getDefaultNone400NoneDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .build(response); } @@ -1456,7 +1457,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA200NoneDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } @@ -1500,7 +1501,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA200ValidDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } @@ -1544,7 +1545,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA200InvalidDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } @@ -1588,7 +1589,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA400NoneDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } @@ -1632,7 +1633,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA400ValidDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } @@ -1676,7 +1677,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA400InvalidDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } @@ -1720,7 +1721,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse get200ModelA202ValidDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/package-info.java new file mode 100644 index 0000000000000..6762e615ae25a --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestHttpInfrastructureTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.http.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/A.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/A.java index ff386ce2cd1bd..189532a6632bf 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/A.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/A.java @@ -25,7 +25,7 @@ public class A { * * @return the statusCode value */ - public String getStatusCode() { + public String statusCode() { return this.statusCode; } @@ -33,9 +33,11 @@ public String getStatusCode() { * Set the statusCode value. * * @param statusCode the statusCode value to set + * @return the A object itself. */ - public void setStatusCode(String statusCode) { + public A withStatusCode(String statusCode) { this.statusCode = statusCode; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/B.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/B.java index 95034f5909222..d4b1bafd0d420 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/B.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/B.java @@ -25,7 +25,7 @@ public class B extends A { * * @return the textStatusCode value */ - public String getTextStatusCode() { + public String textStatusCode() { return this.textStatusCode; } @@ -33,9 +33,11 @@ public String getTextStatusCode() { * Set the textStatusCode value. * * @param textStatusCode the textStatusCode value to set + * @return the B object itself. */ - public void setTextStatusCode(String textStatusCode) { + public B withTextStatusCode(String textStatusCode) { this.textStatusCode = textStatusCode; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/C.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/C.java index 013b1d346473f..da9d49bc31583 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/C.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/C.java @@ -25,7 +25,7 @@ public class C { * * @return the httpCode value */ - public String getHttpCode() { + public String httpCode() { return this.httpCode; } @@ -33,9 +33,11 @@ public String getHttpCode() { * Set the httpCode value. * * @param httpCode the httpCode value to set + * @return the C object itself. */ - public void setHttpCode(String httpCode) { + public C withHttpCode(String httpCode) { this.httpCode = httpCode; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/D.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/D.java index a240235cf4654..f05c983b06564 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/D.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/D.java @@ -25,7 +25,7 @@ public class D { * * @return the httpStatusCode value */ - public String getHttpStatusCode() { + public String httpStatusCode() { return this.httpStatusCode; } @@ -33,9 +33,11 @@ public String getHttpStatusCode() { * Set the httpStatusCode value. * * @param httpStatusCode the httpStatusCode value to set + * @return the D object itself. */ - public void setHttpStatusCode(String httpStatusCode) { + public D withHttpStatusCode(String httpStatusCode) { this.httpStatusCode = httpStatusCode; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/Error.java index 5099c0b6029c0..ba9c40bc15f74 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/ErrorException.java index 6df37d0b34e1c..9caefc352dea9 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.http.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsDelete307Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsDelete307Headers.java index 4426b70cbf3bc..5cbbcbc3c5034 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsDelete307Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsDelete307Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsDelete307Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsDelete307Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsDelete307Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet300Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet300Headers.java index b59ec006b72a4..268997fac19f8 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet300Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet300Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsGet300Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsGet300Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsGet300Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet301Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet301Headers.java index ec7a17879b136..cf61e55362381 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet301Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet301Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsGet301Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsGet301Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsGet301Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet302Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet302Headers.java index 575bf31e654de..5b1d96d9cbf47 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet302Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet302Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsGet302Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsGet302Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsGet302Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet307Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet307Headers.java index c2c52cec15a03..d7f53f01bc993 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet307Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsGet307Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsGet307Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsGet307Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsGet307Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead300Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead300Headers.java index cce7b36b7ac95..441d4ccb4c48b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead300Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead300Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsHead300Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsHead300Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsHead300Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead301Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead301Headers.java index 75fcce2a17993..772258bedfb72 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead301Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead301Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsHead301Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsHead301Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsHead301Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead302Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead302Headers.java index 91cba7359129f..a16549d5386e6 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead302Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead302Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsHead302Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsHead302Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsHead302Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead307Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead307Headers.java index 66fbd4750f0a8..bb9d491c7d90a 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead307Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsHead307Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsHead307Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsHead307Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsHead307Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPatch302Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPatch302Headers.java index 3729b57e24fc8..f459c21ad8c23 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPatch302Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPatch302Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsPatch302Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsPatch302Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsPatch302Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPatch307Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPatch307Headers.java index b944e4d6abd12..d368801743452 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPatch307Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPatch307Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsPatch307Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsPatch307Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsPatch307Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPost303Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPost303Headers.java index 44d325216e57c..d0c48bec1427e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPost303Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPost303Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsPost303Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsPost303Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsPost303Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPost307Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPost307Headers.java index eb1db8e41a1e8..e54375c14cb7e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPost307Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPost307Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsPost307Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsPost307Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsPost307Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPut301Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPut301Headers.java index f3348c698fcb6..a402453b47781 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPut301Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPut301Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsPut301Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsPut301Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsPut301Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPut307Headers.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPut307Headers.java index eba98cafecdcb..bf19516a66ddc 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPut307Headers.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/HttpRedirectsPut307Headers.java @@ -27,7 +27,7 @@ public class HttpRedirectsPut307Headers { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -35,9 +35,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the HttpRedirectsPut307Headers object itself. */ - public void setLocation(String location) { + public HttpRedirectsPut307Headers withLocation(String location) { this.location = location; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/MyException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/MyException.java index 749ee18b24ce5..3fca6db69d1d3 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/MyException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/MyException.java @@ -10,13 +10,13 @@ package fixtures.http.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with A information. */ -public class MyException extends AutoRestException { +public class MyException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/package-info.java index 37e7bb9720d05..680cfa1d17152 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestHttpInfrastructureTestService. + * This package contains the models classes for AutoRestHttpInfrastructureTestService. * Test Infrastructure for AutoRest. */ package fixtures.http.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/AutoRestResourceFlatteningTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/AutoRestResourceFlatteningTestService.java index f9141d25e0048..48d3946e54567 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/AutoRestResourceFlatteningTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/AutoRestResourceFlatteningTestService.java @@ -10,11 +10,6 @@ package fixtures.modelflattening; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -25,6 +20,7 @@ import fixtures.modelflattening.models.ResourceCollection; import fixtures.modelflattening.models.SimpleProduct; import java.io.IOException; +import java.util.List; import java.util.Map; /** @@ -32,33 +28,9 @@ */ public interface AutoRestResourceFlatteningTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * The default base URL. */ - JacksonMapperAdapter getMapperAdapter(); + String DEFAULT_BASE_URL = "http://localhost"; /** * Put External Resource as an Array. diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/AutoRestResourceFlatteningTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/implementation/AutoRestResourceFlatteningTestServiceImpl.java similarity index 90% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/AutoRestResourceFlatteningTestServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/implementation/AutoRestResourceFlatteningTestServiceImpl.java index 6a92545776db8..c39575641eda9 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/AutoRestResourceFlatteningTestServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/implementation/AutoRestResourceFlatteningTestServiceImpl.java @@ -8,13 +8,12 @@ * regenerated. */ -package fixtures.modelflattening; +package fixtures.modelflattening.implementation; +import fixtures.modelflattening.AutoRestResourceFlatteningTestService; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; -import okhttp3.logging.HttpLoggingInterceptor.Level; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -49,19 +48,6 @@ public final class AutoRestResourceFlatteningTestServiceImpl extends ServiceClie * The Retrofit service to perform REST calls. */ private AutoRestResourceFlatteningTestServiceService service; - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } /** * Initializes an instance of AutoRestResourceFlatteningTestService client. @@ -76,8 +62,18 @@ public AutoRestResourceFlatteningTestServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestResourceFlatteningTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestResourceFlatteningTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestResourceFlatteningTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -85,37 +81,20 @@ public AutoRestResourceFlatteningTestServiceImpl(String baseUrl) { * Initializes an instance of AutoRestResourceFlatteningTestService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestResourceFlatteningTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestResourceFlatteningTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { initializeService(); } private void initializeService() { - service = this.retrofitBuilder.client(this.clientBuilder.build()) - .build() - .create(AutoRestResourceFlatteningTestServiceService.class); - } - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum - */ - @Override - public void setLogLevel(Level logLevel) { - super.setLogLevel(logLevel); - initializeService(); + service = retrofit().create(AutoRestResourceFlatteningTestServiceService.class); } /** @@ -244,7 +223,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putArrayDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -289,7 +268,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getArrayDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -378,7 +357,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putDictionaryDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -423,7 +402,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getDictionaryDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -512,7 +491,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putResourceCollectionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -557,7 +536,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getResourceCollectionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -646,7 +625,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putSimpleProductDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -673,11 +652,11 @@ public ServiceResponse postFlattenedSimpleProduct(String productI final String genericValue = null; final String odatavalue = null; SimpleProduct simpleBodyProduct = new SimpleProduct(); - simpleBodyProduct.setProductId(productId); - simpleBodyProduct = null; - simpleBodyProduct.setMaxProductDisplayName(maxProductDisplayName); - simpleBodyProduct = null; - simpleBodyProduct = null; + simpleBodyProduct.withProductId(productId); + simpleBodyProduct.withDescription(null); + simpleBodyProduct.withMaxProductDisplayName(maxProductDisplayName); + simpleBodyProduct.withGenericValue(null); + simpleBodyProduct.withOdatavalue(null); Call call = service.postFlattenedSimpleProduct(simpleBodyProduct); return postFlattenedSimpleProductDelegate(call.execute()); } @@ -707,11 +686,11 @@ public ServiceCall postFlattenedSimpleProductAsync(String productId, String maxP final String genericValue = null; final String odatavalue = null; SimpleProduct simpleBodyProduct = new SimpleProduct(); - simpleBodyProduct.setProductId(productId); - simpleBodyProduct = null; - simpleBodyProduct.setMaxProductDisplayName(maxProductDisplayName); - simpleBodyProduct = null; - simpleBodyProduct = null; + simpleBodyProduct.withProductId(productId); + simpleBodyProduct.withDescription(null); + simpleBodyProduct.withMaxProductDisplayName(maxProductDisplayName); + simpleBodyProduct.withGenericValue(null); + simpleBodyProduct.withOdatavalue(null); Call call = service.postFlattenedSimpleProduct(simpleBodyProduct); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -750,11 +729,11 @@ public ServiceResponse postFlattenedSimpleProduct(String productI SimpleProduct simpleBodyProduct = null; if (description != null || genericValue != null || odatavalue != null) { simpleBodyProduct = new SimpleProduct(); - simpleBodyProduct.setProductId(productId); - simpleBodyProduct.setDescription(description); - simpleBodyProduct.setMaxProductDisplayName(maxProductDisplayName); - simpleBodyProduct.setGenericValue(genericValue); - simpleBodyProduct.setOdatavalue(odatavalue); + simpleBodyProduct.withProductId(productId); + simpleBodyProduct.withDescription(description); + simpleBodyProduct.withMaxProductDisplayName(maxProductDisplayName); + simpleBodyProduct.withGenericValue(genericValue); + simpleBodyProduct.withOdatavalue(odatavalue); } Call call = service.postFlattenedSimpleProduct(simpleBodyProduct); return postFlattenedSimpleProductDelegate(call.execute()); @@ -787,11 +766,11 @@ public ServiceCall postFlattenedSimpleProductAsync(String productId, String maxP SimpleProduct simpleBodyProduct = null; if (description != null || genericValue != null || odatavalue != null) { simpleBodyProduct = new SimpleProduct(); - simpleBodyProduct.setProductId(productId); - simpleBodyProduct.setDescription(description); - simpleBodyProduct.setMaxProductDisplayName(maxProductDisplayName); - simpleBodyProduct.setGenericValue(genericValue); - simpleBodyProduct.setOdatavalue(odatavalue); + simpleBodyProduct.withProductId(productId); + simpleBodyProduct.withDescription(description); + simpleBodyProduct.withMaxProductDisplayName(maxProductDisplayName); + simpleBodyProduct.withGenericValue(genericValue); + simpleBodyProduct.withOdatavalue(odatavalue); } Call call = service.postFlattenedSimpleProduct(simpleBodyProduct); final ServiceCall serviceCall = new ServiceCall(call); @@ -809,7 +788,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postFlattenedSimpleProductDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -829,20 +808,20 @@ public ServiceResponse putSimpleProductWithGrouping(FlattenParame throw new IllegalArgumentException("Parameter flattenParameterGroup is required and cannot be null."); } Validator.validate(flattenParameterGroup); - String name = flattenParameterGroup.getName(); - String productId = flattenParameterGroup.getProductId(); - String description = flattenParameterGroup.getDescription(); - String maxProductDisplayName = flattenParameterGroup.getMaxProductDisplayName(); - String genericValue = flattenParameterGroup.getGenericValue(); - String odatavalue = flattenParameterGroup.getOdatavalue(); + String name = flattenParameterGroup.name(); + String productId = flattenParameterGroup.productId(); + String description = flattenParameterGroup.description(); + String maxProductDisplayName = flattenParameterGroup.maxProductDisplayName(); + String genericValue = flattenParameterGroup.genericValue(); + String odatavalue = flattenParameterGroup.odatavalue(); SimpleProduct simpleBodyProduct = null; if (description != null || genericValue != null || odatavalue != null) { simpleBodyProduct = new SimpleProduct(); - simpleBodyProduct.setProductId(productId); - simpleBodyProduct.setDescription(description); - simpleBodyProduct.setMaxProductDisplayName(maxProductDisplayName); - simpleBodyProduct.setGenericValue(genericValue); - simpleBodyProduct.setOdatavalue(odatavalue); + simpleBodyProduct.withProductId(productId); + simpleBodyProduct.withDescription(description); + simpleBodyProduct.withMaxProductDisplayName(maxProductDisplayName); + simpleBodyProduct.withGenericValue(genericValue); + simpleBodyProduct.withOdatavalue(odatavalue); } Call call = service.putSimpleProductWithGrouping(name, simpleBodyProduct); return putSimpleProductWithGroupingDelegate(call.execute()); @@ -865,20 +844,20 @@ public ServiceCall putSimpleProductWithGroupingAsync(FlattenParameterGroup flatt return null; } Validator.validate(flattenParameterGroup, serviceCallback); - String name = flattenParameterGroup.getName(); - String productId = flattenParameterGroup.getProductId(); - String description = flattenParameterGroup.getDescription(); - String maxProductDisplayName = flattenParameterGroup.getMaxProductDisplayName(); - String genericValue = flattenParameterGroup.getGenericValue(); - String odatavalue = flattenParameterGroup.getOdatavalue(); + String name = flattenParameterGroup.name(); + String productId = flattenParameterGroup.productId(); + String description = flattenParameterGroup.description(); + String maxProductDisplayName = flattenParameterGroup.maxProductDisplayName(); + String genericValue = flattenParameterGroup.genericValue(); + String odatavalue = flattenParameterGroup.odatavalue(); SimpleProduct simpleBodyProduct = null; if (description != null || genericValue != null || odatavalue != null) { simpleBodyProduct = new SimpleProduct(); - simpleBodyProduct.setProductId(productId); - simpleBodyProduct.setDescription(description); - simpleBodyProduct.setMaxProductDisplayName(maxProductDisplayName); - simpleBodyProduct.setGenericValue(genericValue); - simpleBodyProduct.setOdatavalue(odatavalue); + simpleBodyProduct.withProductId(productId); + simpleBodyProduct.withDescription(description); + simpleBodyProduct.withMaxProductDisplayName(maxProductDisplayName); + simpleBodyProduct.withGenericValue(genericValue); + simpleBodyProduct.withOdatavalue(odatavalue); } Call call = service.putSimpleProductWithGrouping(name, simpleBodyProduct); final ServiceCall serviceCall = new ServiceCall(call); @@ -896,7 +875,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putSimpleProductWithGroupingDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/implementation/package-info.java new file mode 100644 index 0000000000000..6d5d7702d606b --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestResourceFlatteningTestService. + * Resource Flattening for AutoRest. + */ +package fixtures.modelflattening.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/BaseProduct.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/BaseProduct.java index e320910239a69..256cfdd1c174e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/BaseProduct.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/BaseProduct.java @@ -35,7 +35,7 @@ public class BaseProduct { * * @return the productId value */ - public String getProductId() { + public String productId() { return this.productId; } @@ -43,9 +43,11 @@ public String getProductId() { * Set the productId value. * * @param productId the productId value to set + * @return the BaseProduct object itself. */ - public void setProductId(String productId) { + public BaseProduct withProductId(String productId) { this.productId = productId; + return this; } /** @@ -53,7 +55,7 @@ public void setProductId(String productId) { * * @return the description value */ - public String getDescription() { + public String description() { return this.description; } @@ -61,9 +63,11 @@ public String getDescription() { * Set the description value. * * @param description the description value to set + * @return the BaseProduct object itself. */ - public void setDescription(String description) { + public BaseProduct withDescription(String description) { this.description = description; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/Error.java index f01dcb4afd015..87a5c19e10a79 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/Error.java @@ -35,7 +35,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -43,9 +43,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -53,7 +55,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -61,9 +63,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } /** @@ -71,7 +75,7 @@ public void setMessage(String message) { * * @return the parentError value */ - public Error getParentError() { + public Error parentError() { return this.parentError; } @@ -79,9 +83,11 @@ public Error getParentError() { * Set the parentError value. * * @param parentError the parentError value to set + * @return the Error object itself. */ - public void setParentError(Error parentError) { + public Error withParentError(Error parentError) { this.parentError = parentError; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/ErrorException.java index ae250d3203596..928945c69259c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.modelflattening.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/FlattenParameterGroup.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/FlattenParameterGroup.java index 342b622a71f03..a00aa52364294 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/FlattenParameterGroup.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/FlattenParameterGroup.java @@ -61,7 +61,7 @@ public class FlattenParameterGroup { * * @return the name value */ - public String getName() { + public String name() { return this.name; } @@ -69,9 +69,11 @@ public String getName() { * Set the name value. * * @param name the name value to set + * @return the FlattenParameterGroup object itself. */ - public void setName(String name) { + public FlattenParameterGroup withName(String name) { this.name = name; + return this; } /** @@ -79,7 +81,7 @@ public void setName(String name) { * * @return the productId value */ - public String getProductId() { + public String productId() { return this.productId; } @@ -87,9 +89,11 @@ public String getProductId() { * Set the productId value. * * @param productId the productId value to set + * @return the FlattenParameterGroup object itself. */ - public void setProductId(String productId) { + public FlattenParameterGroup withProductId(String productId) { this.productId = productId; + return this; } /** @@ -97,7 +101,7 @@ public void setProductId(String productId) { * * @return the description value */ - public String getDescription() { + public String description() { return this.description; } @@ -105,9 +109,11 @@ public String getDescription() { * Set the description value. * * @param description the description value to set + * @return the FlattenParameterGroup object itself. */ - public void setDescription(String description) { + public FlattenParameterGroup withDescription(String description) { this.description = description; + return this; } /** @@ -115,7 +121,7 @@ public void setDescription(String description) { * * @return the maxProductDisplayName value */ - public String getMaxProductDisplayName() { + public String maxProductDisplayName() { return this.maxProductDisplayName; } @@ -123,9 +129,11 @@ public String getMaxProductDisplayName() { * Set the maxProductDisplayName value. * * @param maxProductDisplayName the maxProductDisplayName value to set + * @return the FlattenParameterGroup object itself. */ - public void setMaxProductDisplayName(String maxProductDisplayName) { + public FlattenParameterGroup withMaxProductDisplayName(String maxProductDisplayName) { this.maxProductDisplayName = maxProductDisplayName; + return this; } /** @@ -133,7 +141,7 @@ public void setMaxProductDisplayName(String maxProductDisplayName) { * * @return the genericValue value */ - public String getGenericValue() { + public String genericValue() { return this.genericValue; } @@ -141,9 +149,11 @@ public String getGenericValue() { * Set the genericValue value. * * @param genericValue the genericValue value to set + * @return the FlattenParameterGroup object itself. */ - public void setGenericValue(String genericValue) { + public FlattenParameterGroup withGenericValue(String genericValue) { this.genericValue = genericValue; + return this; } /** @@ -151,7 +161,7 @@ public void setGenericValue(String genericValue) { * * @return the odatavalue value */ - public String getOdatavalue() { + public String odatavalue() { return this.odatavalue; } @@ -159,9 +169,11 @@ public String getOdatavalue() { * Set the odatavalue value. * * @param odatavalue the odatavalue value to set + * @return the FlattenParameterGroup object itself. */ - public void setOdatavalue(String odatavalue) { + public FlattenParameterGroup withOdatavalue(String odatavalue) { this.odatavalue = odatavalue; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/FlattenedProduct.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/FlattenedProduct.java index 7203d9da4fb17..dc4ad0b7176d6 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/FlattenedProduct.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/FlattenedProduct.java @@ -49,7 +49,7 @@ public class FlattenedProduct extends Resource { * * @return the pname value */ - public String getPname() { + public String pname() { return this.pname; } @@ -57,9 +57,11 @@ public String getPname() { * Set the pname value. * * @param pname the pname value to set + * @return the FlattenedProduct object itself. */ - public void setPname(String pname) { + public FlattenedProduct withPname(String pname) { this.pname = pname; + return this; } /** @@ -67,7 +69,7 @@ public void setPname(String pname) { * * @return the flattenedProductType value */ - public String getFlattenedProductType() { + public String flattenedProductType() { return this.flattenedProductType; } @@ -75,9 +77,11 @@ public String getFlattenedProductType() { * Set the flattenedProductType value. * * @param flattenedProductType the flattenedProductType value to set + * @return the FlattenedProduct object itself. */ - public void setFlattenedProductType(String flattenedProductType) { + public FlattenedProduct withFlattenedProductType(String flattenedProductType) { this.flattenedProductType = flattenedProductType; + return this; } /** @@ -85,7 +89,7 @@ public void setFlattenedProductType(String flattenedProductType) { * * @return the provisioningStateValues value */ - public String getProvisioningStateValues() { + public String provisioningStateValues() { return this.provisioningStateValues; } @@ -94,7 +98,7 @@ public String getProvisioningStateValues() { * * @return the provisioningState value */ - public String getProvisioningState() { + public String provisioningState() { return this.provisioningState; } @@ -102,9 +106,11 @@ public String getProvisioningState() { * Set the provisioningState value. * * @param provisioningState the provisioningState value to set + * @return the FlattenedProduct object itself. */ - public void setProvisioningState(String provisioningState) { + public FlattenedProduct withProvisioningState(String provisioningState) { this.provisioningState = provisioningState; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/GenericUrl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/GenericUrl.java index b5247b4e2b157..e35a80376638a 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/GenericUrl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/GenericUrl.java @@ -27,7 +27,7 @@ public class GenericUrl { * * @return the genericValue value */ - public String getGenericValue() { + public String genericValue() { return this.genericValue; } @@ -35,9 +35,11 @@ public String getGenericValue() { * Set the genericValue value. * * @param genericValue the genericValue value to set + * @return the GenericUrl object itself. */ - public void setGenericValue(String genericValue) { + public GenericUrl withGenericValue(String genericValue) { this.genericValue = genericValue; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/Resource.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/Resource.java index b838cc58de139..59403d1895f73 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/Resource.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/Resource.java @@ -50,7 +50,7 @@ public class Resource { * * @return the id value */ - public String getId() { + public String id() { return this.id; } @@ -59,7 +59,7 @@ public String getId() { * * @return the type value */ - public String getType() { + public String type() { return this.type; } @@ -68,7 +68,7 @@ public String getType() { * * @return the tags value */ - public Map getTags() { + public Map tags() { return this.tags; } @@ -76,9 +76,11 @@ public Map getTags() { * Set the tags value. * * @param tags the tags value to set + * @return the Resource object itself. */ - public void setTags(Map tags) { + public Resource withTags(Map tags) { this.tags = tags; + return this; } /** @@ -86,7 +88,7 @@ public void setTags(Map tags) { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -94,9 +96,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the Resource object itself. */ - public void setLocation(String location) { + public Resource withLocation(String location) { this.location = location; + return this; } /** @@ -104,7 +108,7 @@ public void setLocation(String location) { * * @return the name value */ - public String getName() { + public String name() { return this.name; } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/ResourceCollection.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/ResourceCollection.java index 4c34485e3896a..95a39bb7e9569 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/ResourceCollection.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/ResourceCollection.java @@ -37,7 +37,7 @@ public class ResourceCollection { * * @return the productresource value */ - public FlattenedProduct getProductresource() { + public FlattenedProduct productresource() { return this.productresource; } @@ -45,9 +45,11 @@ public FlattenedProduct getProductresource() { * Set the productresource value. * * @param productresource the productresource value to set + * @return the ResourceCollection object itself. */ - public void setProductresource(FlattenedProduct productresource) { + public ResourceCollection withProductresource(FlattenedProduct productresource) { this.productresource = productresource; + return this; } /** @@ -55,7 +57,7 @@ public void setProductresource(FlattenedProduct productresource) { * * @return the arrayofresources value */ - public List getArrayofresources() { + public List arrayofresources() { return this.arrayofresources; } @@ -63,9 +65,11 @@ public List getArrayofresources() { * Set the arrayofresources value. * * @param arrayofresources the arrayofresources value to set + * @return the ResourceCollection object itself. */ - public void setArrayofresources(List arrayofresources) { + public ResourceCollection withArrayofresources(List arrayofresources) { this.arrayofresources = arrayofresources; + return this; } /** @@ -73,7 +77,7 @@ public void setArrayofresources(List arrayofresources) { * * @return the dictionaryofresources value */ - public Map getDictionaryofresources() { + public Map dictionaryofresources() { return this.dictionaryofresources; } @@ -81,9 +85,11 @@ public Map getDictionaryofresources() { * Set the dictionaryofresources value. * * @param dictionaryofresources the dictionaryofresources value to set + * @return the ResourceCollection object itself. */ - public void setDictionaryofresources(Map dictionaryofresources) { + public ResourceCollection withDictionaryofresources(Map dictionaryofresources) { this.dictionaryofresources = dictionaryofresources; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/SimpleProduct.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/SimpleProduct.java index aad8d564f6c53..1075df8e33a26 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/SimpleProduct.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/SimpleProduct.java @@ -54,7 +54,7 @@ public SimpleProduct() { * * @return the maxProductDisplayName value */ - public String getMaxProductDisplayName() { + public String maxProductDisplayName() { return this.maxProductDisplayName; } @@ -62,9 +62,11 @@ public String getMaxProductDisplayName() { * Set the maxProductDisplayName value. * * @param maxProductDisplayName the maxProductDisplayName value to set + * @return the SimpleProduct object itself. */ - public void setMaxProductDisplayName(String maxProductDisplayName) { + public SimpleProduct withMaxProductDisplayName(String maxProductDisplayName) { this.maxProductDisplayName = maxProductDisplayName; + return this; } /** @@ -72,7 +74,7 @@ public void setMaxProductDisplayName(String maxProductDisplayName) { * * @return the capacity value */ - public String getCapacity() { + public String capacity() { return this.capacity; } @@ -80,9 +82,11 @@ public String getCapacity() { * Set the capacity value. * * @param capacity the capacity value to set + * @return the SimpleProduct object itself. */ - public void setCapacity(String capacity) { + public SimpleProduct withCapacity(String capacity) { this.capacity = capacity; + return this; } /** @@ -90,7 +94,7 @@ public void setCapacity(String capacity) { * * @return the genericValue value */ - public String getGenericValue() { + public String genericValue() { return this.genericValue; } @@ -98,9 +102,11 @@ public String getGenericValue() { * Set the genericValue value. * * @param genericValue the genericValue value to set + * @return the SimpleProduct object itself. */ - public void setGenericValue(String genericValue) { + public SimpleProduct withGenericValue(String genericValue) { this.genericValue = genericValue; + return this; } /** @@ -108,7 +114,7 @@ public void setGenericValue(String genericValue) { * * @return the odatavalue value */ - public String getOdatavalue() { + public String odatavalue() { return this.odatavalue; } @@ -116,9 +122,11 @@ public String getOdatavalue() { * Set the odatavalue value. * * @param odatavalue the odatavalue value to set + * @return the SimpleProduct object itself. */ - public void setOdatavalue(String odatavalue) { + public SimpleProduct withOdatavalue(String odatavalue) { this.odatavalue = odatavalue; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/package-info.java index d449596d60ffa..5fff1803d5e5a 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/modelflattening/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestResourceFlatteningTestService. + * This package contains the models classes for AutoRestResourceFlatteningTestService. * Resource Flattening for AutoRest. */ package fixtures.modelflattening.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AutoRestParameterFlattening.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AutoRestParameterFlattening.java index d781cd7778b93..d375e3eb1bb5b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AutoRestParameterFlattening.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AutoRestParameterFlattening.java @@ -10,49 +10,20 @@ package fixtures.parameterflattening; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestParameterFlattening class. */ public interface AutoRestParameterFlattening { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); + String DEFAULT_BASE_URL = "http://localhost"; /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. + * Gets the AvailabilitySets object to access its operations. + * @return the AvailabilitySets object. */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); - - /** - * Gets the AvailabilitySetsOperations object to access its operations. - * @return the AvailabilitySetsOperations object. - */ - AvailabilitySetsOperations getAvailabilitySetsOperations(); + AvailabilitySets availabilitySets(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AutoRestParameterFlatteningImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AutoRestParameterFlatteningImpl.java deleted file mode 100644 index 4142c4db12728..0000000000000 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AutoRestParameterFlatteningImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -package fixtures.parameterflattening; - -import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; - -/** - * Initializes a new instance of the AutoRestParameterFlattening class. - */ -public final class AutoRestParameterFlatteningImpl extends ServiceClient implements AutoRestParameterFlattening { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - - /** - * Gets the AvailabilitySetsOperations object to access its operations. - * @return the AvailabilitySetsOperations object. - */ - public AvailabilitySetsOperations getAvailabilitySetsOperations() { - return new AvailabilitySetsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Initializes an instance of AutoRestParameterFlattening client. - */ - public AutoRestParameterFlatteningImpl() { - this("http://localhost"); - } - - /** - * Initializes an instance of AutoRestParameterFlattening client. - * - * @param baseUrl the base URL of the host - */ - public AutoRestParameterFlatteningImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - /** - * Initializes an instance of AutoRestParameterFlattening client. - * - * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} - */ - public AutoRestParameterFlatteningImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); - } -} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AvailabilitySetsOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AvailabilitySets.java similarity index 96% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AvailabilitySetsOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AvailabilitySets.java index 9666d49285322..50f43b3f8014d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AvailabilitySetsOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AvailabilitySets.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in AvailabilitySetsOperations. + * in AvailabilitySets. */ -public interface AvailabilitySetsOperations { +public interface AvailabilitySets { /** * Updates the tags for an availability set. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/implementation/AutoRestParameterFlatteningImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/implementation/AutoRestParameterFlatteningImpl.java new file mode 100644 index 0000000000000..64a7bb7600dad --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/implementation/AutoRestParameterFlatteningImpl.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.parameterflattening.implementation; + +import fixtures.parameterflattening.AutoRestParameterFlattening; +import fixtures.parameterflattening.AvailabilitySets; +import com.microsoft.rest.ServiceClient; +import okhttp3.OkHttpClient; +import retrofit2.Retrofit; + +/** + * Initializes a new instance of the AutoRestParameterFlattening class. + */ +public final class AutoRestParameterFlatteningImpl extends ServiceClient implements AutoRestParameterFlattening { + + /** + * The AvailabilitySets object to access its operations. + */ + private AvailabilitySets availabilitySets; + + /** + * Gets the AvailabilitySets object to access its operations. + * @return the AvailabilitySets object. + */ + public AvailabilitySets availabilitySets() { + return this.availabilitySets; + } + + /** + * Initializes an instance of AutoRestParameterFlattening client. + */ + public AutoRestParameterFlatteningImpl() { + this("http://localhost"); + } + + /** + * Initializes an instance of AutoRestParameterFlattening client. + * + * @param baseUrl the base URL of the host + */ + public AutoRestParameterFlatteningImpl(String baseUrl) { + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestParameterFlattening client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestParameterFlatteningImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); + initialize(); + } + + /** + * Initializes an instance of AutoRestParameterFlattening client. + * + * @param baseUrl the base URL of the host + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestParameterFlatteningImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); + initialize(); + } + + private void initialize() { + this.availabilitySets = new AvailabilitySetsImpl(retrofit(), this); + } +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AvailabilitySetsOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/implementation/AvailabilitySetsImpl.java similarity index 92% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AvailabilitySetsOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/implementation/AvailabilitySetsImpl.java index 4ccdf9e8fdcf0..ec80fc475f573 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/AvailabilitySetsOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/implementation/AvailabilitySetsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.parameterflattening; +package fixtures.parameterflattening.implementation; +import retrofit2.Retrofit; +import fixtures.parameterflattening.AvailabilitySets; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -28,31 +30,30 @@ import retrofit2.http.PATCH; import retrofit2.http.Path; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in AvailabilitySetsOperations. + * in AvailabilitySets. */ -public final class AvailabilitySetsOperationsImpl implements AvailabilitySetsOperations { +public final class AvailabilitySetsImpl implements AvailabilitySets { /** The Retrofit service to perform REST calls. */ private AvailabilitySetsService service; /** The service client containing this operation class. */ - private AutoRestParameterFlattening client; + private AutoRestParameterFlatteningImpl client; /** - * Initializes an instance of AvailabilitySetsOperations. + * Initializes an instance of AvailabilitySets. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public AvailabilitySetsOperationsImpl(Retrofit retrofit, AutoRestParameterFlattening client) { + public AvailabilitySetsImpl(Retrofit retrofit, AutoRestParameterFlatteningImpl client) { this.service = retrofit.create(AvailabilitySetsService.class); this.client = client; } /** - * The interface defining all the services for AvailabilitySetsOperations to be + * The interface defining all the services for AvailabilitySets to be * used by Retrofit to perform actually REST calls. */ interface AvailabilitySetsService { @@ -85,7 +86,7 @@ public ServiceResponse update(String resourceGroupName, String avset, Map< } Validator.validate(tags); AvailabilitySetUpdateParameters tags1 = new AvailabilitySetUpdateParameters(); - tags1.setTags(tags); + tags1.withTags(tags); Call call = service.update(resourceGroupName, avset, tags1); return updateDelegate(call.execute()); } @@ -118,7 +119,7 @@ public ServiceCall updateAsync(String resourceGroupName, String avset, Map call = service.update(resourceGroupName, avset, tags1); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -135,7 +136,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse updateDelegate(Response response) throws ServiceException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/implementation/package-info.java new file mode 100644 index 0000000000000..15d8f9f282fdf --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestParameterFlattening. + * Resource Flattening for AutoRest. + */ +package fixtures.parameterflattening.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/models/AvailabilitySetUpdateParameters.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/models/AvailabilitySetUpdateParameters.java index caf27607d6a18..3a8f6e03e99ce 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/models/AvailabilitySetUpdateParameters.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/models/AvailabilitySetUpdateParameters.java @@ -29,7 +29,7 @@ public class AvailabilitySetUpdateParameters { * * @return the tags value */ - public Map getTags() { + public Map tags() { return this.tags; } @@ -37,9 +37,11 @@ public Map getTags() { * Set the tags value. * * @param tags the tags value to set + * @return the AvailabilitySetUpdateParameters object itself. */ - public void setTags(Map tags) { + public AvailabilitySetUpdateParameters withTags(Map tags) { this.tags = tags; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/models/package-info.java index e659c04fbab59..2b7fea927ed4c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/parameterflattening/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestParameterFlattening. + * This package contains the models classes for AutoRestParameterFlattening. * Resource Flattening for AutoRest. */ package fixtures.parameterflattening.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/AutoRestReportService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/AutoRestReportService.java index cb260631d3b8a..34425f64facaf 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/AutoRestReportService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/AutoRestReportService.java @@ -10,11 +10,6 @@ package fixtures.report; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -27,33 +22,9 @@ */ public interface AutoRestReportService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * The default base URL. */ - JacksonMapperAdapter getMapperAdapter(); + String DEFAULT_BASE_URL = "http://localhost"; /** * Get test coverage report. diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/AutoRestReportServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/implementation/AutoRestReportServiceImpl.java similarity index 75% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/AutoRestReportServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/implementation/AutoRestReportServiceImpl.java index 0c4e5eeadd915..872d7f5157ffd 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/AutoRestReportServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/implementation/AutoRestReportServiceImpl.java @@ -8,13 +8,12 @@ * regenerated. */ -package fixtures.report; +package fixtures.report.implementation; +import fixtures.report.AutoRestReportService; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; -import okhttp3.logging.HttpLoggingInterceptor.Level; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -38,19 +37,6 @@ public final class AutoRestReportServiceImpl extends ServiceClient implements Au * The Retrofit service to perform REST calls. */ private AutoRestReportServiceService service; - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } /** * Initializes an instance of AutoRestReportService client. @@ -65,8 +51,18 @@ public AutoRestReportServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestReportServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestReportService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestReportServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -74,37 +70,20 @@ public AutoRestReportServiceImpl(String baseUrl) { * Initializes an instance of AutoRestReportService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestReportServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestReportServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { initializeService(); } private void initializeService() { - service = this.retrofitBuilder.client(this.clientBuilder.build()) - .build() - .create(AutoRestReportServiceService.class); - } - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum - */ - @Override - public void setLogLevel(Level logLevel) { - super.setLogLevel(logLevel); - initializeService(); + service = retrofit().create(AutoRestReportServiceService.class); } /** @@ -157,7 +136,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse> getReportDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder, ErrorException>(this.getMapperAdapter()) + return new ServiceResponseBuilder, ErrorException>(this.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/implementation/package-info.java new file mode 100644 index 0000000000000..28ef73f76af1e --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestReportService. + * Test Infrastructure for AutoRest. + */ +package fixtures.report.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/Error.java index 6b92f9a48ce79..dc45855cf3ec0 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/ErrorException.java index 0193d37c8651a..577136285b057 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.report.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/package-info.java index 969fee9e09a3a..d64c93ef86057 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/report/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestReportService. + * This package contains the models classes for AutoRestReportService. * Test Infrastructure for AutoRest. */ package fixtures.report.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/AutoRestRequiredOptionalTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/AutoRestRequiredOptionalTestService.java index 90e50cd109c2d..5f99dacd3ebb9 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/AutoRestRequiredOptionalTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/AutoRestRequiredOptionalTestService.java @@ -10,97 +10,71 @@ package fixtures.requiredoptional; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestRequiredOptionalTestService class. */ public interface AutoRestRequiredOptionalTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * The default base URL. */ - JacksonMapperAdapter getMapperAdapter(); + String DEFAULT_BASE_URL = "http://localhost"; /** * Gets number of items to skip. * * @return the requiredGlobalPath value. */ - String getRequiredGlobalPath(); + String requiredGlobalPath(); /** * Sets number of items to skip. * * @param requiredGlobalPath the requiredGlobalPath value. + * @return the service client itself */ - void setRequiredGlobalPath(String requiredGlobalPath); + AutoRestRequiredOptionalTestService withRequiredGlobalPath(String requiredGlobalPath); /** * Gets number of items to skip. * * @return the requiredGlobalQuery value. */ - String getRequiredGlobalQuery(); + String requiredGlobalQuery(); /** * Sets number of items to skip. * * @param requiredGlobalQuery the requiredGlobalQuery value. + * @return the service client itself */ - void setRequiredGlobalQuery(String requiredGlobalQuery); + AutoRestRequiredOptionalTestService withRequiredGlobalQuery(String requiredGlobalQuery); /** * Gets number of items to skip. * * @return the optionalGlobalQuery value. */ - int getOptionalGlobalQuery(); + int optionalGlobalQuery(); /** * Sets number of items to skip. * * @param optionalGlobalQuery the optionalGlobalQuery value. + * @return the service client itself */ - void setOptionalGlobalQuery(int optionalGlobalQuery); + AutoRestRequiredOptionalTestService withOptionalGlobalQuery(int optionalGlobalQuery); /** - * Gets the ImplicitOperations object to access its operations. - * @return the ImplicitOperations object. + * Gets the Implicits object to access its operations. + * @return the Implicits object. */ - ImplicitOperations getImplicitOperations(); + Implicits implicits(); /** - * Gets the ExplicitOperations object to access its operations. - * @return the ExplicitOperations object. + * Gets the Explicits object to access its operations. + * @return the Explicits object. */ - ExplicitOperations getExplicitOperations(); + Explicits explicits(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ExplicitOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/Explicits.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ExplicitOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/Explicits.java index 41f964efbb32d..11eb0f7955c9c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ExplicitOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/Explicits.java @@ -29,9 +29,9 @@ /** * An instance of this class provides access to all the operations defined - * in ExplicitOperations. + * in Explicits. */ -public interface ExplicitOperations { +public interface Explicits { /** * Test explicitly required integer. Please put null and the client library should throw before the request is sent. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ImplicitOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/Implicits.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ImplicitOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/Implicits.java index 008fab393cd32..6e37ba2a9d2f4 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ImplicitOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/Implicits.java @@ -19,9 +19,9 @@ /** * An instance of this class provides access to all the operations defined - * in ImplicitOperations. + * in Implicits. */ -public interface ImplicitOperations { +public interface Implicits { /** * Test implicitly required path parameter. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/AutoRestRequiredOptionalTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/AutoRestRequiredOptionalTestServiceImpl.java similarity index 53% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/AutoRestRequiredOptionalTestServiceImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/AutoRestRequiredOptionalTestServiceImpl.java index 73182e710de44..564610208cf7b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/AutoRestRequiredOptionalTestServiceImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/AutoRestRequiredOptionalTestServiceImpl.java @@ -8,10 +8,12 @@ * regenerated. */ -package fixtures.requiredoptional; +package fixtures.requiredoptional.implementation; +import fixtures.requiredoptional.AutoRestRequiredOptionalTestService; +import fixtures.requiredoptional.Implicits; +import fixtures.requiredoptional.Explicits; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -19,19 +21,6 @@ * Initializes a new instance of the AutoRestRequiredOptionalTestService class. */ public final class AutoRestRequiredOptionalTestServiceImpl extends ServiceClient implements AutoRestRequiredOptionalTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } /** number of items to skip. */ private String requiredGlobalPath; @@ -41,7 +30,7 @@ public AutoRestBaseUrl getBaseUrl() { * * @return the requiredGlobalPath value. */ - public String getRequiredGlobalPath() { + public String requiredGlobalPath() { return this.requiredGlobalPath; } @@ -49,9 +38,11 @@ public String getRequiredGlobalPath() { * Sets number of items to skip. * * @param requiredGlobalPath the requiredGlobalPath value. + * @return the service client itself */ - public void setRequiredGlobalPath(String requiredGlobalPath) { + public AutoRestRequiredOptionalTestServiceImpl withRequiredGlobalPath(String requiredGlobalPath) { this.requiredGlobalPath = requiredGlobalPath; + return this; } /** number of items to skip. */ @@ -62,7 +53,7 @@ public void setRequiredGlobalPath(String requiredGlobalPath) { * * @return the requiredGlobalQuery value. */ - public String getRequiredGlobalQuery() { + public String requiredGlobalQuery() { return this.requiredGlobalQuery; } @@ -70,9 +61,11 @@ public String getRequiredGlobalQuery() { * Sets number of items to skip. * * @param requiredGlobalQuery the requiredGlobalQuery value. + * @return the service client itself */ - public void setRequiredGlobalQuery(String requiredGlobalQuery) { + public AutoRestRequiredOptionalTestServiceImpl withRequiredGlobalQuery(String requiredGlobalQuery) { this.requiredGlobalQuery = requiredGlobalQuery; + return this; } /** number of items to skip. */ @@ -83,7 +76,7 @@ public void setRequiredGlobalQuery(String requiredGlobalQuery) { * * @return the optionalGlobalQuery value. */ - public int getOptionalGlobalQuery() { + public int optionalGlobalQuery() { return this.optionalGlobalQuery; } @@ -91,25 +84,37 @@ public int getOptionalGlobalQuery() { * Sets number of items to skip. * * @param optionalGlobalQuery the optionalGlobalQuery value. + * @return the service client itself */ - public void setOptionalGlobalQuery(int optionalGlobalQuery) { + public AutoRestRequiredOptionalTestServiceImpl withOptionalGlobalQuery(int optionalGlobalQuery) { this.optionalGlobalQuery = optionalGlobalQuery; + return this; } /** - * Gets the ImplicitOperations object to access its operations. - * @return the ImplicitOperations object. + * The Implicits object to access its operations. + */ + private Implicits implicits; + + /** + * Gets the Implicits object to access its operations. + * @return the Implicits object. */ - public ImplicitOperations getImplicitOperations() { - return new ImplicitOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Implicits implicits() { + return this.implicits; } /** - * Gets the ExplicitOperations object to access its operations. - * @return the ExplicitOperations object. + * The Explicits object to access its operations. */ - public ExplicitOperations getExplicitOperations() { - return new ExplicitOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + private Explicits explicits; + + /** + * Gets the Explicits object to access its operations. + * @return the Explicits object. + */ + public Explicits explicits() { + return this.explicits; } /** @@ -125,8 +130,18 @@ public AutoRestRequiredOptionalTestServiceImpl() { * @param baseUrl the base URL of the host */ public AutoRestRequiredOptionalTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestRequiredOptionalTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestRequiredOptionalTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -134,18 +149,16 @@ public AutoRestRequiredOptionalTestServiceImpl(String baseUrl) { * Initializes an instance of AutoRestRequiredOptionalTestService client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestRequiredOptionalTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestRequiredOptionalTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { + this.implicits = new ImplicitsImpl(retrofit(), this); + this.explicits = new ExplicitsImpl(retrofit(), this); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ExplicitOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/ExplicitsImpl.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ExplicitOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/ExplicitsImpl.java index e0b711b87ac9d..f6b5a3ac13f8d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ExplicitOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/ExplicitsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.requiredoptional; +package fixtures.requiredoptional.implementation; +import retrofit2.Retrofit; +import fixtures.requiredoptional.Explicits; import com.google.common.reflect.TypeToken; import com.microsoft.rest.serializer.CollectionFormat; import com.microsoft.rest.ServiceCall; @@ -38,34 +40,33 @@ import retrofit2.http.Headers; import retrofit2.http.POST; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in ExplicitOperations. + * in Explicits. */ -public final class ExplicitOperationsImpl implements ExplicitOperations { +public final class ExplicitsImpl implements Explicits { /** The Retrofit service to perform REST calls. */ - private ExplicitService service; + private ExplicitsService service; /** The service client containing this operation class. */ - private AutoRestRequiredOptionalTestService client; + private AutoRestRequiredOptionalTestServiceImpl client; /** - * Initializes an instance of ExplicitOperations. + * Initializes an instance of Explicits. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ExplicitOperationsImpl(Retrofit retrofit, AutoRestRequiredOptionalTestService client) { - this.service = retrofit.create(ExplicitService.class); + public ExplicitsImpl(Retrofit retrofit, AutoRestRequiredOptionalTestServiceImpl client) { + this.service = retrofit.create(ExplicitsService.class); this.client = client; } /** - * The interface defining all the services for ExplicitOperations to be + * The interface defining all the services for Explicits to be * used by Retrofit to perform actually REST calls. */ - interface ExplicitService { + interface ExplicitsService { @Headers("Content-Type: application/json; charset=utf-8") @POST("reqopt/requied/integer/parameter") Call postRequiredIntegerParameter(@Body int bodyParameter); @@ -197,7 +198,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredIntegerParameterDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -283,7 +284,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalIntegerParameterDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -340,7 +341,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredIntegerPropertyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -428,7 +429,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalIntegerPropertyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -475,7 +476,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredIntegerHeaderDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -561,7 +562,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalIntegerHeaderDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -616,7 +617,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredStringParameterDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -702,7 +703,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalStringParameterDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -759,7 +760,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredStringPropertyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -847,7 +848,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalStringPropertyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -902,7 +903,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredStringHeaderDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -988,7 +989,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalStringHeaderDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1045,7 +1046,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredClassParameterDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1133,7 +1134,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalClassParameterDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1190,7 +1191,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredClassPropertyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1278,7 +1279,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalClassPropertyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1335,7 +1336,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredArrayParameterDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1423,7 +1424,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalArrayParameterDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1480,7 +1481,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredArrayPropertyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1568,7 +1569,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalArrayPropertyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1588,7 +1589,7 @@ public ServiceResponse postRequiredArrayHeader(List headerParamet throw new IllegalArgumentException("Parameter headerParameter is required and cannot be null."); } Validator.validate(headerParameter); - String headerParameterConverted = this.client.getMapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); + String headerParameterConverted = this.client.mapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); Call call = service.postRequiredArrayHeader(headerParameterConverted); return postRequiredArrayHeaderDelegate(call.execute()); } @@ -1610,7 +1611,7 @@ public ServiceCall postRequiredArrayHeaderAsync(List headerParameter, fi return null; } Validator.validate(headerParameter, serviceCallback); - String headerParameterConverted = this.client.getMapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); + String headerParameterConverted = this.client.mapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); Call call = service.postRequiredArrayHeader(headerParameterConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -1627,7 +1628,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postRequiredArrayHeaderDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -1640,7 +1641,8 @@ private ServiceResponse postRequiredArrayHeaderDelegate(Response postOptionalArrayHeader() throws ErrorException, IOException { - final String headerParameterConverted = null; + final List headerParameter = null; + String headerParameterConverted = this.client.mapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); Call call = service.postOptionalArrayHeader(headerParameterConverted); return postOptionalArrayHeaderDelegate(call.execute()); } @@ -1656,7 +1658,8 @@ public ServiceCall postOptionalArrayHeaderAsync(final ServiceCallback serv if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final String headerParameterConverted = null; + final List headerParameter = null; + String headerParameterConverted = this.client.mapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); Call call = service.postOptionalArrayHeader(headerParameterConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -1682,7 +1685,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse postOptionalArrayHeader(List headerParameter) throws ErrorException, IOException { Validator.validate(headerParameter); - String headerParameterConverted = this.client.getMapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); + String headerParameterConverted = this.client.mapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); Call call = service.postOptionalArrayHeader(headerParameterConverted); return postOptionalArrayHeaderDelegate(call.execute()); } @@ -1700,7 +1703,7 @@ public ServiceCall postOptionalArrayHeaderAsync(List headerParameter, fi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(headerParameter, serviceCallback); - String headerParameterConverted = this.client.getMapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); + String headerParameterConverted = this.client.mapperAdapter().serializeList(headerParameter, CollectionFormat.CSV); Call call = service.postOptionalArrayHeader(headerParameterConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -1717,7 +1720,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postOptionalArrayHeaderDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ImplicitOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/ImplicitsImpl.java similarity index 93% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ImplicitOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/ImplicitsImpl.java index 4b8c4626cc9f5..8510d8fcd864e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ImplicitOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/ImplicitsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.requiredoptional; +package fixtures.requiredoptional.implementation; +import retrofit2.Retrofit; +import fixtures.requiredoptional.Implicits; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -29,34 +31,33 @@ import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in ImplicitOperations. + * in Implicits. */ -public final class ImplicitOperationsImpl implements ImplicitOperations { +public final class ImplicitsImpl implements Implicits { /** The Retrofit service to perform REST calls. */ - private ImplicitService service; + private ImplicitsService service; /** The service client containing this operation class. */ - private AutoRestRequiredOptionalTestService client; + private AutoRestRequiredOptionalTestServiceImpl client; /** - * Initializes an instance of ImplicitOperations. + * Initializes an instance of Implicits. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public ImplicitOperationsImpl(Retrofit retrofit, AutoRestRequiredOptionalTestService client) { - this.service = retrofit.create(ImplicitService.class); + public ImplicitsImpl(Retrofit retrofit, AutoRestRequiredOptionalTestServiceImpl client) { + this.service = retrofit.create(ImplicitsService.class); this.client = client; } /** - * The interface defining all the services for ImplicitOperations to be + * The interface defining all the services for Implicits to be * used by Retrofit to perform actually REST calls. */ - interface ImplicitService { + interface ImplicitsService { @Headers("Content-Type: application/json; charset=utf-8") @GET("reqopt/implicit/required/path/{pathParameter}") Call getRequiredPath(@Path("pathParameter") String pathParameter); @@ -136,7 +137,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getRequiredPathDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -222,7 +223,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putOptionalQueryDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -309,7 +310,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putOptionalHeaderDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -396,7 +397,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse putOptionalBodyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -411,10 +412,10 @@ private ServiceResponse putOptionalBodyDelegate(Response res * @return the Error object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse getRequiredGlobalPath() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getRequiredGlobalPath() == null) { - throw new IllegalArgumentException("Parameter this.client.getRequiredGlobalPath() is required and cannot be null."); + if (this.client.requiredGlobalPath() == null) { + throw new IllegalArgumentException("Parameter this.client.requiredGlobalPath() is required and cannot be null."); } - Call call = service.getRequiredGlobalPath(this.client.getRequiredGlobalPath()); + Call call = service.getRequiredGlobalPath(this.client.requiredGlobalPath()); return getRequiredGlobalPathDelegate(call.execute()); } @@ -429,11 +430,11 @@ public ServiceCall getRequiredGlobalPathAsync(final ServiceCallback servi if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getRequiredGlobalPath() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getRequiredGlobalPath() is required and cannot be null.")); + if (this.client.requiredGlobalPath() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.requiredGlobalPath() is required and cannot be null.")); return null; } - Call call = service.getRequiredGlobalPath(this.client.getRequiredGlobalPath()); + Call call = service.getRequiredGlobalPath(this.client.requiredGlobalPath()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -449,7 +450,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getRequiredGlobalPathDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -463,10 +464,10 @@ private ServiceResponse getRequiredGlobalPathDelegate(Response getRequiredGlobalQuery() throws ErrorException, IOException, IllegalArgumentException { - if (this.client.getRequiredGlobalQuery() == null) { - throw new IllegalArgumentException("Parameter this.client.getRequiredGlobalQuery() is required and cannot be null."); + if (this.client.requiredGlobalQuery() == null) { + throw new IllegalArgumentException("Parameter this.client.requiredGlobalQuery() is required and cannot be null."); } - Call call = service.getRequiredGlobalQuery(this.client.getRequiredGlobalQuery()); + Call call = service.getRequiredGlobalQuery(this.client.requiredGlobalQuery()); return getRequiredGlobalQueryDelegate(call.execute()); } @@ -481,11 +482,11 @@ public ServiceCall getRequiredGlobalQueryAsync(final ServiceCallback serv if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.client.getRequiredGlobalQuery() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getRequiredGlobalQuery() is required and cannot be null.")); + if (this.client.requiredGlobalQuery() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.requiredGlobalQuery() is required and cannot be null.")); return null; } - Call call = service.getRequiredGlobalQuery(this.client.getRequiredGlobalQuery()); + Call call = service.getRequiredGlobalQuery(this.client.requiredGlobalQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -501,7 +502,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getRequiredGlobalQueryDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } @@ -514,7 +515,7 @@ private ServiceResponse getRequiredGlobalQueryDelegate(Response getOptionalGlobalQuery() throws ErrorException, IOException { - Call call = service.getOptionalGlobalQuery(this.client.getOptionalGlobalQuery()); + Call call = service.getOptionalGlobalQuery(this.client.optionalGlobalQuery()); return getOptionalGlobalQueryDelegate(call.execute()); } @@ -529,7 +530,7 @@ public ServiceCall getOptionalGlobalQueryAsync(final ServiceCallback serv if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - Call call = service.getOptionalGlobalQuery(this.client.getOptionalGlobalQuery()); + Call call = service.getOptionalGlobalQuery(this.client.optionalGlobalQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -545,7 +546,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getOptionalGlobalQueryDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/package-info.java new file mode 100644 index 0000000000000..e3adef46ea336 --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestRequiredOptionalTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.requiredoptional.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ArrayOptionalWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ArrayOptionalWrapper.java index 8cecceb9a8ab8..9900dd3dfc77e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ArrayOptionalWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ArrayOptionalWrapper.java @@ -26,7 +26,7 @@ public class ArrayOptionalWrapper { * * @return the value value */ - public List getValue() { + public List value() { return this.value; } @@ -34,9 +34,11 @@ public List getValue() { * Set the value value. * * @param value the value value to set + * @return the ArrayOptionalWrapper object itself. */ - public void setValue(List value) { + public ArrayOptionalWrapper withValue(List value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ArrayWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ArrayWrapper.java index 8f85e7da24ecb..1c39708ce1bda 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ArrayWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ArrayWrapper.java @@ -28,7 +28,7 @@ public class ArrayWrapper { * * @return the value value */ - public List getValue() { + public List value() { return this.value; } @@ -36,9 +36,11 @@ public List getValue() { * Set the value value. * * @param value the value value to set + * @return the ArrayWrapper object itself. */ - public void setValue(List value) { + public ArrayWrapper withValue(List value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ClassOptionalWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ClassOptionalWrapper.java index ff862fb517f2b..1a3ce95fa8323 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ClassOptionalWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ClassOptionalWrapper.java @@ -25,7 +25,7 @@ public class ClassOptionalWrapper { * * @return the value value */ - public Product getValue() { + public Product value() { return this.value; } @@ -33,9 +33,11 @@ public Product getValue() { * Set the value value. * * @param value the value value to set + * @return the ClassOptionalWrapper object itself. */ - public void setValue(Product value) { + public ClassOptionalWrapper withValue(Product value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ClassWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ClassWrapper.java index f8f70716bb406..2c7470d65e9e4 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ClassWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ClassWrapper.java @@ -27,7 +27,7 @@ public class ClassWrapper { * * @return the value value */ - public Product getValue() { + public Product value() { return this.value; } @@ -35,9 +35,11 @@ public Product getValue() { * Set the value value. * * @param value the value value to set + * @return the ClassWrapper object itself. */ - public void setValue(Product value) { + public ClassWrapper withValue(Product value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/Error.java index 93588ec1c6098..a1bcdaf37af98 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ErrorException.java index cc616e00b3660..ac3515967d457 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.requiredoptional.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/IntOptionalWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/IntOptionalWrapper.java index bdda86c9bef3d..b662fe2b1d6b7 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/IntOptionalWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/IntOptionalWrapper.java @@ -25,7 +25,7 @@ public class IntOptionalWrapper { * * @return the value value */ - public Integer getValue() { + public Integer value() { return this.value; } @@ -33,9 +33,11 @@ public Integer getValue() { * Set the value value. * * @param value the value value to set + * @return the IntOptionalWrapper object itself. */ - public void setValue(Integer value) { + public IntOptionalWrapper withValue(Integer value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/IntWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/IntWrapper.java index 1c87dff282c63..5aa0048564b81 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/IntWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/IntWrapper.java @@ -27,7 +27,7 @@ public class IntWrapper { * * @return the value value */ - public int getValue() { + public int value() { return this.value; } @@ -35,9 +35,11 @@ public int getValue() { * Set the value value. * * @param value the value value to set + * @return the IntWrapper object itself. */ - public void setValue(int value) { + public IntWrapper withValue(int value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/Product.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/Product.java index 224bd646a4625..5a61971bd317b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/Product.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/Product.java @@ -32,7 +32,7 @@ public class Product { * * @return the id value */ - public int getId() { + public int id() { return this.id; } @@ -40,9 +40,11 @@ public int getId() { * Set the id value. * * @param id the id value to set + * @return the Product object itself. */ - public void setId(int id) { + public Product withId(int id) { this.id = id; + return this; } /** @@ -50,7 +52,7 @@ public void setId(int id) { * * @return the name value */ - public String getName() { + public String name() { return this.name; } @@ -58,9 +60,11 @@ public String getName() { * Set the name value. * * @param name the name value to set + * @return the Product object itself. */ - public void setName(String name) { + public Product withName(String name) { this.name = name; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/StringOptionalWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/StringOptionalWrapper.java index b905fcb5cc95e..008de25fe0112 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/StringOptionalWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/StringOptionalWrapper.java @@ -25,7 +25,7 @@ public class StringOptionalWrapper { * * @return the value value */ - public String getValue() { + public String value() { return this.value; } @@ -33,9 +33,11 @@ public String getValue() { * Set the value value. * * @param value the value value to set + * @return the StringOptionalWrapper object itself. */ - public void setValue(String value) { + public StringOptionalWrapper withValue(String value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/StringWrapper.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/StringWrapper.java index 05e190f4483dd..9dfd59f1229c8 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/StringWrapper.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/StringWrapper.java @@ -27,7 +27,7 @@ public class StringWrapper { * * @return the value value */ - public String getValue() { + public String value() { return this.value; } @@ -35,9 +35,11 @@ public String getValue() { * Set the value value. * * @param value the value value to set + * @return the StringWrapper object itself. */ - public void setValue(String value) { + public StringWrapper withValue(String value) { this.value = value; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/package-info.java index 38e27c6008ec5..635733981a86c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestRequiredOptionalTestService. + * This package contains the models classes for AutoRestRequiredOptionalTestService. * Test Infrastructure for AutoRest. */ package fixtures.requiredoptional.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/AutoRestUrlTestService.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/AutoRestUrlTestService.java index 5162b3bbc8641..20a63600381a9 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/AutoRestUrlTestService.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/AutoRestUrlTestService.java @@ -10,89 +10,62 @@ package fixtures.url; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; /** * The interface for AutoRestUrlTestService class. */ public interface AutoRestUrlTestService { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * The default base URL. */ - JacksonMapperAdapter getMapperAdapter(); + String DEFAULT_BASE_URL = "http://localhost"; /** * Gets A string value 'globalItemStringPath' that appears in the path. * * @return the globalStringPath value. */ - String getGlobalStringPath(); + String globalStringPath(); /** * Sets A string value 'globalItemStringPath' that appears in the path. * * @param globalStringPath the globalStringPath value. + * @return the service client itself */ - void setGlobalStringPath(String globalStringPath); + AutoRestUrlTestService withGlobalStringPath(String globalStringPath); /** * Gets should contain value null. * * @return the globalStringQuery value. */ - String getGlobalStringQuery(); + String globalStringQuery(); /** * Sets should contain value null. * * @param globalStringQuery the globalStringQuery value. + * @return the service client itself */ - void setGlobalStringQuery(String globalStringQuery); + AutoRestUrlTestService withGlobalStringQuery(String globalStringQuery); /** - * Gets the PathsOperations object to access its operations. - * @return the PathsOperations object. + * Gets the Paths object to access its operations. + * @return the Paths object. */ - PathsOperations getPathsOperations(); + Paths paths(); /** - * Gets the QueriesOperations object to access its operations. - * @return the QueriesOperations object. + * Gets the Queries object to access its operations. + * @return the Queries object. */ - QueriesOperations getQueriesOperations(); + Queries queries(); /** - * Gets the PathItemsOperations object to access its operations. - * @return the PathItemsOperations object. + * Gets the PathItems object to access its operations. + * @return the PathItems object. */ - PathItemsOperations getPathItemsOperations(); + PathItems pathItems(); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/AutoRestUrlTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/AutoRestUrlTestServiceImpl.java deleted file mode 100644 index ba33b3c4af111..0000000000000 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/AutoRestUrlTestServiceImpl.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -package fixtures.url; - -import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; -import okhttp3.OkHttpClient; -import retrofit2.Retrofit; - -/** - * Initializes a new instance of the AutoRestUrlTestService class. - */ -public final class AutoRestUrlTestServiceImpl extends ServiceClient implements AutoRestUrlTestService { - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } - - /** A string value 'globalItemStringPath' that appears in the path. */ - private String globalStringPath; - - /** - * Gets A string value 'globalItemStringPath' that appears in the path. - * - * @return the globalStringPath value. - */ - public String getGlobalStringPath() { - return this.globalStringPath; - } - - /** - * Sets A string value 'globalItemStringPath' that appears in the path. - * - * @param globalStringPath the globalStringPath value. - */ - public void setGlobalStringPath(String globalStringPath) { - this.globalStringPath = globalStringPath; - } - - /** should contain value null. */ - private String globalStringQuery; - - /** - * Gets should contain value null. - * - * @return the globalStringQuery value. - */ - public String getGlobalStringQuery() { - return this.globalStringQuery; - } - - /** - * Sets should contain value null. - * - * @param globalStringQuery the globalStringQuery value. - */ - public void setGlobalStringQuery(String globalStringQuery) { - this.globalStringQuery = globalStringQuery; - } - - /** - * Gets the PathsOperations object to access its operations. - * @return the PathsOperations object. - */ - public PathsOperations getPathsOperations() { - return new PathsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the QueriesOperations object to access its operations. - * @return the QueriesOperations object. - */ - public QueriesOperations getQueriesOperations() { - return new QueriesOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Gets the PathItemsOperations object to access its operations. - * @return the PathItemsOperations object. - */ - public PathItemsOperations getPathItemsOperations() { - return new PathItemsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); - } - - /** - * Initializes an instance of AutoRestUrlTestService client. - */ - public AutoRestUrlTestServiceImpl() { - this("http://localhost"); - } - - /** - * Initializes an instance of AutoRestUrlTestService client. - * - * @param baseUrl the base URL of the host - */ - public AutoRestUrlTestServiceImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - /** - * Initializes an instance of AutoRestUrlTestService client. - * - * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} - */ - public AutoRestUrlTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); - initialize(); - } - - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); - } -} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathItemsOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathItems.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathItemsOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathItems.java index 27c19d7865bba..16dac6f700dbb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathItemsOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathItems.java @@ -18,9 +18,9 @@ /** * An instance of this class provides access to all the operations defined - * in PathItemsOperations. + * in PathItems. */ -public interface PathItemsOperations { +public interface PathItems { /** * send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery'. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/Paths.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/Paths.java index 1ccd08f952b57..1d714c57531cc 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/Paths.java @@ -22,9 +22,9 @@ /** * An instance of this class provides access to all the operations defined - * in PathsOperations. + * in Paths. */ -public interface PathsOperations { +public interface Paths { /** * Get true Boolean value on path. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/QueriesOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/Queries.java similarity index 99% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/QueriesOperations.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/Queries.java index 75bf5a1b1ef5c..80dfbd09109eb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/QueriesOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/Queries.java @@ -22,9 +22,9 @@ /** * An instance of this class provides access to all the operations defined - * in QueriesOperations. + * in Queries. */ -public interface QueriesOperations { +public interface Queries { /** * Get true Boolean value on path. * diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/AutoRestUrlTestServiceImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/AutoRestUrlTestServiceImpl.java new file mode 100644 index 0000000000000..195b1d95c3c4c --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/AutoRestUrlTestServiceImpl.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +package fixtures.url.implementation; + +import fixtures.url.AutoRestUrlTestService; +import fixtures.url.Paths; +import fixtures.url.Queries; +import fixtures.url.PathItems; +import com.microsoft.rest.ServiceClient; +import okhttp3.OkHttpClient; +import retrofit2.Retrofit; + +/** + * Initializes a new instance of the AutoRestUrlTestService class. + */ +public final class AutoRestUrlTestServiceImpl extends ServiceClient implements AutoRestUrlTestService { + + /** A string value 'globalItemStringPath' that appears in the path. */ + private String globalStringPath; + + /** + * Gets A string value 'globalItemStringPath' that appears in the path. + * + * @return the globalStringPath value. + */ + public String globalStringPath() { + return this.globalStringPath; + } + + /** + * Sets A string value 'globalItemStringPath' that appears in the path. + * + * @param globalStringPath the globalStringPath value. + * @return the service client itself + */ + public AutoRestUrlTestServiceImpl withGlobalStringPath(String globalStringPath) { + this.globalStringPath = globalStringPath; + return this; + } + + /** should contain value null. */ + private String globalStringQuery; + + /** + * Gets should contain value null. + * + * @return the globalStringQuery value. + */ + public String globalStringQuery() { + return this.globalStringQuery; + } + + /** + * Sets should contain value null. + * + * @param globalStringQuery the globalStringQuery value. + * @return the service client itself + */ + public AutoRestUrlTestServiceImpl withGlobalStringQuery(String globalStringQuery) { + this.globalStringQuery = globalStringQuery; + return this; + } + + /** + * The Paths object to access its operations. + */ + private Paths paths; + + /** + * Gets the Paths object to access its operations. + * @return the Paths object. + */ + public Paths paths() { + return this.paths; + } + + /** + * The Queries object to access its operations. + */ + private Queries queries; + + /** + * Gets the Queries object to access its operations. + * @return the Queries object. + */ + public Queries queries() { + return this.queries; + } + + /** + * The PathItems object to access its operations. + */ + private PathItems pathItems; + + /** + * Gets the PathItems object to access its operations. + * @return the PathItems object. + */ + public PathItems pathItems() { + return this.pathItems; + } + + /** + * Initializes an instance of AutoRestUrlTestService client. + */ + public AutoRestUrlTestServiceImpl() { + this("http://localhost"); + } + + /** + * Initializes an instance of AutoRestUrlTestService client. + * + * @param baseUrl the base URL of the host + */ + public AutoRestUrlTestServiceImpl(String baseUrl) { + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestUrlTestService client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestUrlTestServiceImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); + initialize(); + } + + /** + * Initializes an instance of AutoRestUrlTestService client. + * + * @param baseUrl the base URL of the host + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestUrlTestServiceImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); + initialize(); + } + + private void initialize() { + this.paths = new PathsImpl(retrofit(), this); + this.queries = new QueriesImpl(retrofit(), this); + this.pathItems = new PathItemsImpl(retrofit(), this); + } +} diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathItemsOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/PathItemsImpl.java similarity index 87% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathItemsOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/PathItemsImpl.java index c7085c350749f..fc6caa4f65da8 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathItemsOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/PathItemsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.url; +package fixtures.url.implementation; +import retrofit2.Retrofit; +import fixtures.url.PathItems; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -25,31 +27,30 @@ import retrofit2.http.Path; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in PathItemsOperations. + * in PathItems. */ -public final class PathItemsOperationsImpl implements PathItemsOperations { +public final class PathItemsImpl implements PathItems { /** The Retrofit service to perform REST calls. */ private PathItemsService service; /** The service client containing this operation class. */ - private AutoRestUrlTestService client; + private AutoRestUrlTestServiceImpl client; /** - * Initializes an instance of PathItemsOperations. + * Initializes an instance of PathItems. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PathItemsOperationsImpl(Retrofit retrofit, AutoRestUrlTestService client) { + public PathItemsImpl(Retrofit retrofit, AutoRestUrlTestServiceImpl client) { this.service = retrofit.create(PathItemsService.class); this.client = client; } /** - * The interface defining all the services for PathItemsOperations to be + * The interface defining all the services for PathItems to be * used by Retrofit to perform actually REST calls. */ interface PathItemsService { @@ -88,12 +89,12 @@ public ServiceResponse getAllWithValues(String localStringPath, String pat if (pathItemStringPath == null) { throw new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null."); } - if (this.client.getGlobalStringPath() == null) { - throw new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null."); + if (this.client.globalStringPath() == null) { + throw new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null."); } final String localStringQuery = null; final String pathItemStringQuery = null; - Call call = service.getAllWithValues(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getAllWithValues(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); return getAllWithValuesDelegate(call.execute()); } @@ -118,13 +119,13 @@ public ServiceCall getAllWithValuesAsync(String localStringPath, String pathItem serviceCallback.failure(new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null.")); return null; } - if (this.client.getGlobalStringPath() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null.")); + if (this.client.globalStringPath() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null.")); return null; } final String localStringQuery = null; final String pathItemStringQuery = null; - Call call = service.getAllWithValues(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getAllWithValues(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -158,10 +159,10 @@ public ServiceResponse getAllWithValues(String localStringPath, String pat if (pathItemStringPath == null) { throw new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null."); } - if (this.client.getGlobalStringPath() == null) { - throw new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null."); + if (this.client.globalStringPath() == null) { + throw new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null."); } - Call call = service.getAllWithValues(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getAllWithValues(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); return getAllWithValuesDelegate(call.execute()); } @@ -188,11 +189,11 @@ public ServiceCall getAllWithValuesAsync(String localStringPath, String pathItem serviceCallback.failure(new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null.")); return null; } - if (this.client.getGlobalStringPath() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null.")); + if (this.client.globalStringPath() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null.")); return null; } - Call call = service.getAllWithValues(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getAllWithValues(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -208,7 +209,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getAllWithValuesDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -231,12 +232,12 @@ public ServiceResponse getGlobalQueryNull(String localStringPath, String p if (pathItemStringPath == null) { throw new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null."); } - if (this.client.getGlobalStringPath() == null) { - throw new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null."); + if (this.client.globalStringPath() == null) { + throw new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null."); } final String localStringQuery = null; final String pathItemStringQuery = null; - Call call = service.getGlobalQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getGlobalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); return getGlobalQueryNullDelegate(call.execute()); } @@ -261,13 +262,13 @@ public ServiceCall getGlobalQueryNullAsync(String localStringPath, String pathIt serviceCallback.failure(new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null.")); return null; } - if (this.client.getGlobalStringPath() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null.")); + if (this.client.globalStringPath() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null.")); return null; } final String localStringQuery = null; final String pathItemStringQuery = null; - Call call = service.getGlobalQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getGlobalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -301,10 +302,10 @@ public ServiceResponse getGlobalQueryNull(String localStringPath, String p if (pathItemStringPath == null) { throw new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null."); } - if (this.client.getGlobalStringPath() == null) { - throw new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null."); + if (this.client.globalStringPath() == null) { + throw new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null."); } - Call call = service.getGlobalQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getGlobalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); return getGlobalQueryNullDelegate(call.execute()); } @@ -331,11 +332,11 @@ public ServiceCall getGlobalQueryNullAsync(String localStringPath, String pathIt serviceCallback.failure(new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null.")); return null; } - if (this.client.getGlobalStringPath() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null.")); + if (this.client.globalStringPath() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null.")); return null; } - Call call = service.getGlobalQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getGlobalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -351,7 +352,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getGlobalQueryNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -374,12 +375,12 @@ public ServiceResponse getGlobalAndLocalQueryNull(String localStringPath, if (pathItemStringPath == null) { throw new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null."); } - if (this.client.getGlobalStringPath() == null) { - throw new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null."); + if (this.client.globalStringPath() == null) { + throw new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null."); } final String localStringQuery = null; final String pathItemStringQuery = null; - Call call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); return getGlobalAndLocalQueryNullDelegate(call.execute()); } @@ -404,13 +405,13 @@ public ServiceCall getGlobalAndLocalQueryNullAsync(String localStringPath, Strin serviceCallback.failure(new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null.")); return null; } - if (this.client.getGlobalStringPath() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null.")); + if (this.client.globalStringPath() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null.")); return null; } final String localStringQuery = null; final String pathItemStringQuery = null; - Call call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -444,10 +445,10 @@ public ServiceResponse getGlobalAndLocalQueryNull(String localStringPath, if (pathItemStringPath == null) { throw new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null."); } - if (this.client.getGlobalStringPath() == null) { - throw new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null."); + if (this.client.globalStringPath() == null) { + throw new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null."); } - Call call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); return getGlobalAndLocalQueryNullDelegate(call.execute()); } @@ -474,11 +475,11 @@ public ServiceCall getGlobalAndLocalQueryNullAsync(String localStringPath, Strin serviceCallback.failure(new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null.")); return null; } - if (this.client.getGlobalStringPath() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null.")); + if (this.client.globalStringPath() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null.")); return null; } - Call call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getGlobalAndLocalQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -494,7 +495,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getGlobalAndLocalQueryNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -517,12 +518,12 @@ public ServiceResponse getLocalPathItemQueryNull(String localStringPath, S if (pathItemStringPath == null) { throw new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null."); } - if (this.client.getGlobalStringPath() == null) { - throw new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null."); + if (this.client.globalStringPath() == null) { + throw new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null."); } final String localStringQuery = null; final String pathItemStringQuery = null; - Call call = service.getLocalPathItemQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getLocalPathItemQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); return getLocalPathItemQueryNullDelegate(call.execute()); } @@ -547,13 +548,13 @@ public ServiceCall getLocalPathItemQueryNullAsync(String localStringPath, String serviceCallback.failure(new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null.")); return null; } - if (this.client.getGlobalStringPath() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null.")); + if (this.client.globalStringPath() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null.")); return null; } final String localStringQuery = null; final String pathItemStringQuery = null; - Call call = service.getLocalPathItemQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getLocalPathItemQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -587,10 +588,10 @@ public ServiceResponse getLocalPathItemQueryNull(String localStringPath, S if (pathItemStringPath == null) { throw new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null."); } - if (this.client.getGlobalStringPath() == null) { - throw new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null."); + if (this.client.globalStringPath() == null) { + throw new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null."); } - Call call = service.getLocalPathItemQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getLocalPathItemQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); return getLocalPathItemQueryNullDelegate(call.execute()); } @@ -617,11 +618,11 @@ public ServiceCall getLocalPathItemQueryNullAsync(String localStringPath, String serviceCallback.failure(new IllegalArgumentException("Parameter pathItemStringPath is required and cannot be null.")); return null; } - if (this.client.getGlobalStringPath() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getGlobalStringPath() is required and cannot be null.")); + if (this.client.globalStringPath() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.globalStringPath() is required and cannot be null.")); return null; } - Call call = service.getLocalPathItemQueryNull(localStringPath, pathItemStringPath, this.client.getGlobalStringPath(), localStringQuery, pathItemStringQuery, this.client.getGlobalStringQuery()); + Call call = service.getLocalPathItemQueryNull(localStringPath, pathItemStringPath, this.client.globalStringPath(), localStringQuery, pathItemStringQuery, this.client.globalStringQuery()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -637,7 +638,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getLocalPathItemQueryNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/PathsImpl.java similarity index 97% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/PathsImpl.java index 31942e3ce28cb..b7d8301bfee9c 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/PathsImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.url; +package fixtures.url.implementation; +import retrofit2.Retrofit; +import fixtures.url.Paths; import com.google.common.reflect.TypeToken; import com.microsoft.rest.serializer.CollectionFormat; import com.microsoft.rest.ServiceCall; @@ -31,31 +33,30 @@ import retrofit2.http.Headers; import retrofit2.http.Path; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in PathsOperations. + * in Paths. */ -public final class PathsOperationsImpl implements PathsOperations { +public final class PathsImpl implements Paths { /** The Retrofit service to perform REST calls. */ private PathsService service; /** The service client containing this operation class. */ - private AutoRestUrlTestService client; + private AutoRestUrlTestServiceImpl client; /** - * Initializes an instance of PathsOperations. + * Initializes an instance of Paths. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PathsOperationsImpl(Retrofit retrofit, AutoRestUrlTestService client) { + public PathsImpl(Retrofit retrofit, AutoRestUrlTestServiceImpl client) { this.service = retrofit.create(PathsService.class); this.client = client; } /** - * The interface defining all the services for PathsOperations to be + * The interface defining all the services for Paths to be * used by Retrofit to perform actually REST calls. */ interface PathsService { @@ -206,7 +207,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBooleanTrueDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -253,7 +254,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBooleanFalseDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -300,7 +301,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getIntOneMillionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -347,7 +348,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getIntNegativeOneMillionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -394,7 +395,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getTenBillionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -441,7 +442,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNegativeTenBillionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -488,7 +489,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse floatScientificPositiveDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -535,7 +536,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse floatScientificNegativeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -582,7 +583,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse doubleDecimalPositiveDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -629,7 +630,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse doubleDecimalNegativeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -676,7 +677,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse stringUnicodeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -723,7 +724,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse stringUrlEncodedDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -770,7 +771,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse stringEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -825,7 +826,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse stringNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(400, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -880,7 +881,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse enumValidDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -935,7 +936,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse enumNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(400, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -992,7 +993,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse byteMultiByteDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1041,7 +1042,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse byteEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1098,7 +1099,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse byteNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(400, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1145,7 +1146,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse dateValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1200,7 +1201,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse dateNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(400, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1247,7 +1248,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse dateTimeValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1302,7 +1303,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse dateTimeNullDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(400, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1357,7 +1358,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse base64UrlDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1377,7 +1378,7 @@ public ServiceResponse arrayCsvInPath(List arrayPath) throws Error throw new IllegalArgumentException("Parameter arrayPath is required and cannot be null."); } Validator.validate(arrayPath); - String arrayPathConverted = this.client.getMapperAdapter().serializeList(arrayPath, CollectionFormat.CSV); + String arrayPathConverted = this.client.mapperAdapter().serializeList(arrayPath, CollectionFormat.CSV); Call call = service.arrayCsvInPath(arrayPathConverted); return arrayCsvInPathDelegate(call.execute()); } @@ -1399,7 +1400,7 @@ public ServiceCall arrayCsvInPathAsync(List arrayPath, final ServiceCall return null; } Validator.validate(arrayPath, serviceCallback); - String arrayPathConverted = this.client.getMapperAdapter().serializeList(arrayPath, CollectionFormat.CSV); + String arrayPathConverted = this.client.mapperAdapter().serializeList(arrayPath, CollectionFormat.CSV); Call call = service.arrayCsvInPath(arrayPathConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -1416,7 +1417,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse arrayCsvInPathDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1463,7 +1464,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse unixTimeUrlDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/QueriesOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/QueriesImpl.java similarity index 95% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/QueriesOperationsImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/QueriesImpl.java index 5cb35d0f1043d..721cd17391421 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/QueriesOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/QueriesImpl.java @@ -8,8 +8,10 @@ * regenerated. */ -package fixtures.url; +package fixtures.url.implementation; +import retrofit2.Retrofit; +import fixtures.url.Queries; import com.google.common.reflect.TypeToken; import com.microsoft.rest.serializer.CollectionFormat; import com.microsoft.rest.ServiceCall; @@ -31,31 +33,30 @@ import retrofit2.http.Headers; import retrofit2.http.Query; import retrofit2.Response; -import retrofit2.Retrofit; /** * An instance of this class provides access to all the operations defined - * in QueriesOperations. + * in Queries. */ -public final class QueriesOperationsImpl implements QueriesOperations { +public final class QueriesImpl implements Queries { /** The Retrofit service to perform REST calls. */ private QueriesService service; /** The service client containing this operation class. */ - private AutoRestUrlTestService client; + private AutoRestUrlTestServiceImpl client; /** - * Initializes an instance of QueriesOperations. + * Initializes an instance of Queries. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public QueriesOperationsImpl(Retrofit retrofit, AutoRestUrlTestService client) { + public QueriesImpl(Retrofit retrofit, AutoRestUrlTestServiceImpl client) { this.service = retrofit.create(QueriesService.class); this.client = client; } /** - * The interface defining all the services for QueriesOperations to be + * The interface defining all the services for Queries to be * used by Retrofit to perform actually REST calls. */ interface QueriesService { @@ -238,7 +239,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBooleanTrueDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -285,7 +286,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBooleanFalseDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -372,7 +373,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getBooleanNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -419,7 +420,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getIntOneMillionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -466,7 +467,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getIntNegativeOneMillionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -553,7 +554,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getIntNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -600,7 +601,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getTenBillionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -647,7 +648,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getNegativeTenBillionDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -734,7 +735,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getLongNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -781,7 +782,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse floatScientificPositiveDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -828,7 +829,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse floatScientificNegativeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -915,7 +916,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse floatNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -962,7 +963,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse doubleDecimalPositiveDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1009,7 +1010,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse doubleDecimalNegativeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1096,7 +1097,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse doubleNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1143,7 +1144,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse stringUnicodeDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1190,7 +1191,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse stringUrlEncodedDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1237,7 +1238,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse stringEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1324,7 +1325,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse stringNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1411,7 +1412,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse enumValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1498,7 +1499,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse enumNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1512,7 +1513,8 @@ private ServiceResponse enumNullDelegate(Response response) * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse byteMultiByte() throws ErrorException, IOException { - final String byteQueryConverted = null; + final byte[] byteQuery = new byte[0]; + String byteQueryConverted = Base64.encodeBase64String(byteQuery); Call call = service.byteMultiByte(byteQueryConverted); return byteMultiByteDelegate(call.execute()); } @@ -1528,7 +1530,8 @@ public ServiceCall byteMultiByteAsync(final ServiceCallback serviceCallbac if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final String byteQueryConverted = null; + final byte[] byteQuery = new byte[0]; + String byteQueryConverted = Base64.encodeBase64String(byteQuery); Call call = service.byteMultiByte(byteQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -1587,7 +1590,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse byteMultiByteDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1636,7 +1639,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse byteEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1650,7 +1653,8 @@ private ServiceResponse byteEmptyDelegate(Response response) * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse byteNull() throws ErrorException, IOException { - final String byteQueryConverted = null; + final byte[] byteQuery = new byte[0]; + String byteQueryConverted = Base64.encodeBase64String(byteQuery); Call call = service.byteNull(byteQueryConverted); return byteNullDelegate(call.execute()); } @@ -1666,7 +1670,8 @@ public ServiceCall byteNullAsync(final ServiceCallback serviceCallback) th if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final String byteQueryConverted = null; + final byte[] byteQuery = new byte[0]; + String byteQueryConverted = Base64.encodeBase64String(byteQuery); Call call = service.byteNull(byteQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -1725,7 +1730,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse byteNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1772,7 +1777,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse dateValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1859,7 +1864,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse dateNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1906,7 +1911,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse dateTimeValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -1993,7 +1998,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse dateTimeNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2007,7 +2012,8 @@ private ServiceResponse dateTimeNullDelegate(Response respon * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse arrayStringCsvValid() throws ErrorException, IOException { - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvValid(arrayQueryConverted); return arrayStringCsvValidDelegate(call.execute()); } @@ -2023,7 +2029,8 @@ public ServiceCall arrayStringCsvValidAsync(final ServiceCallback serviceC if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvValid(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2049,7 +2056,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse arrayStringCsvValid(List arrayQuery) throws ErrorException, IOException { Validator.validate(arrayQuery); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvValid(arrayQueryConverted); return arrayStringCsvValidDelegate(call.execute()); } @@ -2067,7 +2074,7 @@ public ServiceCall arrayStringCsvValidAsync(List arrayQuery, final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(arrayQuery, serviceCallback); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvValid(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2084,7 +2091,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse arrayStringCsvValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2098,7 +2105,8 @@ private ServiceResponse arrayStringCsvValidDelegate(Response * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse arrayStringCsvNull() throws ErrorException, IOException { - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvNull(arrayQueryConverted); return arrayStringCsvNullDelegate(call.execute()); } @@ -2114,7 +2122,8 @@ public ServiceCall arrayStringCsvNullAsync(final ServiceCallback serviceCa if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvNull(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2140,7 +2149,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse arrayStringCsvNull(List arrayQuery) throws ErrorException, IOException { Validator.validate(arrayQuery); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvNull(arrayQueryConverted); return arrayStringCsvNullDelegate(call.execute()); } @@ -2158,7 +2167,7 @@ public ServiceCall arrayStringCsvNullAsync(List arrayQuery, final Servic throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(arrayQuery, serviceCallback); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvNull(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2175,7 +2184,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse arrayStringCsvNullDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2189,7 +2198,8 @@ private ServiceResponse arrayStringCsvNullDelegate(Response * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse arrayStringCsvEmpty() throws ErrorException, IOException { - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvEmpty(arrayQueryConverted); return arrayStringCsvEmptyDelegate(call.execute()); } @@ -2205,7 +2215,8 @@ public ServiceCall arrayStringCsvEmptyAsync(final ServiceCallback serviceC if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvEmpty(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2231,7 +2242,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse arrayStringCsvEmpty(List arrayQuery) throws ErrorException, IOException { Validator.validate(arrayQuery); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvEmpty(arrayQueryConverted); return arrayStringCsvEmptyDelegate(call.execute()); } @@ -2249,7 +2260,7 @@ public ServiceCall arrayStringCsvEmptyAsync(List arrayQuery, final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(arrayQuery, serviceCallback); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.CSV); Call call = service.arrayStringCsvEmpty(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2266,7 +2277,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse arrayStringCsvEmptyDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2280,7 +2291,8 @@ private ServiceResponse arrayStringCsvEmptyDelegate(Response * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse arrayStringSsvValid() throws ErrorException, IOException { - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.SSV); Call call = service.arrayStringSsvValid(arrayQueryConverted); return arrayStringSsvValidDelegate(call.execute()); } @@ -2296,7 +2308,8 @@ public ServiceCall arrayStringSsvValidAsync(final ServiceCallback serviceC if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.SSV); Call call = service.arrayStringSsvValid(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2322,7 +2335,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse arrayStringSsvValid(List arrayQuery) throws ErrorException, IOException { Validator.validate(arrayQuery); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.SSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.SSV); Call call = service.arrayStringSsvValid(arrayQueryConverted); return arrayStringSsvValidDelegate(call.execute()); } @@ -2340,7 +2353,7 @@ public ServiceCall arrayStringSsvValidAsync(List arrayQuery, final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(arrayQuery, serviceCallback); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.SSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.SSV); Call call = service.arrayStringSsvValid(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2357,7 +2370,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse arrayStringSsvValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2371,7 +2384,8 @@ private ServiceResponse arrayStringSsvValidDelegate(Response * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse arrayStringTsvValid() throws ErrorException, IOException { - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.TSV); Call call = service.arrayStringTsvValid(arrayQueryConverted); return arrayStringTsvValidDelegate(call.execute()); } @@ -2387,7 +2401,8 @@ public ServiceCall arrayStringTsvValidAsync(final ServiceCallback serviceC if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.TSV); Call call = service.arrayStringTsvValid(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2413,7 +2428,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse arrayStringTsvValid(List arrayQuery) throws ErrorException, IOException { Validator.validate(arrayQuery); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.TSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.TSV); Call call = service.arrayStringTsvValid(arrayQueryConverted); return arrayStringTsvValidDelegate(call.execute()); } @@ -2431,7 +2446,7 @@ public ServiceCall arrayStringTsvValidAsync(List arrayQuery, final Servi throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(arrayQuery, serviceCallback); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.TSV); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.TSV); Call call = service.arrayStringTsvValid(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2448,7 +2463,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse arrayStringTsvValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -2462,7 +2477,8 @@ private ServiceResponse arrayStringTsvValidDelegate(Response * @return the {@link ServiceResponse} object if successful. */ public ServiceResponse arrayStringPipesValid() throws ErrorException, IOException { - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.PIPES); Call call = service.arrayStringPipesValid(arrayQueryConverted); return arrayStringPipesValidDelegate(call.execute()); } @@ -2478,7 +2494,8 @@ public ServiceCall arrayStringPipesValidAsync(final ServiceCallback servic if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - final String arrayQueryConverted = null; + final List arrayQuery = null; + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.PIPES); Call call = service.arrayStringPipesValid(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2504,7 +2521,7 @@ public void onResponse(Call call, Response response) */ public ServiceResponse arrayStringPipesValid(List arrayQuery) throws ErrorException, IOException { Validator.validate(arrayQuery); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.PIPES); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.PIPES); Call call = service.arrayStringPipesValid(arrayQueryConverted); return arrayStringPipesValidDelegate(call.execute()); } @@ -2522,7 +2539,7 @@ public ServiceCall arrayStringPipesValidAsync(List arrayQuery, final Ser throw new IllegalArgumentException("ServiceCallback is required for async calls."); } Validator.validate(arrayQuery, serviceCallback); - String arrayQueryConverted = this.client.getMapperAdapter().serializeList(arrayQuery, CollectionFormat.PIPES); + String arrayQueryConverted = this.client.mapperAdapter().serializeList(arrayQuery, CollectionFormat.PIPES); Call call = service.arrayStringPipesValid(arrayQueryConverted); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -2539,7 +2556,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse arrayStringPipesValidDelegate(Response response) throws ErrorException, IOException { - return new ServiceResponseBuilder(this.client.getMapperAdapter()) + return new ServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/package-info.java new file mode 100644 index 0000000000000..729951ad3af6b --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestUrlTestService. + * Test Infrastructure for AutoRest. + */ +package fixtures.url.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/Error.java index 438842df9eccc..bfec568603cb1 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/Error.java @@ -30,7 +30,7 @@ public class Error { * * @return the status value */ - public Integer getStatus() { + public Integer status() { return this.status; } @@ -38,9 +38,11 @@ public Integer getStatus() { * Set the status value. * * @param status the status value to set + * @return the Error object itself. */ - public void setStatus(Integer status) { + public Error withStatus(Integer status) { this.status = status; + return this; } /** @@ -48,7 +50,7 @@ public void setStatus(Integer status) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -56,9 +58,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/ErrorException.java index 278ea12904827..369bc4b2cadad 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.url.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/UriColor.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/UriColor.java index 3eee3e193106a..2d5c2a2f241f4 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/UriColor.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/UriColor.java @@ -33,16 +33,6 @@ public enum UriColor { this.value = value; } - /** - * Gets the serialized value for a UriColor instance. - * - * @return the serialized value. - */ - @JsonValue - public String toValue() { - return this.value; - } - /** * Parses a serialized value to a UriColor instance. * @@ -50,18 +40,19 @@ public String toValue() { * @return the parsed UriColor object, or null if unable to parse. */ @JsonCreator - public static UriColor fromValue(String value) { + public static UriColor fromString(String value) { UriColor[] items = UriColor.values(); for (UriColor item : items) { - if (item.toValue().equals(value)) { + if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; } + @JsonValue @Override public String toString() { - return toValue(); + return this.value; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/package-info.java index 26bce40d14e13..c837fb818a0cc 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestUrlTestService. + * This package contains the models classes for AutoRestUrlTestService. * Test Infrastructure for AutoRest. */ package fixtures.url.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/AutoRestValidationTest.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/AutoRestValidationTest.java index 090272553910a..45e3a88ad0e83 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/AutoRestValidationTest.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/AutoRestValidationTest.java @@ -10,11 +10,6 @@ package fixtures.validation; -import java.util.List; -import okhttp3.Interceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import com.microsoft.rest.AutoRestBaseUrl; -import com.microsoft.rest.serializer.JacksonMapperAdapter; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceException; @@ -28,61 +23,39 @@ */ public interface AutoRestValidationTest { /** - * Gets the URL used as the base for all cloud service requests. - * - * @return the BaseUrl object. - */ - AutoRestBaseUrl getBaseUrl(); - - /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @return the list of interceptors. - */ - List getClientInterceptors(); - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); - - /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * The default base URL. */ - JacksonMapperAdapter getMapperAdapter(); + String DEFAULT_BASE_URL = "http://localhost"; /** * Gets Subscription ID.. * * @return the subscriptionId value. */ - String getSubscriptionId(); + String subscriptionId(); /** * Sets Subscription ID.. * * @param subscriptionId the subscriptionId value. + * @return the service client itself */ - void setSubscriptionId(String subscriptionId); + AutoRestValidationTest withSubscriptionId(String subscriptionId); /** * Gets Required string following pattern \d{2}-\d{2}-\d{4}. * * @return the apiVersion value. */ - String getApiVersion(); + String apiVersion(); /** * Sets Required string following pattern \d{2}-\d{2}-\d{4}. * * @param apiVersion the apiVersion value. + * @return the service client itself */ - void setApiVersion(String apiVersion); + AutoRestValidationTest withApiVersion(String apiVersion); /** * Validates input parameters on the method. See swagger for details. diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/AutoRestValidationTestImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/implementation/AutoRestValidationTestImpl.java similarity index 84% rename from AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/AutoRestValidationTestImpl.java rename to AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/implementation/AutoRestValidationTestImpl.java index e063d58222d8e..89713bc8624ae 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/AutoRestValidationTestImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/implementation/AutoRestValidationTestImpl.java @@ -8,13 +8,12 @@ * regenerated. */ -package fixtures.validation; +package fixtures.validation.implementation; +import fixtures.validation.AutoRestValidationTest; import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.AutoRestBaseUrl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; -import okhttp3.logging.HttpLoggingInterceptor.Level; import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; @@ -45,19 +44,6 @@ public final class AutoRestValidationTestImpl extends ServiceClient implements A * The Retrofit service to perform REST calls. */ private AutoRestValidationTestService service; - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; - - /** - * Gets the URL used as the base for all cloud service requests. - * - * @return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } /** Subscription ID. */ private String subscriptionId; @@ -67,7 +53,7 @@ public AutoRestBaseUrl getBaseUrl() { * * @return the subscriptionId value. */ - public String getSubscriptionId() { + public String subscriptionId() { return this.subscriptionId; } @@ -75,9 +61,11 @@ public String getSubscriptionId() { * Sets Subscription ID. * * @param subscriptionId the subscriptionId value. + * @return the service client itself */ - public void setSubscriptionId(String subscriptionId) { + public AutoRestValidationTestImpl withSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; + return this; } /** Required string following pattern \d{2}-\d{2}-\d{4}. */ @@ -88,7 +76,7 @@ public void setSubscriptionId(String subscriptionId) { * * @return the apiVersion value. */ - public String getApiVersion() { + public String apiVersion() { return this.apiVersion; } @@ -96,9 +84,11 @@ public String getApiVersion() { * Sets Required string following pattern \d{2}-\d{2}-\d{4}. * * @param apiVersion the apiVersion value. + * @return the service client itself */ - public void setApiVersion(String apiVersion) { + public AutoRestValidationTestImpl withApiVersion(String apiVersion) { this.apiVersion = apiVersion; + return this; } /** @@ -114,8 +104,18 @@ public AutoRestValidationTestImpl() { * @param baseUrl the base URL of the host */ public AutoRestValidationTestImpl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); + initialize(); + } + + /** + * Initializes an instance of AutoRestValidationTest client. + * + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + public AutoRestValidationTestImpl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("http://localhost", clientBuilder, restBuilder); initialize(); } @@ -123,37 +123,20 @@ public AutoRestValidationTestImpl(String baseUrl) { * Initializes an instance of AutoRestValidationTest client. * * @param baseUrl the base URL of the host - * @param clientBuilder the builder for building up an {@link OkHttpClient} - * @param retrofitBuilder the builder for building up a {@link Retrofit} + * @param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public AutoRestValidationTestImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + public AutoRestValidationTestImpl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); initialize(); } - @Override - protected void initialize() { - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + private void initialize() { initializeService(); } private void initializeService() { - service = this.retrofitBuilder.client(this.clientBuilder.build()) - .build() - .create(AutoRestValidationTestService.class); - } - - /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum - */ - @Override - public void setLogLevel(Level logLevel) { - super.setLogLevel(logLevel); - initializeService(); + service = retrofit().create(AutoRestValidationTestService.class); } /** @@ -190,16 +173,16 @@ interface AutoRestValidationTestService { * @return the Product object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse validationOfMethodParameters(String resourceGroupName, int id) throws ErrorException, IOException, IllegalArgumentException { - if (this.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null."); + if (this.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - if (this.getApiVersion() == null) { - throw new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null."); + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); } - Call call = service.validationOfMethodParameters(this.getSubscriptionId(), resourceGroupName, id, this.getApiVersion()); + Call call = service.validationOfMethodParameters(this.subscriptionId(), resourceGroupName, id, this.apiVersion()); return validationOfMethodParametersDelegate(call.execute()); } @@ -216,19 +199,19 @@ public ServiceCall validationOfMethodParametersAsync(String resourceGroupName, i if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null.")); + if (this.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.")); return null; } if (resourceGroupName == null) { serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } - if (this.getApiVersion() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null.")); + if (this.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.")); return null; } - Call call = service.validationOfMethodParameters(this.getSubscriptionId(), resourceGroupName, id, this.getApiVersion()); + Call call = service.validationOfMethodParameters(this.subscriptionId(), resourceGroupName, id, this.apiVersion()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -244,7 +227,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse validationOfMethodParametersDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -261,17 +244,17 @@ private ServiceResponse validationOfMethodParametersDelegate(Response validationOfBody(String resourceGroupName, int id) throws ErrorException, IOException, IllegalArgumentException { - if (this.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null."); + if (this.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - if (this.getApiVersion() == null) { - throw new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null."); + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); } final Product body = null; - Call call = service.validationOfBody(this.getSubscriptionId(), resourceGroupName, id, body, this.getApiVersion()); + Call call = service.validationOfBody(this.subscriptionId(), resourceGroupName, id, body, this.apiVersion()); return validationOfBodyDelegate(call.execute()); } @@ -288,20 +271,20 @@ public ServiceCall validationOfBodyAsync(String resourceGroupName, int id, final if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null.")); + if (this.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.")); return null; } if (resourceGroupName == null) { serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } - if (this.getApiVersion() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null.")); + if (this.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.")); return null; } final Product body = null; - Call call = service.validationOfBody(this.getSubscriptionId(), resourceGroupName, id, body, this.getApiVersion()); + Call call = service.validationOfBody(this.subscriptionId(), resourceGroupName, id, body, this.apiVersion()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -328,17 +311,17 @@ public void onResponse(Call call, Response response) * @return the Product object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse validationOfBody(String resourceGroupName, int id, Product body) throws ErrorException, IOException, IllegalArgumentException { - if (this.getSubscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null."); + if (this.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - if (this.getApiVersion() == null) { - throw new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null."); + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); } Validator.validate(body); - Call call = service.validationOfBody(this.getSubscriptionId(), resourceGroupName, id, body, this.getApiVersion()); + Call call = service.validationOfBody(this.subscriptionId(), resourceGroupName, id, body, this.apiVersion()); return validationOfBodyDelegate(call.execute()); } @@ -356,20 +339,20 @@ public ServiceCall validationOfBodyAsync(String resourceGroupName, int id, Produ if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (this.getSubscriptionId() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null.")); + if (this.subscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.")); return null; } if (resourceGroupName == null) { serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } - if (this.getApiVersion() == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null.")); + if (this.apiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.")); return null; } Validator.validate(body, serviceCallback); - Call call = service.validationOfBody(this.getSubscriptionId(), resourceGroupName, id, body, this.getApiVersion()); + Call call = service.validationOfBody(this.subscriptionId(), resourceGroupName, id, body, this.apiVersion()); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @Override @@ -385,7 +368,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse validationOfBodyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) .build(response); @@ -430,7 +413,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse getWithConstantInPathDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } @@ -518,7 +501,7 @@ public void onResponse(Call call, Response response) } private ServiceResponse postWithConstantInBodyDelegate(Response response) throws ServiceException, IOException { - return new ServiceResponseBuilder(this.getMapperAdapter()) + return new ServiceResponseBuilder(this.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .build(response); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/implementation/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/implementation/package-info.java new file mode 100644 index 0000000000000..bb07136d890fe --- /dev/null +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +/** + * This package contains the implementation classes for AutoRestValidationTest. + * Test Infrastructure for AutoRest. No server backend exists for these tests. + */ +package fixtures.validation.implementation; diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ChildProduct.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ChildProduct.java index 0a9179a2e6e4e..0188aaf274bf0 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ChildProduct.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ChildProduct.java @@ -39,7 +39,7 @@ public ChildProduct() { * * @return the constProperty value */ - public String getConstProperty() { + public String constProperty() { return this.constProperty; } @@ -47,9 +47,11 @@ public String getConstProperty() { * Set the constProperty value. * * @param constProperty the constProperty value to set + * @return the ChildProduct object itself. */ - public void setConstProperty(String constProperty) { + public ChildProduct withConstProperty(String constProperty) { this.constProperty = constProperty; + return this; } /** @@ -57,7 +59,7 @@ public void setConstProperty(String constProperty) { * * @return the count value */ - public Integer getCount() { + public Integer count() { return this.count; } @@ -65,9 +67,11 @@ public Integer getCount() { * Set the count value. * * @param count the count value to set + * @return the ChildProduct object itself. */ - public void setCount(Integer count) { + public ChildProduct withCount(Integer count) { this.count = count; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ConstantProduct.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ConstantProduct.java index 80f36a3015cc4..9b93f8b8487c8 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ConstantProduct.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ConstantProduct.java @@ -41,7 +41,7 @@ public ConstantProduct() { * * @return the constProperty value */ - public String getConstProperty() { + public String constProperty() { return this.constProperty; } @@ -49,9 +49,11 @@ public String getConstProperty() { * Set the constProperty value. * * @param constProperty the constProperty value to set + * @return the ConstantProduct object itself. */ - public void setConstProperty(String constProperty) { + public ConstantProduct withConstProperty(String constProperty) { this.constProperty = constProperty; + return this; } /** @@ -59,7 +61,7 @@ public void setConstProperty(String constProperty) { * * @return the constProperty2 value */ - public String getConstProperty2() { + public String constProperty2() { return this.constProperty2; } @@ -67,9 +69,11 @@ public String getConstProperty2() { * Set the constProperty2 value. * * @param constProperty2 the constProperty2 value to set + * @return the ConstantProduct object itself. */ - public void setConstProperty2(String constProperty2) { + public ConstantProduct withConstProperty2(String constProperty2) { this.constProperty2 = constProperty2; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/EnumConst.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/EnumConst.java index ced5c30d1fca2..659dbfc662905 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/EnumConst.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/EnumConst.java @@ -27,16 +27,6 @@ public enum EnumConst { this.value = value; } - /** - * Gets the serialized value for a EnumConst instance. - * - * @return the serialized value. - */ - @JsonValue - public String toValue() { - return this.value; - } - /** * Parses a serialized value to a EnumConst instance. * @@ -44,18 +34,19 @@ public String toValue() { * @return the parsed EnumConst object, or null if unable to parse. */ @JsonCreator - public static EnumConst fromValue(String value) { + public static EnumConst fromString(String value) { EnumConst[] items = EnumConst.values(); for (EnumConst item : items) { - if (item.toValue().equals(value)) { + if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; } + @JsonValue @Override public String toString() { - return toValue(); + return this.value; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/Error.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/Error.java index 2698cf7645704..3ef4b2656d2fb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/Error.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/Error.java @@ -35,7 +35,7 @@ public class Error { * * @return the code value */ - public Integer getCode() { + public Integer code() { return this.code; } @@ -43,9 +43,11 @@ public Integer getCode() { * Set the code value. * * @param code the code value to set + * @return the Error object itself. */ - public void setCode(Integer code) { + public Error withCode(Integer code) { this.code = code; + return this; } /** @@ -53,7 +55,7 @@ public void setCode(Integer code) { * * @return the message value */ - public String getMessage() { + public String message() { return this.message; } @@ -61,9 +63,11 @@ public String getMessage() { * Set the message value. * * @param message the message value to set + * @return the Error object itself. */ - public void setMessage(String message) { + public Error withMessage(String message) { this.message = message; + return this; } /** @@ -71,7 +75,7 @@ public void setMessage(String message) { * * @return the fields value */ - public String getFields() { + public String fields() { return this.fields; } @@ -79,9 +83,11 @@ public String getFields() { * Set the fields value. * * @param fields the fields value to set + * @return the Error object itself. */ - public void setFields(String fields) { + public Error withFields(String fields) { this.fields = fields; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ErrorException.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ErrorException.java index 7e9d52d2e01bd..88d5331aed57e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ErrorException.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/ErrorException.java @@ -10,13 +10,13 @@ package fixtures.validation.models; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with Error information. */ -public class ErrorException extends AutoRestException { +public class ErrorException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/Product.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/Product.java index 5ba798f24f3ec..6bdfe3137fe37 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/Product.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/Product.java @@ -77,7 +77,7 @@ public Product() { * * @return the displayNames value */ - public List getDisplayNames() { + public List displayNames() { return this.displayNames; } @@ -85,9 +85,11 @@ public List getDisplayNames() { * Set the displayNames value. * * @param displayNames the displayNames value to set + * @return the Product object itself. */ - public void setDisplayNames(List displayNames) { + public Product withDisplayNames(List displayNames) { this.displayNames = displayNames; + return this; } /** @@ -95,7 +97,7 @@ public void setDisplayNames(List displayNames) { * * @return the capacity value */ - public Integer getCapacity() { + public Integer capacity() { return this.capacity; } @@ -103,9 +105,11 @@ public Integer getCapacity() { * Set the capacity value. * * @param capacity the capacity value to set + * @return the Product object itself. */ - public void setCapacity(Integer capacity) { + public Product withCapacity(Integer capacity) { this.capacity = capacity; + return this; } /** @@ -113,7 +117,7 @@ public void setCapacity(Integer capacity) { * * @return the image value */ - public String getImage() { + public String image() { return this.image; } @@ -121,9 +125,11 @@ public String getImage() { * Set the image value. * * @param image the image value to set + * @return the Product object itself. */ - public void setImage(String image) { + public Product withImage(String image) { this.image = image; + return this; } /** @@ -131,7 +137,7 @@ public void setImage(String image) { * * @return the child value */ - public ChildProduct getChild() { + public ChildProduct child() { return this.child; } @@ -139,9 +145,11 @@ public ChildProduct getChild() { * Set the child value. * * @param child the child value to set + * @return the Product object itself. */ - public void setChild(ChildProduct child) { + public Product withChild(ChildProduct child) { this.child = child; + return this; } /** @@ -149,7 +157,7 @@ public void setChild(ChildProduct child) { * * @return the constChild value */ - public ConstantProduct getConstChild() { + public ConstantProduct constChild() { return this.constChild; } @@ -157,9 +165,11 @@ public ConstantProduct getConstChild() { * Set the constChild value. * * @param constChild the constChild value to set + * @return the Product object itself. */ - public void setConstChild(ConstantProduct constChild) { + public Product withConstChild(ConstantProduct constChild) { this.constChild = constChild; + return this; } /** @@ -167,7 +177,7 @@ public void setConstChild(ConstantProduct constChild) { * * @return the constInt value */ - public int getConstInt() { + public int constInt() { return this.constInt; } @@ -175,9 +185,11 @@ public int getConstInt() { * Set the constInt value. * * @param constInt the constInt value to set + * @return the Product object itself. */ - public void setConstInt(int constInt) { + public Product withConstInt(int constInt) { this.constInt = constInt; + return this; } /** @@ -185,7 +197,7 @@ public void setConstInt(int constInt) { * * @return the constString value */ - public String getConstString() { + public String constString() { return this.constString; } @@ -193,9 +205,11 @@ public String getConstString() { * Set the constString value. * * @param constString the constString value to set + * @return the Product object itself. */ - public void setConstString(String constString) { + public Product withConstString(String constString) { this.constString = constString; + return this; } /** @@ -203,7 +217,7 @@ public void setConstString(String constString) { * * @return the constStringAsEnum value */ - public EnumConst getConstStringAsEnum() { + public EnumConst constStringAsEnum() { return this.constStringAsEnum; } @@ -211,9 +225,11 @@ public EnumConst getConstStringAsEnum() { * Set the constStringAsEnum value. * * @param constStringAsEnum the constStringAsEnum value to set + * @return the Product object itself. */ - public void setConstStringAsEnum(EnumConst constStringAsEnum) { + public Product withConstStringAsEnum(EnumConst constStringAsEnum) { this.constStringAsEnum = constStringAsEnum; + return this; } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/package-info.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/package-info.java index d18c56c30bb7d..6059286c5b2f0 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/package-info.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/validation/models/package-info.java @@ -7,7 +7,7 @@ // regenerated. /** - * This package contains the model classes for AutoRestValidationTest. + * This package contains the models classes for AutoRestValidationTest. * Test Infrastructure for AutoRest. No server backend exists for these tests. */ package fixtures.validation.models; diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyarray/ArrayTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyarray/ArrayTests.java index 6880a82163b02..2bf57357c5938 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyarray/ArrayTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyarray/ArrayTests.java @@ -19,6 +19,7 @@ import java.util.Map; import java.util.UUID; +import fixtures.bodyarray.implementation.AutoRestSwaggerBATArrayServiceImpl; import fixtures.bodyarray.models.ErrorException; import fixtures.bodyarray.models.Product; @@ -32,13 +33,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getArrayOperations().getNull().getBody()); + Assert.assertNull(client.arrays().getNull().getBody()); } @Test public void getInvalid() throws Exception { try { - List result = client.getArrayOperations().getInvalid().getBody(); + List result = client.arrays().getInvalid().getBody(); Assert.assertTrue(false); } catch (JsonParseException exception) { // expected @@ -48,31 +49,31 @@ public void getInvalid() throws Exception { @Test public void getEmpty() throws Exception { - List result = client.getArrayOperations().getEmpty().getBody(); + List result = client.arrays().getEmpty().getBody(); Assert.assertEquals(0, result.size()); } @Test public void putEmpty() throws Exception { - client.getArrayOperations().putEmpty(new ArrayList()); + client.arrays().putEmpty(new ArrayList()); } @Test public void getBooleanTfft() throws Exception { - List result = client.getArrayOperations().getBooleanTfft().getBody(); + List result = client.arrays().getBooleanTfft().getBody(); Object[] exected = new Boolean[] {true, false, false, true}; Assert.assertArrayEquals(exected, result.toArray()); } @Test public void putBooleanTfft() throws Exception { - client.getArrayOperations().putBooleanTfft(Arrays.asList(true, false, false, true)); + client.arrays().putBooleanTfft(Arrays.asList(true, false, false, true)); } @Test public void getBooleanInvalidNull() throws Exception { try { - List result = client.getArrayOperations().getBooleanInvalidNull().getBody(); + List result = client.arrays().getBooleanInvalidNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -82,7 +83,7 @@ public void getBooleanInvalidNull() throws Exception { @Test public void getBooleanInvalidString() throws Exception { try { - List result = client.getArrayOperations().getBooleanInvalidString().getBody(); + List result = client.arrays().getBooleanInvalidString().getBody(); } catch (InvalidFormatException ex) { // expected Assert.assertTrue(ex.getMessage().contains("only \"true\" or \"false\" recognized")); @@ -91,20 +92,20 @@ public void getBooleanInvalidString() throws Exception { @Test public void getIntegerValid() throws Exception { - List result = client.getArrayOperations().getIntegerValid().getBody(); + List result = client.arrays().getIntegerValid().getBody(); Object[] expected = new Integer[] {1, -1, 3, 300}; Assert.assertArrayEquals(expected, result.toArray()); } @Test public void putIntegerValid() throws Exception { - client.getArrayOperations().putIntegerValid(Arrays.asList(1, -1, 3, 300)); + client.arrays().putIntegerValid(Arrays.asList(1, -1, 3, 300)); } @Test public void getIntInvalidNull() throws Exception { try { - List result = client.getArrayOperations().getIntInvalidNull().getBody(); + List result = client.arrays().getIntInvalidNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -114,7 +115,7 @@ public void getIntInvalidNull() throws Exception { @Test public void getIntInvalidString() throws Exception { try { - List result = client.getArrayOperations().getIntInvalidString().getBody(); + List result = client.arrays().getIntInvalidString().getBody(); } catch (InvalidFormatException ex) { // expected Assert.assertTrue(ex.getMessage().contains("not a valid Integer value")); @@ -123,20 +124,20 @@ public void getIntInvalidString() throws Exception { @Test public void getLongValid() throws Exception { - List result = client.getArrayOperations().getLongValid().getBody(); + List result = client.arrays().getLongValid().getBody(); Object[] expected = new Long[] {1L, -1L, 3L, 300L}; Assert.assertArrayEquals(expected, result.toArray()); } @Test public void putLongValid() throws Exception { - client.getArrayOperations().putLongValid(Arrays.asList(1L, -1L, 3L, 300L)); + client.arrays().putLongValid(Arrays.asList(1L, -1L, 3L, 300L)); } @Test public void getLongInvalidNull() throws Exception { try { - List result = client.getArrayOperations().getLongInvalidNull().getBody(); + List result = client.arrays().getLongInvalidNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -146,7 +147,7 @@ public void getLongInvalidNull() throws Exception { @Test public void getLongInvalidString() throws Exception { try { - List result = client.getArrayOperations().getLongInvalidString().getBody(); + List result = client.arrays().getLongInvalidString().getBody(); } catch (InvalidFormatException ex) { // expected Assert.assertTrue(ex.getMessage().contains("not a valid Long value")); @@ -155,20 +156,20 @@ public void getLongInvalidString() throws Exception { @Test public void getFloatValid() throws Exception { - List result = client.getArrayOperations().getFloatValid().getBody(); + List result = client.arrays().getFloatValid().getBody(); Object[] expected = new Double[] {0d, -0.01, -1.2e20}; Assert.assertArrayEquals(expected, result.toArray()); } @Test public void putFloatValid() throws Exception { - client.getArrayOperations().putFloatValid(Arrays.asList(0d, -0.01d, -1.2e20d)); + client.arrays().putFloatValid(Arrays.asList(0d, -0.01d, -1.2e20d)); } @Test public void getFloatInvalidNull() throws Exception { try { - List result = client.getArrayOperations().getFloatInvalidNull().getBody(); + List result = client.arrays().getFloatInvalidNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -178,7 +179,7 @@ public void getFloatInvalidNull() throws Exception { @Test public void getFloatInvalidString() throws Exception { try { - List result = client.getArrayOperations().getFloatInvalidString().getBody(); + List result = client.arrays().getFloatInvalidString().getBody(); } catch (InvalidFormatException ex) { // expected Assert.assertTrue(ex.getMessage().contains("not a valid Double value")); @@ -187,20 +188,20 @@ public void getFloatInvalidString() throws Exception { @Test public void getDoubleValid() throws Exception { - List result = client.getArrayOperations().getDoubleValid().getBody(); + List result = client.arrays().getDoubleValid().getBody(); Object[] expected = new Double[] {0d, -0.01, -1.2e20}; Assert.assertArrayEquals(expected, result.toArray()); } @Test public void putDoubleValid() throws Exception { - client.getArrayOperations().putDoubleValid(Arrays.asList(0d, -0.01d, -1.2e20d)); + client.arrays().putDoubleValid(Arrays.asList(0d, -0.01d, -1.2e20d)); } @Test public void getDoubleInvalidNull() throws Exception { try { - List result = client.getArrayOperations().getDoubleInvalidNull().getBody(); + List result = client.arrays().getDoubleInvalidNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -210,7 +211,7 @@ public void getDoubleInvalidNull() throws Exception { @Test public void getDoubleInvalidString() throws Exception { try { - List result = client.getArrayOperations().getDoubleInvalidString().getBody(); + List result = client.arrays().getDoubleInvalidString().getBody(); } catch (InvalidFormatException ex) { // expected Assert.assertTrue(ex.getMessage().contains("not a valid Double value")); @@ -219,20 +220,20 @@ public void getDoubleInvalidString() throws Exception { @Test public void getStringValid() throws Exception { - List result = client.getArrayOperations().getStringValid().getBody(); + List result = client.arrays().getStringValid().getBody(); Object[] expected = new String[] {"foo1", "foo2", "foo3"}; Assert.assertArrayEquals(expected, result.toArray()); } @Test public void putStringValid() throws Exception { - client.getArrayOperations().putStringValid(Arrays.asList("foo1", "foo2", "foo3")); + client.arrays().putStringValid(Arrays.asList("foo1", "foo2", "foo3")); } @Test public void getStringWithNull() throws Exception { try { - List result = client.getArrayOperations().getStringWithNull().getBody(); + List result = client.arrays().getStringWithNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -242,7 +243,7 @@ public void getStringWithNull() throws Exception { @Test public void getStringWithInvalid() throws Exception { try { - List result = client.getArrayOperations().getStringWithInvalid().getBody(); + List result = client.arrays().getStringWithInvalid().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("InvalidFormatException")); @@ -251,7 +252,7 @@ public void getStringWithInvalid() throws Exception { @Test public void getUuidValid() throws Exception { - List result = client.getArrayOperations().getUuidValid().getBody(); + List result = client.arrays().getUuidValid().getBody(); Object[] expected = new UUID[] {UUID.fromString("6dcc7237-45fe-45c4-8a6b-3a8a3f625652"), UUID.fromString("d1399005-30f7-40d6-8da6-dd7c89ad34db"), UUID.fromString("f42f6aa1-a5bc-4ddf-907e-5f915de43205")}; @@ -260,14 +261,14 @@ public void getUuidValid() throws Exception { @Test public void putUuidValid() throws Exception { - client.getArrayOperations().putUuidValid(Arrays.asList(UUID.fromString("6dcc7237-45fe-45c4-8a6b-3a8a3f625652"), + client.arrays().putUuidValid(Arrays.asList(UUID.fromString("6dcc7237-45fe-45c4-8a6b-3a8a3f625652"), UUID.fromString("d1399005-30f7-40d6-8da6-dd7c89ad34db"), UUID.fromString("f42f6aa1-a5bc-4ddf-907e-5f915de43205"))); } @Test public void getUuidInvalidChars() throws Exception { try { - List result = client.getArrayOperations().getUuidInvalidChars().getBody(); + List result = client.arrays().getUuidInvalidChars().getBody(); Assert.fail(); } catch (InvalidFormatException ex) { // expected @@ -276,7 +277,7 @@ public void getUuidInvalidChars() throws Exception { } @Test public void getDateValid() throws Exception { - List result = client.getArrayOperations().getDateValid().getBody(); + List result = client.arrays().getDateValid().getBody(); Object[] expected = new LocalDate[] { new LocalDate(2000, 12, 1), new LocalDate(1980, 1, 2), @@ -287,7 +288,7 @@ public void getDateValid() throws Exception { @Test public void putDateValid() throws Exception { - client.getArrayOperations().putDateValid(Arrays.asList( + client.arrays().putDateValid(Arrays.asList( new LocalDate(2000, 12, 1), new LocalDate(1980, 1, 2), new LocalDate(1492, 10, 12) @@ -297,7 +298,7 @@ public void putDateValid() throws Exception { @Test public void getDateInvalidNull() throws Exception { try { - List result = client.getArrayOperations().getDateInvalidNull().getBody(); + List result = client.arrays().getDateInvalidNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -307,7 +308,7 @@ public void getDateInvalidNull() throws Exception { @Test public void getDateInvalidString() throws Exception { try { - List result = client.getArrayOperations().getDateInvalidChars().getBody(); + List result = client.arrays().getDateInvalidChars().getBody(); } catch (JsonMappingException ex) { // expected Assert.assertTrue(ex.getMessage().contains("Invalid format: \"date\"")); @@ -316,7 +317,7 @@ public void getDateInvalidString() throws Exception { @Test public void getDateTimeValid() throws Exception { - List result = client.getArrayOperations().getDateTimeValid().getBody(); + List result = client.arrays().getDateTimeValid().getBody(); Object[] expected = new DateTime[] { new DateTime(2000, 12, 1, 0, 0, 1, DateTimeZone.UTC), new DateTime(1980, 1, 2, 0, 11, 35, DateTimeZone.UTC), @@ -327,7 +328,7 @@ public void getDateTimeValid() throws Exception { @Test public void putDateTimeValid() throws Exception { - client.getArrayOperations().putDateTimeValid(Arrays.asList( + client.arrays().putDateTimeValid(Arrays.asList( new DateTime(2000, 12, 1, 0, 0, 1, DateTimeZone.UTC), new DateTime(1980, 1, 2, 0, 11, 35, DateTimeZone.UTC), new DateTime(1492, 10, 12, 10, 15, 1, DateTimeZone.UTC) @@ -337,7 +338,7 @@ public void putDateTimeValid() throws Exception { @Test public void getDateTimeInvalidNull() throws Exception { try { - List result = client.getArrayOperations().getDateTimeInvalidNull().getBody(); + List result = client.arrays().getDateTimeInvalidNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -347,7 +348,7 @@ public void getDateTimeInvalidNull() throws Exception { @Test public void getDateTimeInvalidString() throws Exception { try { - List result = client.getArrayOperations().getDateTimeInvalidChars().getBody(); + List result = client.arrays().getDateTimeInvalidChars().getBody(); } catch (JsonMappingException ex) { // expected Assert.assertTrue(ex.getMessage().contains("Invalid format: \"date-time\"")); @@ -356,7 +357,7 @@ public void getDateTimeInvalidString() throws Exception { @Test public void getDateTimeRfc1123Valid() throws Exception { - List result = client.getArrayOperations().getDateTimeRfc1123Valid().getBody(); + List result = client.arrays().getDateTimeRfc1123Valid().getBody(); Object[] expected = new DateTime[] { new DateTime(2000, 12, 1, 0, 0, 1, DateTimeZone.UTC), new DateTime(1980, 1, 2, 0, 11, 35, DateTimeZone.UTC), @@ -367,7 +368,7 @@ public void getDateTimeRfc1123Valid() throws Exception { @Test public void putDateTimeRfc1123Valid() throws Exception { - client.getArrayOperations().putDateTimeRfc1123Valid(Arrays.asList( + client.arrays().putDateTimeRfc1123Valid(Arrays.asList( new DateTime(2000, 12, 1, 0, 0, 1, DateTimeZone.UTC), new DateTime(1980, 1, 2, 0, 11, 35, DateTimeZone.UTC), new DateTime(1492, 10, 12, 10, 15, 1, DateTimeZone.UTC) @@ -376,7 +377,7 @@ public void putDateTimeRfc1123Valid() throws Exception { @Test public void getDurationValid() throws Exception { - List result = client.getArrayOperations().getDurationValid().getBody(); + List result = client.arrays().getDurationValid().getBody(); Object[] expected = new Period[] { new Period(0, 0, 0, 123, 22, 14, 12, 11), new Period(0, 0, 0, 5, 1, 0, 0, 0) @@ -386,14 +387,14 @@ public void getDurationValid() throws Exception { @Test public void putDurationValid() throws Exception { - client.getArrayOperations().putDurationValid(Arrays.asList( + client.arrays().putDurationValid(Arrays.asList( new Period(0, 0, 0, 123, 22, 14, 12, 11), new Period(0, 0, 0, 5, 1, 0, 0, 0))); } @Test public void getByteValid() throws Exception { - List result = client.getArrayOperations().getByteValid().getBody(); + List result = client.arrays().getByteValid().getBody(); Object[] expected = new byte[][] { new byte[] {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFA}, new byte[] {(byte) 0x01, (byte) 0x02, (byte) 0x03}, @@ -404,7 +405,7 @@ public void getByteValid() throws Exception { @Test public void putByteValid() throws Exception { - client.getArrayOperations().putByteValid(Arrays.asList( + client.arrays().putByteValid(Arrays.asList( new byte[] {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFA}, new byte[] {(byte) 0x01, (byte) 0x02, (byte) 0x03}, new byte[] {(byte) 0x25, (byte) 0x29, (byte) 0x43} @@ -414,7 +415,7 @@ public void putByteValid() throws Exception { @Test public void getByteInvalidNull() throws Exception { try { - List result = client.getArrayOperations().getByteInvalidNull().getBody(); + List result = client.arrays().getByteInvalidNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -424,7 +425,7 @@ public void getByteInvalidNull() throws Exception { @Test public void getComplexNull() throws Exception { try { - List result = client.getArrayOperations().getComplexNull().getBody(); + List result = client.arrays().getComplexNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -433,54 +434,54 @@ public void getComplexNull() throws Exception { @Test public void getComplexEmpty() throws Exception { - List result = client.getArrayOperations().getComplexEmpty().getBody(); + List result = client.arrays().getComplexEmpty().getBody(); Assert.assertEquals(0, result.size()); } @Test public void getComplexItemNull() throws Exception { - List result = client.getArrayOperations().getComplexItemNull().getBody(); + List result = client.arrays().getComplexItemNull().getBody(); Assert.assertEquals(3, result.size()); Assert.assertNull(result.get(1)); } @Test public void getComplexItemEmpty() throws Exception { - List result = client.getArrayOperations().getComplexItemEmpty().getBody(); + List result = client.arrays().getComplexItemEmpty().getBody(); Assert.assertEquals(3, result.size()); - Assert.assertNull(result.get(1).getStringProperty()); + Assert.assertNull(result.get(1).stringProperty()); } @Test public void getComplexValid() throws Exception { - List result = client.getArrayOperations().getComplexValid().getBody(); + List result = client.arrays().getComplexValid().getBody(); Assert.assertEquals(3, result.size()); - Assert.assertEquals(5, result.get(2).getInteger().intValue()); - Assert.assertEquals("6", result.get(2).getStringProperty()); + Assert.assertEquals(5, result.get(2).integer().intValue()); + Assert.assertEquals("6", result.get(2).stringProperty()); } @Test public void putComplexValid() throws Exception { List body = new ArrayList(); Product p1 = new Product(); - p1.setInteger(1); - p1.setStringProperty("2"); + p1.withInteger(1); + p1.withStringProperty("2"); body.add(p1); Product p2 = new Product(); - p2.setInteger(3); - p2.setStringProperty("4"); + p2.withInteger(3); + p2.withStringProperty("4"); body.add(p2); Product p3 = new Product(); - p3.setInteger(5); - p3.setStringProperty("6"); + p3.withInteger(5); + p3.withStringProperty("6"); body.add(p3); - client.getArrayOperations().putComplexValid(body); + client.arrays().putComplexValid(body); } @Test public void getArrayNull() throws Exception { try { - List> result = client.getArrayOperations().getArrayNull().getBody(); + List> result = client.arrays().getArrayNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -489,27 +490,27 @@ public void getArrayNull() throws Exception { @Test public void getArrayEmpty() throws Exception { - List> result = client.getArrayOperations().getArrayEmpty().getBody(); + List> result = client.arrays().getArrayEmpty().getBody(); Assert.assertEquals(0, result.size()); } @Test public void getArrayItemNull() throws Exception { - List> result = client.getArrayOperations().getArrayItemNull().getBody(); + List> result = client.arrays().getArrayItemNull().getBody(); Assert.assertEquals(3, result.size()); Assert.assertNull(result.get(1)); } @Test public void getArrayItemEmpty() throws Exception { - List> result = client.getArrayOperations().getArrayItemEmpty().getBody(); + List> result = client.arrays().getArrayItemEmpty().getBody(); Assert.assertEquals(3, result.size()); Assert.assertEquals(0, result.get(1).size()); } @Test public void getArrayValid() throws Exception { - List> result = client.getArrayOperations().getArrayValid().getBody(); + List> result = client.arrays().getArrayValid().getBody(); Assert.assertArrayEquals(new String[]{"1", "2", "3"}, result.get(0).toArray()); Assert.assertArrayEquals(new String[]{"4", "5", "6"}, result.get(1).toArray()); Assert.assertArrayEquals(new String[] {"7", "8", "9"}, result.get(2).toArray()); @@ -521,13 +522,13 @@ public void putArrayValid() throws Exception { body.add(Arrays.asList("1", "2", "3")); body.add(Arrays.asList("4", "5", "6")); body.add(Arrays.asList("7", "8", "9")); - client.getArrayOperations().putArrayValid(body); + client.arrays().putArrayValid(body); } @Test public void getDictionaryNull() throws Exception { try { - List> result = client.getArrayOperations().getDictionaryNull().getBody(); + List> result = client.arrays().getDictionaryNull().getBody(); } catch (ErrorException ex) { // expected Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); @@ -536,27 +537,27 @@ public void getDictionaryNull() throws Exception { @Test public void getDictionaryEmpty() throws Exception { - List> result = client.getArrayOperations().getDictionaryEmpty().getBody(); + List> result = client.arrays().getDictionaryEmpty().getBody(); Assert.assertEquals(0, result.size()); } @Test public void getDictionaryItemNull() throws Exception { - List> result = client.getArrayOperations().getDictionaryItemNull().getBody(); + List> result = client.arrays().getDictionaryItemNull().getBody(); Assert.assertEquals(3, result.size()); Assert.assertNull(result.get(1)); } @Test public void getDictionaryItemEmpty() throws Exception { - List> result = client.getArrayOperations().getDictionaryItemEmpty().getBody(); + List> result = client.arrays().getDictionaryItemEmpty().getBody(); Assert.assertEquals(3, result.size()); Assert.assertEquals(0, result.get(1).size()); } @Test public void getDictionaryValid() throws Exception { - List> result = client.getArrayOperations().getDictionaryValid().getBody(); + List> result = client.arrays().getDictionaryValid().getBody(); Assert.assertEquals("seven", result.get(2).get("7")); Assert.assertEquals("five", result.get(1).get("5")); Assert.assertEquals("three", result.get(0).get("3")); @@ -580,6 +581,6 @@ public void putDictionaryValid() throws Exception { m3.put("8", "eight"); m3.put("9", "nine"); body.add(m3); - client.getArrayOperations().putDictionaryValid(body); + client.arrays().putDictionaryValid(body); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyboolean/BoolTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyboolean/BoolTests.java index a22fdf20aa1ef..64dbde59ec658 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyboolean/BoolTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyboolean/BoolTests.java @@ -1,10 +1,13 @@ package fixtures.bodyboolean; import com.fasterxml.jackson.core.JsonParseException; + import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import fixtures.bodyboolean.implementation.AutoRestBoolTestServiceImpl; + public class BoolTests { private static AutoRestBoolTestService client; @@ -15,13 +18,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getBoolOperations().getNull().getBody()); + Assert.assertNull(client.bools().getNull().getBody()); } @Test public void getInvalid() throws Exception { try { - client.getBoolOperations().getInvalid(); + client.bools().getInvalid(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -31,23 +34,23 @@ public void getInvalid() throws Exception { @Test public void getTrue() throws Exception { - boolean result = client.getBoolOperations().getTrue().getBody(); + boolean result = client.bools().getTrue().getBody(); Assert.assertTrue(result); } @Test public void getFalse() throws Exception { - boolean result = client.getBoolOperations().getFalse().getBody(); + boolean result = client.bools().getFalse().getBody(); Assert.assertFalse(result); } @Test public void putTrue() throws Exception { - client.getBoolOperations().putTrue(true); + client.bools().putTrue(true); } @Test public void putFalse() throws Exception { - client.getBoolOperations().putFalse(false); + client.bools().putFalse(false); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodybyte/ByteOperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodybyte/ByteOperationsTests.java index 0ce9363d583c7..8b32c2467bf9d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodybyte/ByteOperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodybyte/ByteOperationsTests.java @@ -5,6 +5,8 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.bodybyte.implementation.AutoRestSwaggerBATByteServiceImpl; + public class ByteOperationsTests { private static AutoRestSwaggerBATByteService client; @@ -15,18 +17,18 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getByteOperations().getNull().getBody()); + Assert.assertNull(client.bytes().getNull().getBody()); } @Test public void getEmpty() throws Exception { - byte[] result = client.getByteOperations().getEmpty().getBody(); + byte[] result = client.bytes().getEmpty().getBody(); Assert.assertEquals(0, result.length); } @Test public void getNonAscii() throws Exception { - byte[] result = client.getByteOperations().getNonAscii().getBody(); + byte[] result = client.bytes().getNonAscii().getBody(); byte[] expected = new byte[] { (byte) 0xff, (byte) 0xfe, (byte) 0xfd, (byte) 0xfc, (byte) 0xfb, (byte) 0xfa, (byte) 0xf9, (byte) 0xf8, (byte) 0xf7, (byte) 0xf6 @@ -40,13 +42,13 @@ public void putNonAscii() throws Exception { (byte) 0xff, (byte) 0xfe, (byte) 0xfd, (byte) 0xfc, (byte) 0xfb, (byte) 0xfa, (byte) 0xf9, (byte) 0xf8, (byte) 0xf7, (byte) 0xf6 }; - client.getByteOperations().putNonAscii(body); + client.bytes().putNonAscii(body); } @Test public void getInvalid() throws Exception { try { - client.getByteOperations().getInvalid(); + client.bytes().getInvalid(); Assert.assertTrue(false); } catch (Exception exception) { // expected diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/ArrayTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/ArrayTests.java index b0ac877e733b1..58dc2ba497487 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/ArrayTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/ArrayTests.java @@ -1,5 +1,6 @@ package fixtures.bodycomplex; +import fixtures.bodycomplex.implementation.AutoRestComplexTestServiceImpl; import fixtures.bodycomplex.models.ArrayWrapper; import org.junit.Assert; import org.junit.BeforeClass; @@ -18,34 +19,34 @@ public static void setup() { @Test public void getValid() throws Exception { - ArrayWrapper result = client.getArrayOperations().getValid().getBody(); - Assert.assertEquals(5, result.getArray().size()); - Assert.assertEquals("&S#$(*Y", result.getArray().get(3)); + ArrayWrapper result = client.arrays().getValid().getBody(); + Assert.assertEquals(5, result.array().size()); + Assert.assertEquals("&S#$(*Y", result.array().get(3)); } @Test public void putValid() throws Exception { ArrayWrapper body = new ArrayWrapper(); - body.setArray(Arrays.asList("1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog")); - client.getArrayOperations().putValid(body); + body.withArray(Arrays.asList("1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog")); + client.arrays().putValid(body); } @Test public void getEmpty() throws Exception { - ArrayWrapper result = client.getArrayOperations().getEmpty().getBody(); - Assert.assertEquals(0, result.getArray().size()); + ArrayWrapper result = client.arrays().getEmpty().getBody(); + Assert.assertEquals(0, result.array().size()); } @Test public void putEmpty() throws Exception { ArrayWrapper body = new ArrayWrapper(); - body.setArray(new ArrayList()); - client.getArrayOperations().putEmpty(body); + body.withArray(new ArrayList()); + client.arrays().putEmpty(body); } @Test public void getNotProvided() throws Exception { - ArrayWrapper result = client.getArrayOperations().getNotProvided().getBody(); - Assert.assertNull(result.getArray()); + ArrayWrapper result = client.arrays().getNotProvided().getBody(); + Assert.assertNull(result.array()); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/BasicOperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/BasicOperationsTests.java index f4fdd6868165d..ceecd39a2ef75 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/BasicOperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/BasicOperationsTests.java @@ -1,6 +1,8 @@ package fixtures.bodycomplex; import com.fasterxml.jackson.databind.exc.InvalidFormatException; + +import fixtures.bodycomplex.implementation.AutoRestComplexTestServiceImpl; import fixtures.bodycomplex.models.Basic; import org.junit.Assert; import org.junit.BeforeClass; @@ -12,30 +14,30 @@ public class BasicOperationsTests { @BeforeClass public static void setup() { client = new AutoRestComplexTestServiceImpl("http://localhost:3000"); - client.setApiVersion("2015-05-01"); + client.withApiVersion("2015-05-01"); } @Test public void getValid() throws Exception { - Basic result = client.getBasicOperations().getValid().getBody(); - Assert.assertEquals(2, result.getId().intValue()); - Assert.assertEquals("abc", result.getName()); - Assert.assertEquals("YELLOW", result.getColor()); + Basic result = client.basics().getValid().getBody(); + Assert.assertEquals(2, result.id().intValue()); + Assert.assertEquals("abc", result.name()); + Assert.assertEquals("YELLOW", result.color()); } @Test public void putValid() throws Exception { Basic body = new Basic(); - body.setId(2); - body.setName("abc"); - body.setColor("Magenta"); - client.getBasicOperations().putValid(body); + body.withId(2); + body.withName("abc"); + body.withColor("Magenta"); + client.basics().putValid(body); } @Test public void getInvalid() throws Exception { try { - client.getBasicOperations().getInvalid(); + client.basics().getInvalid(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -45,18 +47,18 @@ public void getInvalid() throws Exception { @Test public void getEmpty() throws Exception { - Basic result = client.getBasicOperations().getEmpty().getBody(); - Assert.assertNull(result.getName()); + Basic result = client.basics().getEmpty().getBody(); + Assert.assertNull(result.name()); } @Test public void getNull() throws Exception { - Basic result = client.getBasicOperations().getNull().getBody(); - Assert.assertNull(result.getName()); + Basic result = client.basics().getNull().getBody(); + Assert.assertNull(result.name()); } @Test public void getNotProvided() throws Exception { - Assert.assertNull(client.getBasicOperations().getNotProvided().getBody()); + Assert.assertNull(client.basics().getNotProvided().getBody()); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/DictionaryTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/DictionaryTests.java index 503ad07aa9164..10faf2f2fb126 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/DictionaryTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/DictionaryTests.java @@ -1,5 +1,6 @@ package fixtures.bodycomplex; +import fixtures.bodycomplex.implementation.AutoRestComplexTestServiceImpl; import fixtures.bodycomplex.models.DictionaryWrapper; import org.junit.Assert; import org.junit.BeforeClass; @@ -18,10 +19,10 @@ public static void setup() { @Test public void getValid() throws Exception { - DictionaryWrapper result = client.getDictionaryOperations().getValid().getBody(); - Assert.assertEquals(5, result.getDefaultProgram().size()); - Assert.assertEquals("", result.getDefaultProgram().get("exe")); - Assert.assertEquals(null, result.getDefaultProgram().get("")); + DictionaryWrapper result = client.dictionarys().getValid().getBody(); + Assert.assertEquals(5, result.defaultProgram().size()); + Assert.assertEquals("", result.defaultProgram().get("exe")); + Assert.assertEquals(null, result.defaultProgram().get("")); } @Test @@ -33,32 +34,32 @@ public void putValid() throws Exception { programs.put("xls", "excel"); programs.put("exe", ""); programs.put("", null); - body.setDefaultProgram(programs); - client.getDictionaryOperations().putValid(body); + body.withDefaultProgram(programs); + client.dictionarys().putValid(body); } @Test public void getEmpty() throws Exception { - DictionaryWrapper result = client.getDictionaryOperations().getEmpty().getBody(); - Assert.assertEquals(0, result.getDefaultProgram().size()); + DictionaryWrapper result = client.dictionarys().getEmpty().getBody(); + Assert.assertEquals(0, result.defaultProgram().size()); } @Test public void putEmpty() throws Exception { DictionaryWrapper body = new DictionaryWrapper(); - body.setDefaultProgram(new HashMap()); - client.getDictionaryOperations().putEmpty(body); + body.withDefaultProgram(new HashMap()); + client.dictionarys().putEmpty(body); } @Test public void getNull() throws Exception { - DictionaryWrapper result = client.getDictionaryOperations().getNull().getBody(); - Assert.assertNull(result.getDefaultProgram()); + DictionaryWrapper result = client.dictionarys().getNull().getBody(); + Assert.assertNull(result.defaultProgram()); } @Test public void getNotProvided() throws Exception { - DictionaryWrapper result = client.getDictionaryOperations().getNotProvided().getBody(); - Assert.assertNull(result.getDefaultProgram()); + DictionaryWrapper result = client.dictionarys().getNotProvided().getBody(); + Assert.assertNull(result.defaultProgram()); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/InheritanceTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/InheritanceTests.java index 5ba3c420d2846..e09fa895e7738 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/InheritanceTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/InheritanceTests.java @@ -1,5 +1,6 @@ package fixtures.bodycomplex; +import fixtures.bodycomplex.implementation.AutoRestComplexTestServiceImpl; import fixtures.bodycomplex.models.Dog; import fixtures.bodycomplex.models.Siamese; import org.junit.Assert; @@ -18,32 +19,32 @@ public static void setup() { @Test public void getValid() throws Exception { - Siamese result = client.getInheritanceOperations().getValid().getBody(); - Assert.assertEquals("persian", result.getBreed()); - Assert.assertEquals("green", result.getColor()); - Assert.assertEquals(2, result.getId().intValue()); - Assert.assertEquals("Siameeee", result.getName()); - Assert.assertEquals("french fries", result.getHates().get(1).getFood()); + Siamese result = client.inheritances().getValid().getBody(); + Assert.assertEquals("persian", result.breed()); + Assert.assertEquals("green", result.color()); + Assert.assertEquals(2, result.id().intValue()); + Assert.assertEquals("Siameeee", result.name()); + Assert.assertEquals("french fries", result.hates().get(1).food()); } @Test public void putValid() throws Exception { Siamese body = new Siamese(); - body.setBreed("persian"); - body.setColor("green"); - body.setId(2); - body.setName("Siameeee"); - body.setHates(new ArrayList()); + body.withBreed("persian"); + body.withColor("green"); + body.withId(2); + body.withName("Siameeee"); + body.withHates(new ArrayList()); Dog dog1 = new Dog(); - dog1.setName("Potato"); - dog1.setId(1); - dog1.setFood("tomato"); - body.getHates().add(dog1); + dog1.withName("Potato"); + dog1.withId(1); + dog1.withFood("tomato"); + body.hates().add(dog1); Dog dog2 = new Dog(); - dog2.setFood("french fries"); - dog2.setId(-1); - dog2.setName("Tomato"); - body.getHates().add(dog2); - client.getInheritanceOperations().putValid(body); + dog2.withFood("french fries"); + dog2.withId(-1); + dog2.withName("Tomato"); + body.hates().add(dog2); + client.inheritances().putValid(body); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PolymorphismTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PolymorphismTests.java index 4af305dcc2fca..15beeb8dacb87 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PolymorphismTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PolymorphismTests.java @@ -1,11 +1,5 @@ package fixtures.bodycomplex; -import okhttp3.logging.HttpLoggingInterceptor; -import fixtures.bodycomplex.models.Fish; -import fixtures.bodycomplex.models.Goblinshark; -import fixtures.bodycomplex.models.Salmon; -import fixtures.bodycomplex.models.Sawshark; -import fixtures.bodycomplex.models.Shark; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.junit.Assert; @@ -14,96 +8,102 @@ import java.util.ArrayList; +import fixtures.bodycomplex.implementation.AutoRestComplexTestServiceImpl; +import fixtures.bodycomplex.models.Fish; +import fixtures.bodycomplex.models.Goblinshark; +import fixtures.bodycomplex.models.Salmon; +import fixtures.bodycomplex.models.Sawshark; +import fixtures.bodycomplex.models.Shark; + public class PolymorphismTests { private static AutoRestComplexTestService client; @BeforeClass public static void setup() { client = new AutoRestComplexTestServiceImpl("http://localhost:3000"); - client.setLogLevel(HttpLoggingInterceptor.Level.BODY); } @Test public void getValid() throws Exception { - Fish result = client.getPolymorphismOperations().getValid().getBody(); + Fish result = client.polymorphisms().getValid().getBody(); Assert.assertEquals(Salmon.class, result.getClass()); Salmon salmon = (Salmon) result; - Assert.assertEquals("alaska", salmon.getLocation()); - Assert.assertEquals(1.0, salmon.getLength(), 0f); - Assert.assertEquals(3, salmon.getSiblings().size()); - Assert.assertEquals(Shark.class, salmon.getSiblings().get(0).getClass()); - Shark sib1 = (Shark) (salmon.getSiblings().get(0)); - Assert.assertEquals(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC), sib1.getBirthday()); - Assert.assertEquals(Sawshark.class, salmon.getSiblings().get(1).getClass()); - Sawshark sib2 = (Sawshark) (salmon.getSiblings().get(1)); + Assert.assertEquals("alaska", salmon.location()); + Assert.assertEquals(1.0, salmon.length(), 0f); + Assert.assertEquals(3, salmon.siblings().size()); + Assert.assertEquals(Shark.class, salmon.siblings().get(0).getClass()); + Shark sib1 = (Shark) (salmon.siblings().get(0)); + Assert.assertEquals(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC), sib1.birthday()); + Assert.assertEquals(Sawshark.class, salmon.siblings().get(1).getClass()); + Sawshark sib2 = (Sawshark) (salmon.siblings().get(1)); Assert.assertArrayEquals( new byte[]{(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254}, - sib2.getPicture()); - Goblinshark sib3 = (Goblinshark) (salmon.getSiblings().get(2)); - Assert.assertEquals(1, sib3.getAge().longValue()); - Assert.assertEquals(5, sib3.getJawsize().longValue()); + sib2.picture()); + Goblinshark sib3 = (Goblinshark) (salmon.siblings().get(2)); + Assert.assertEquals(1, sib3.age().longValue()); + Assert.assertEquals(5, sib3.jawsize().longValue()); } @Test public void putValid() throws Exception { Salmon body = new Salmon(); - body.setLocation("alaska"); - body.setIswild(true); - body.setSpecies("king"); - body.setLength(1.0); - body.setSiblings(new ArrayList()); + body.withLocation("alaska"); + body.withIswild(true); + body.withSpecies("king"); + body.withLength(1.0); + body.withSiblings(new ArrayList()); Shark sib1 = new Shark(); - sib1.setAge(6); - sib1.setBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC)); - sib1.setLength(20.0); - sib1.setSpecies("predator"); - body.getSiblings().add(sib1); + sib1.withAge(6); + sib1.withBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC)); + sib1.withLength(20.0); + sib1.withSpecies("predator"); + body.siblings().add(sib1); Sawshark sib2 = new Sawshark(); - sib2.setAge(105); - sib2.setBirthday(new DateTime(1900, 1, 5, 1, 0, 0, DateTimeZone.UTC)); - sib2.setLength(10.0); - sib2.setPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254}); - sib2.setSpecies("dangerous"); - body.getSiblings().add(sib2); + sib2.withAge(105); + sib2.withBirthday(new DateTime(1900, 1, 5, 1, 0, 0, DateTimeZone.UTC)); + sib2.withLength(10.0); + sib2.withPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254}); + sib2.withSpecies("dangerous"); + body.siblings().add(sib2); Goblinshark sib3 = new Goblinshark(); - sib3.setAge(1); - sib3.setBirthday(new DateTime(2015, 8, 8, 0, 0, 0, DateTimeZone.UTC)); - sib3.setLength(30.0); - sib3.setSpecies("scary"); - sib3.setJawsize(5); - body.getSiblings().add(sib3); + sib3.withAge(1); + sib3.withBirthday(new DateTime(2015, 8, 8, 0, 0, 0, DateTimeZone.UTC)); + sib3.withLength(30.0); + sib3.withSpecies("scary"); + sib3.withJawsize(5); + body.siblings().add(sib3); - client.getPolymorphismOperations().putValid(body); + client.polymorphisms().putValid(body); } @Test public void putValidMissingRequired() throws Exception { try { Salmon body = new Salmon(); - body.setLocation("alaska"); - body.setIswild(true); - body.setSpecies("king"); - body.setLength(1.0); - body.setSiblings(new ArrayList()); + body.withLocation("alaska"); + body.withIswild(true); + body.withSpecies("king"); + body.withLength(1.0); + body.withSiblings(new ArrayList()); Shark sib1 = new Shark(); - sib1.setAge(6); - sib1.setBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC)); - sib1.setLength(20.0); - sib1.setSpecies("predator"); - body.getSiblings().add(sib1); + sib1.withAge(6); + sib1.withBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC)); + sib1.withLength(20.0); + sib1.withSpecies("predator"); + body.siblings().add(sib1); Sawshark sib2 = new Sawshark(); - sib2.setAge(105); - sib2.setLength(10.0); - sib2.setPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254}); - sib2.setSpecies("dangerous"); - body.getSiblings().add(sib2); + sib2.withAge(105); + sib2.withLength(10.0); + sib2.withPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254}); + sib2.withSpecies("dangerous"); + body.siblings().add(sib2); - client.getPolymorphismOperations().putValidMissingRequired(body); + client.polymorphisms().putValidMissingRequired(body); } catch (IllegalArgumentException ex) { //expected Assert.assertTrue(ex.getMessage().contains("siblings.birthday is required and cannot be null.")); diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PolymorphismrecursiveTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PolymorphismrecursiveTests.java index 375ce7dd0d6aa..3bab189154c3d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PolymorphismrecursiveTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PolymorphismrecursiveTests.java @@ -1,5 +1,6 @@ package fixtures.bodycomplex; +import fixtures.bodycomplex.implementation.AutoRestComplexTestServiceImpl; import fixtures.bodycomplex.models.Fish; import fixtures.bodycomplex.models.Salmon; import fixtures.bodycomplex.models.Sawshark; @@ -22,66 +23,66 @@ public static void setup() { @Test public void getValid() throws Exception { - Fish result = client.getPolymorphicrecursiveOperations().getValid().getBody(); + Fish result = client.polymorphicrecursives().getValid().getBody(); Salmon salmon = (Salmon) result; - Shark sib1 = (Shark) (salmon.getSiblings().get(0)); - Salmon sib2 = (Salmon) (sib1.getSiblings().get(0)); - Shark sib3 = (Shark) (sib2.getSiblings().get(0)); + Shark sib1 = (Shark) (salmon.siblings().get(0)); + Salmon sib2 = (Salmon) (sib1.siblings().get(0)); + Shark sib3 = (Shark) (sib2.siblings().get(0)); Assert.assertEquals( new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC), - sib3.getBirthday()); + sib3.birthday()); } @Test public void putValid() throws Exception { Salmon body = new Salmon(); - body.setLocation("alaska"); - body.setIswild(true); - body.setSpecies("king"); - body.setLength(1.0); - body.setSiblings(new ArrayList()); + body.withLocation("alaska"); + body.withIswild(true); + body.withSpecies("king"); + body.withLength(1.0); + body.withSiblings(new ArrayList()); Shark sib1 = new Shark(); - sib1.setAge(6); - sib1.setBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC)); - sib1.setLength(20.0); - sib1.setSpecies("predator"); - sib1.setSiblings(new ArrayList()); - body.getSiblings().add(sib1); + sib1.withAge(6); + sib1.withBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC)); + sib1.withLength(20.0); + sib1.withSpecies("predator"); + sib1.withSiblings(new ArrayList()); + body.siblings().add(sib1); Sawshark sib2 = new Sawshark(); - sib2.setAge(105); - sib2.setBirthday(new DateTime(1900, 1, 5, 1, 0, 0, DateTimeZone.UTC)); - sib2.setLength(10.0); - sib2.setPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254}); - sib2.setSpecies("dangerous"); - sib2.setSiblings(new ArrayList()); - body.getSiblings().add(sib2); + sib2.withAge(105); + sib2.withBirthday(new DateTime(1900, 1, 5, 1, 0, 0, DateTimeZone.UTC)); + sib2.withLength(10.0); + sib2.withPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254}); + sib2.withSpecies("dangerous"); + sib2.withSiblings(new ArrayList()); + body.siblings().add(sib2); Salmon sib11 = new Salmon(); - sib11.setIswild(true); - sib11.setLocation("atlantic"); - sib11.setSpecies("coho"); - sib11.setLength(2); - sib11.setSiblings(new ArrayList()); - sib1.getSiblings().add(sib11); - sib1.getSiblings().add(sib2); + sib11.withIswild(true); + sib11.withLocation("atlantic"); + sib11.withSpecies("coho"); + sib11.withLength(2); + sib11.withSiblings(new ArrayList()); + sib1.siblings().add(sib11); + sib1.siblings().add(sib2); Shark sib111 = new Shark(); - sib111.setAge(6); - sib111.setBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC)); - sib111.setSpecies("predator"); - sib111.setLength(20); - sib11.getSiblings().add(sib111); + sib111.withAge(6); + sib111.withBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC)); + sib111.withSpecies("predator"); + sib111.withLength(20); + sib11.siblings().add(sib111); Sawshark sib112 = new Sawshark(); - sib112.setAge(105); - sib112.setBirthday(new DateTime(1900, 1, 5, 1, 0, 0, DateTimeZone.UTC)); - sib112.setLength(10.0); - sib112.setPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254}); - sib112.setSpecies("dangerous"); - sib11.getSiblings().add(sib112); + sib112.withAge(105); + sib112.withBirthday(new DateTime(1900, 1, 5, 1, 0, 0, DateTimeZone.UTC)); + sib112.withLength(10.0); + sib112.withPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254}); + sib112.withSpecies("dangerous"); + sib11.siblings().add(sib112); - client.getPolymorphicrecursiveOperations().putValid(body); + client.polymorphicrecursives().putValid(body); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PrimitiveTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PrimitiveTests.java index 816ffac6e516b..2736d3a411949 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PrimitiveTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/PrimitiveTests.java @@ -8,6 +8,7 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.bodycomplex.implementation.AutoRestComplexTestServiceImpl; import fixtures.bodycomplex.models.BooleanWrapper; import fixtures.bodycomplex.models.ByteWrapper; import fixtures.bodycomplex.models.DateWrapper; @@ -30,163 +31,163 @@ public static void setup() { @Test public void getInt() throws Exception { - IntWrapper result = client.getPrimitiveOperations().getInt().getBody(); - Assert.assertEquals(Integer.valueOf(-1), result.getField1()); - Assert.assertEquals(Integer.valueOf(2), result.getField2()); + IntWrapper result = client.primitives().getInt().getBody(); + Assert.assertEquals(Integer.valueOf(-1), result.field1()); + Assert.assertEquals(Integer.valueOf(2), result.field2()); } @Test public void putInt() throws Exception { IntWrapper body = new IntWrapper(); - body.setField1(-1); - body.setField2(2); - client.getPrimitiveOperations().putInt(body); + body.withField1(-1); + body.withField2(2); + client.primitives().putInt(body); } @Test public void getLong() throws Exception { - LongWrapper result = client.getPrimitiveOperations().getLong().getBody(); - Assert.assertEquals(Long.valueOf(1099511627775L), result.getField1()); - Assert.assertEquals(Long.valueOf(-999511627788L), result.getField2()); + LongWrapper result = client.primitives().getLong().getBody(); + Assert.assertEquals(Long.valueOf(1099511627775L), result.field1()); + Assert.assertEquals(Long.valueOf(-999511627788L), result.field2()); } @Test public void putLong() throws Exception { LongWrapper body = new LongWrapper(); - body.setField1(1099511627775L); - body.setField2(-999511627788L); - client.getPrimitiveOperations().putLong(body); + body.withField1(1099511627775L); + body.withField2(-999511627788L); + client.primitives().putLong(body); } @Test public void getFloat() throws Exception { - FloatWrapper result = client.getPrimitiveOperations().getFloat().getBody(); - Assert.assertEquals(1.05, result.getField1(), 0f); - Assert.assertEquals(-0.003, result.getField2(), 0f); + FloatWrapper result = client.primitives().getFloat().getBody(); + Assert.assertEquals(1.05, result.field1(), 0f); + Assert.assertEquals(-0.003, result.field2(), 0f); } @Test public void putFloat() throws Exception { FloatWrapper body = new FloatWrapper(); - body.setField1(1.05); - body.setField2(-0.003); - client.getPrimitiveOperations().putFloat(body); + body.withField1(1.05); + body.withField2(-0.003); + client.primitives().putFloat(body); } @Test public void getDouble() throws Exception { - DoubleWrapper result = client.getPrimitiveOperations().getDouble().getBody(); - Assert.assertEquals(3e-100, result.getField1(), 0f); + DoubleWrapper result = client.primitives().getDouble().getBody(); + Assert.assertEquals(3e-100, result.field1(), 0f); Assert.assertEquals(-0.000000000000000000000000000000000000000000000000000000005, - result.getField56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose(), + result.field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose(), 0f); } @Test public void putDouble() throws Exception { DoubleWrapper body = new DoubleWrapper(); - body.setField1(3e-100); - body.setField56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose(-5e-57); - client.getPrimitiveOperations().putDouble(body); + body.withField1(3e-100); + body.withField56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose(-5e-57); + client.primitives().putDouble(body); } @Test public void getBool() throws Exception { - BooleanWrapper result = client.getPrimitiveOperations().getBool().getBody(); - Assert.assertEquals(true, result.getFieldTrue()); - Assert.assertEquals(false, result.getFieldFalse()); + BooleanWrapper result = client.primitives().getBool().getBody(); + Assert.assertEquals(true, result.fieldTrue()); + Assert.assertEquals(false, result.fieldFalse()); } @Test public void putBool() throws Exception { BooleanWrapper body = new BooleanWrapper(); - body.setFieldFalse(false); - body.setFieldTrue(true); - client.getPrimitiveOperations().putBool(body); + body.withFieldFalse(false); + body.withFieldTrue(true); + client.primitives().putBool(body); } @Test public void getString() throws Exception { - StringWrapper result = client.getPrimitiveOperations().getString().getBody(); - Assert.assertEquals("goodrequest", result.getField()); - Assert.assertEquals("", result.getEmpty()); - Assert.assertEquals(null, result.getNullProperty()); + StringWrapper result = client.primitives().getString().getBody(); + Assert.assertEquals("goodrequest", result.field()); + Assert.assertEquals("", result.empty()); + Assert.assertEquals(null, result.nullProperty()); } @Test public void putString() throws Exception { StringWrapper body = new StringWrapper(); - body.setField("goodrequest"); - body.setEmpty(""); - client.getPrimitiveOperations().putString(body); + body.withField("goodrequest"); + body.withEmpty(""); + client.primitives().putString(body); } @Test public void getDate() throws Exception { - DateWrapper result = client.getPrimitiveOperations().getDate().getBody(); - Assert.assertEquals(new LocalDate(1, 1, 1), result.getField()); - Assert.assertEquals(new LocalDate(2016, 2, 29), result.getLeap()); + DateWrapper result = client.primitives().getDate().getBody(); + Assert.assertEquals(new LocalDate(1, 1, 1), result.field()); + Assert.assertEquals(new LocalDate(2016, 2, 29), result.leap()); } @Test public void putDate() throws Exception { DateWrapper body = new DateWrapper(); - body.setField(new LocalDate(1, 1, 1)); - body.setLeap(new LocalDate(2016, 2, 29)); - client.getPrimitiveOperations().putDate(body); + body.withField(new LocalDate(1, 1, 1)); + body.withLeap(new LocalDate(2016, 2, 29)); + client.primitives().putDate(body); } @Test public void getDateTime() throws Exception { - DatetimeWrapper result = client.getPrimitiveOperations().getDateTime().getBody(); - Assert.assertEquals(new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC), result.getField()); - Assert.assertEquals(new DateTime(2015, 5, 18, 18, 38, 0, DateTimeZone.UTC), result.getNow()); + DatetimeWrapper result = client.primitives().getDateTime().getBody(); + Assert.assertEquals(new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC), result.field()); + Assert.assertEquals(new DateTime(2015, 5, 18, 18, 38, 0, DateTimeZone.UTC), result.now()); } @Test public void putDateTime() throws Exception { DatetimeWrapper body = new DatetimeWrapper(); - body.setField(new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC)); - body.setNow(new DateTime(2015, 5, 18, 18, 38, 0, DateTimeZone.UTC)); - client.getPrimitiveOperations().putDateTime(body); + body.withField(new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC)); + body.withNow(new DateTime(2015, 5, 18, 18, 38, 0, DateTimeZone.UTC)); + client.primitives().putDateTime(body); } @Test public void getDateTimeRfc1123() throws Exception { - Datetimerfc1123Wrapper result = client.getPrimitiveOperations().getDateTimeRfc1123().getBody(); - Assert.assertEquals(new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC), result.getField()); - Assert.assertEquals(new DateTime(2015, 5, 18, 11, 38, 0, DateTimeZone.UTC), result.getNow()); + Datetimerfc1123Wrapper result = client.primitives().getDateTimeRfc1123().getBody(); + Assert.assertEquals(new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC), result.field()); + Assert.assertEquals(new DateTime(2015, 5, 18, 11, 38, 0, DateTimeZone.UTC), result.now()); } @Test public void putDateTimeRfc1123() throws Exception { Datetimerfc1123Wrapper body = new Datetimerfc1123Wrapper(); - body.setField(new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC)); - body.setNow(new DateTime(2015, 5, 18, 11, 38, 0, DateTimeZone.UTC)); - client.getPrimitiveOperations().putDateTimeRfc1123(body); + body.withField(new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC)); + body.withNow(new DateTime(2015, 5, 18, 11, 38, 0, DateTimeZone.UTC)); + client.primitives().putDateTimeRfc1123(body); } @Test public void getDuration() throws Exception { - DurationWrapper result = client.getPrimitiveOperations().getDuration().getBody(); - Assert.assertEquals(new Period(0, 0, 0, 123, 22, 14, 12, 11), result.getField()); + DurationWrapper result = client.primitives().getDuration().getBody(); + Assert.assertEquals(new Period(0, 0, 0, 123, 22, 14, 12, 11), result.field()); } @Test public void putDuration() throws Exception { DurationWrapper body = new DurationWrapper(); - body.setField(new Period(0, 0, 0, 123, 22, 14, 12, 11)); - client.getPrimitiveOperations().putDuration(body); + body.withField(new Period(0, 0, 0, 123, 22, 14, 12, 11)); + client.primitives().putDuration(body); } @Test public void getByte() throws Exception { - ByteWrapper result = client.getPrimitiveOperations().getByte().getBody(); + ByteWrapper result = client.primitives().getByte().getBody(); byte[] expected = new byte[] { (byte) 255, (byte) 254, (byte) 253, (byte) 252, (byte) 0, (byte) 250, (byte) 249, (byte) 248, (byte) 247, (byte) 246 }; - Assert.assertArrayEquals(expected, result.getField()); + Assert.assertArrayEquals(expected, result.field()); } @Test @@ -196,7 +197,7 @@ public void putByte() throws Exception { (byte) 255, (byte) 254, (byte) 253, (byte) 252, (byte) 0, (byte) 250, (byte) 249, (byte) 248, (byte) 247, (byte) 246 }; - body.setField(byteArray); - client.getPrimitiveOperations().putByte(body); + body.withField(byteArray); + client.primitives().putByte(body); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/ReadonlypropertyTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/ReadonlypropertyTests.java index a0337208d4415..9f57030634f36 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/ReadonlypropertyTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodycomplex/ReadonlypropertyTests.java @@ -1,5 +1,6 @@ package fixtures.bodycomplex; +import fixtures.bodycomplex.implementation.AutoRestComplexTestServiceImpl; import fixtures.bodycomplex.models.ReadonlyObj; import org.junit.BeforeClass; import org.junit.Test; @@ -14,7 +15,7 @@ public static void setup() { @Test public void putReadOnlyPropertyValid() throws Exception { - ReadonlyObj o = client.getReadonlypropertyOperations().getValid().getBody(); - client.getReadonlypropertyOperations().putValid(o).getResponse().code(); + ReadonlyObj o = client.readonlypropertys().getValid().getBody(); + client.readonlypropertys().putValid(o).getResponse().code(); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydate/DateOperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydate/DateOperationsTests.java index 403550f0c480f..60c67eb5af2ad 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydate/DateOperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydate/DateOperationsTests.java @@ -8,6 +8,8 @@ import java.util.concurrent.CountDownLatch; +import fixtures.bodydate.implementation.AutoRestDateTestServiceImpl; + public class DateOperationsTests { private static AutoRestDateTestService client; private CountDownLatch lock = new CountDownLatch(1); @@ -19,13 +21,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getDateOperations().getNull().getBody()); + Assert.assertNull(client.dates().getNull().getBody()); } @Test public void getInvalidDate() throws Exception { try { - client.getDateOperations().getInvalidDate(); + client.dates().getInvalidDate(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -36,7 +38,7 @@ public void getInvalidDate() throws Exception { @Test public void getOverflowDate() throws Exception { try { - client.getDateOperations().getOverflowDate(); + client.dates().getOverflowDate(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -47,7 +49,7 @@ public void getOverflowDate() throws Exception { @Test public void getUnderflowDate() throws Exception { try { - client.getDateOperations().getUnderflowDate(); + client.dates().getUnderflowDate(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -58,26 +60,26 @@ public void getUnderflowDate() throws Exception { @Test public void putMaxDate() throws Exception { LocalDate body = new LocalDate(9999, 12, 31); - client.getDateOperations().putMaxDate(body); + client.dates().putMaxDate(body); } @Test public void getMaxDate() throws Exception { LocalDate expected = new LocalDate(9999, 12, 31); - LocalDate result = client.getDateOperations().getMaxDate().getBody(); + LocalDate result = client.dates().getMaxDate().getBody(); Assert.assertEquals(expected, result); } @Test public void putMinDate() throws Exception { LocalDate body = new LocalDate(1, 1, 1); - client.getDateOperations().putMinDate(body); + client.dates().putMinDate(body); } @Test public void getMinDate() throws Exception { LocalDate expected = new LocalDate(1, 1, 1); - LocalDate result = client.getDateOperations().getMinDate().getBody(); + LocalDate result = client.dates().getMinDate().getBody(); Assert.assertEquals(expected, result); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydatetime/DatetimeOperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydatetime/DatetimeOperationsTests.java index 99c3b9aacf740..f9903a075db87 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydatetime/DatetimeOperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydatetime/DatetimeOperationsTests.java @@ -7,6 +7,8 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.bodydatetime.implementation.AutoRestDateTimeTestServiceImpl; + public class DatetimeOperationsTests { private static AutoRestDateTimeTestService client; @@ -17,13 +19,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getDatetimeOperations().getNull().getBody()); + Assert.assertNull(client.datetimes().getNull().getBody()); } @Test public void getInvalidDate() throws Exception { try { - client.getDatetimeOperations().getInvalid(); + client.datetimes().getInvalid(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -33,7 +35,7 @@ public void getInvalidDate() throws Exception { @Test public void getOverflowDate() throws Exception { - DateTime result = client.getDatetimeOperations().getOverflow().getBody(); + DateTime result = client.datetimes().getOverflow().getBody(); // 9999-12-31T23:59:59.999-14:000 DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.forOffsetHours(-14)); expected = expected.toDateTime(DateTimeZone.UTC); @@ -43,7 +45,7 @@ public void getOverflowDate() throws Exception { @Test public void getUnderflowDate() throws Exception { try { - client.getDatetimeOperations().getUnderflow(); + client.datetimes().getUnderflow(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -54,19 +56,19 @@ public void getUnderflowDate() throws Exception { @Test public void putUtcMaxDateTime() throws Exception { DateTime body = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.UTC); - client.getDatetimeOperations().putUtcMaxDateTime(body); + client.datetimes().putUtcMaxDateTime(body); } @Test public void getUtcLowercaseMaxDateTime() throws Exception { - DateTime result = client.getDatetimeOperations().getUtcLowercaseMaxDateTime().getBody(); + DateTime result = client.datetimes().getUtcLowercaseMaxDateTime().getBody(); DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.UTC); Assert.assertEquals(expected, result); } @Test public void getUtcUppercaseMaxDateTime() throws Exception { - DateTime result = client.getDatetimeOperations().getUtcUppercaseMaxDateTime().getBody(); + DateTime result = client.datetimes().getUtcUppercaseMaxDateTime().getBody(); DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.UTC); Assert.assertEquals(expected, result); } @@ -74,19 +76,19 @@ public void getUtcUppercaseMaxDateTime() throws Exception { @Test public void putLocalPositiveOffsetMaxDateTime() throws Exception { DateTime body = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.forOffsetHours(14)); - client.getDatetimeOperations().putLocalPositiveOffsetMaxDateTime(body); + client.datetimes().putLocalPositiveOffsetMaxDateTime(body); } @Test public void getLocalPositiveOffsetLowercaseMaxDateTime() throws Exception { - DateTime result = client.getDatetimeOperations().getLocalPositiveOffsetLowercaseMaxDateTime().getBody(); + DateTime result = client.datetimes().getLocalPositiveOffsetLowercaseMaxDateTime().getBody(); DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.forOffsetHours(14)).toDateTime(DateTimeZone.UTC); Assert.assertEquals(expected, result); } @Test public void getLocalPositiveOffsetUppercaseMaxDateTime() throws Exception { - DateTime result = client.getDatetimeOperations().getLocalPositiveOffsetUppercaseMaxDateTime().getBody(); + DateTime result = client.datetimes().getLocalPositiveOffsetUppercaseMaxDateTime().getBody(); DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.forOffsetHours(14)).toDateTime(DateTimeZone.UTC); Assert.assertEquals(expected, result); } @@ -94,19 +96,19 @@ public void getLocalPositiveOffsetUppercaseMaxDateTime() throws Exception { @Test public void putLocalNegativeOffsetMaxDateTime() throws Exception { DateTime body = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.forOffsetHours(-14)); - client.getDatetimeOperations().putLocalNegativeOffsetMaxDateTime(body); + client.datetimes().putLocalNegativeOffsetMaxDateTime(body); } @Test public void getLocalNegativeOffsetLowercaseMaxDateTime() throws Exception { - DateTime result = client.getDatetimeOperations().getLocalNegativeOffsetLowercaseMaxDateTime().getBody(); + DateTime result = client.datetimes().getLocalNegativeOffsetLowercaseMaxDateTime().getBody(); DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.forOffsetHours(-14)).toDateTime(DateTimeZone.UTC); Assert.assertEquals(expected, result); } @Test public void getLocalNegativeOffsetUppercaseMaxDateTime() throws Exception { - DateTime result = client.getDatetimeOperations().getLocalNegativeOffsetUppercaseMaxDateTime().getBody(); + DateTime result = client.datetimes().getLocalNegativeOffsetUppercaseMaxDateTime().getBody(); DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.forOffsetHours(-14)).toDateTime(DateTimeZone.UTC); Assert.assertEquals(expected, result); } @@ -114,12 +116,12 @@ public void getLocalNegativeOffsetUppercaseMaxDateTime() throws Exception { @Test public void putUtcMinDateTime() throws Exception { DateTime body = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC); - client.getDatetimeOperations().putUtcMinDateTime(body); + client.datetimes().putUtcMinDateTime(body); } @Test public void getUtcMinDateTime() throws Exception { - DateTime result = client.getDatetimeOperations().getUtcMinDateTime().getBody(); + DateTime result = client.datetimes().getUtcMinDateTime().getBody(); DateTime expected = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC); Assert.assertEquals(expected, result); } @@ -127,12 +129,12 @@ public void getUtcMinDateTime() throws Exception { @Test public void putLocalPositiveOffsetMinDateTime() throws Exception { DateTime body = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeZone.forOffsetHours(14)); - client.getDatetimeOperations().putLocalPositiveOffsetMinDateTime(body); + client.datetimes().putLocalPositiveOffsetMinDateTime(body); } @Test public void getLocalPositiveOffsetMinDateTime() throws Exception { - DateTime result = client.getDatetimeOperations().getLocalPositiveOffsetMinDateTime().getBody(); + DateTime result = client.datetimes().getLocalPositiveOffsetMinDateTime().getBody(); DateTime expected = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeZone.forOffsetHours(14)).toDateTime(DateTimeZone.UTC); Assert.assertEquals(expected, result); } @@ -140,12 +142,12 @@ public void getLocalPositiveOffsetMinDateTime() throws Exception { @Test public void putLocalNegativeOffsetMinDateTime() throws Exception { DateTime body = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeZone.forOffsetHours(-14)); - client.getDatetimeOperations().putLocalNegativeOffsetMinDateTime(body); + client.datetimes().putLocalNegativeOffsetMinDateTime(body); } @Test public void getLocalNegativeOffsetMinDateTime() throws Exception { - DateTime result = client.getDatetimeOperations().getLocalNegativeOffsetMinDateTime().getBody(); + DateTime result = client.datetimes().getLocalNegativeOffsetMinDateTime().getBody(); DateTime expected = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeZone.forOffsetHours(-14)).toDateTime(DateTimeZone.UTC); Assert.assertEquals(expected, result); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydatetimerfc1123/DateTimeRfc1123OperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydatetimerfc1123/DateTimeRfc1123OperationsTests.java index a3a812301be87..b5fd26d4dd822 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydatetimerfc1123/DateTimeRfc1123OperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydatetimerfc1123/DateTimeRfc1123OperationsTests.java @@ -8,6 +8,8 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.bodydatetimerfc1123.implementation.AutoRestRFC1123DateTimeTestServiceImpl; + public class DateTimeRfc1123OperationsTests { private static AutoRestRFC1123DateTimeTestService client; @@ -18,13 +20,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getDatetimerfc1123Operations().getNull().getBody()); + Assert.assertNull(client.datetimerfc1123s().getNull().getBody()); } @Test public void getInvalidDate() throws Exception { try { - client.getDatetimerfc1123Operations().getInvalid(); + client.datetimerfc1123s().getInvalid(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -34,7 +36,7 @@ public void getInvalidDate() throws Exception { @Test public void getOverflowDate() throws Exception { - DateTime result = client.getDatetimerfc1123Operations().getOverflow().getBody(); + DateTime result = client.datetimerfc1123s().getOverflow().getBody(); DateTime expected = new DateTime(10000, 1, 1, 00, 00, 00, 0, DateTimeZone.UTC); expected = expected.toDateTime(DateTimeZone.UTC); Assert.assertEquals(expected, result); @@ -43,7 +45,7 @@ public void getOverflowDate() throws Exception { @Test public void getUnderflowDate() throws Exception { try { - client.getDatetimerfc1123Operations().getUnderflow(); + client.datetimerfc1123s().getUnderflow(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -54,19 +56,19 @@ public void getUnderflowDate() throws Exception { @Test public void putUtcMaxDateTime() throws Exception { DateTime body = new DateTime(9999, 12, 31, 23, 59, 59, 0, DateTimeZone.UTC); - client.getDatetimerfc1123Operations().putUtcMaxDateTime(body); + client.datetimerfc1123s().putUtcMaxDateTime(body); } @Test public void getUtcLowercaseMaxDateTime() throws Exception { - DateTime result = client.getDatetimerfc1123Operations().getUtcLowercaseMaxDateTime().getBody(); + DateTime result = client.datetimerfc1123s().getUtcLowercaseMaxDateTime().getBody(); DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 0, DateTimeZone.UTC); Assert.assertEquals(expected, result); } @Test public void getUtcUppercaseMaxDateTime() throws Exception { - DateTime result = client.getDatetimerfc1123Operations().getUtcUppercaseMaxDateTime().getBody(); + DateTime result = client.datetimerfc1123s().getUtcUppercaseMaxDateTime().getBody(); DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 0, DateTimeZone.UTC); Assert.assertEquals(expected, result); } @@ -74,12 +76,12 @@ public void getUtcUppercaseMaxDateTime() throws Exception { @Test public void putUtcMinDateTime() throws Exception { DateTime body = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC); - client.getDatetimerfc1123Operations().putUtcMinDateTime(body); + client.datetimerfc1123s().putUtcMinDateTime(body); } @Test public void getUtcMinDateTime() throws Exception { - DateTime result = client.getDatetimerfc1123Operations().getUtcMinDateTime().getBody(); + DateTime result = client.datetimerfc1123s().getUtcMinDateTime().getBody(); DateTime expected = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC); Assert.assertEquals(expected, result); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydictionary/DictionaryTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydictionary/DictionaryTests.java index 5330fdfb88785..cf7eac68cfb39 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydictionary/DictionaryTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodydictionary/DictionaryTests.java @@ -3,6 +3,8 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.exc.InvalidFormatException; + +import fixtures.bodydictionary.implementation.AutoRestSwaggerBATdictionaryServiceImpl; import fixtures.bodydictionary.models.Widget; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -29,13 +31,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getDictionaryOperations().getNull().getBody()); + Assert.assertNull(client.dictionarys().getNull().getBody()); } @Test public void getInvalid() throws Exception { try { - client.getDictionaryOperations().getInvalid(); + client.dictionarys().getInvalid(); fail(); } catch (JsonParseException exception) { // expected @@ -45,25 +47,25 @@ public void getInvalid() throws Exception { @Test public void getEmpty() throws Exception { - Map result = client.getDictionaryOperations().getEmpty().getBody(); + Map result = client.dictionarys().getEmpty().getBody(); Assert.assertEquals(0, result.keySet().size()); } @Test public void putEmpty() throws Exception { - client.getDictionaryOperations().putEmpty(new HashMap()); + client.dictionarys().putEmpty(new HashMap()); } @Test public void getNullValue() throws Exception { - Map result = client.getDictionaryOperations().getNullValue().getBody(); + Map result = client.dictionarys().getNullValue().getBody(); Assert.assertNull(result.get("key1")); } @Test public void getNullKey() throws Exception { try { - client.getDictionaryOperations().getNullKey(); + client.dictionarys().getNullKey(); fail(); } catch (JsonParseException exception) { // expected @@ -73,13 +75,13 @@ public void getNullKey() throws Exception { @Test public void getEmptyStringKey() throws Exception { - Map result = client.getDictionaryOperations().getEmptyStringKey().getBody(); + Map result = client.dictionarys().getEmptyStringKey().getBody(); Assert.assertEquals("val1", result.get("")); } @Test public void getBooleanTfft() throws Exception { - Map result = client.getDictionaryOperations().getBooleanTfft().getBody(); + Map result = client.dictionarys().getBooleanTfft().getBody(); Map expected = new HashMap(); expected.put("0", true); expected.put("1", false); @@ -95,19 +97,19 @@ public void putBooleanTfft() throws Exception { testData.put("1", false); testData.put("2", false); testData.put("3", true); - client.getDictionaryOperations().putBooleanTfft(testData); + client.dictionarys().putBooleanTfft(testData); } @Test public void getBooleanInvalidNull() throws Exception { - Map result = client.getDictionaryOperations().getBooleanInvalidNull().getBody(); + Map result = client.dictionarys().getBooleanInvalidNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getBooleanInvalidString() throws Exception { try { - Map result = client.getDictionaryOperations().getBooleanInvalidString().getBody(); + Map result = client.dictionarys().getBooleanInvalidString().getBody(); } catch (InvalidFormatException ex) { // expected Assert.assertTrue(ex.getMessage().contains("only \"true\" or \"false\" recognized")); @@ -116,7 +118,7 @@ public void getBooleanInvalidString() throws Exception { @Test public void getIntegerValid() throws Exception { - Map result = client.getDictionaryOperations().getIntegerValid().getBody(); + Map result = client.dictionarys().getIntegerValid().getBody(); Map expected = new HashMap(); expected.put("0", 1); expected.put("1", -1); @@ -132,19 +134,19 @@ public void putIntegerValid() throws Exception { testdata.put("1", -1); testdata.put("2", 3); testdata.put("3", 300); - client.getDictionaryOperations().putIntegerValid(testdata); + client.dictionarys().putIntegerValid(testdata); } @Test public void getIntInvalidNull() throws Exception { - Map result = client.getDictionaryOperations().getIntInvalidNull().getBody(); + Map result = client.dictionarys().getIntInvalidNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getIntInvalidString() throws Exception { try { - Map result = client.getDictionaryOperations().getIntInvalidString().getBody(); + Map result = client.dictionarys().getIntInvalidString().getBody(); fail(); } catch (InvalidFormatException ex) { // expected @@ -154,7 +156,7 @@ public void getIntInvalidString() throws Exception { @Test public void getLongValid() throws Exception { - Map result = client.getDictionaryOperations().getLongValid().getBody(); + Map result = client.dictionarys().getLongValid().getBody(); HashMap expected = new HashMap(); expected.put("0", 1L); expected.put("1", -1L); @@ -170,19 +172,19 @@ public void putLongValid() throws Exception { expected.put("1", -1L); expected.put("2", 3L); expected.put("3", 300L); - client.getDictionaryOperations().putLongValid(expected); + client.dictionarys().putLongValid(expected); } @Test public void getLongInvalidNull() throws Exception { - Map result = client.getDictionaryOperations().getLongInvalidNull().getBody(); + Map result = client.dictionarys().getLongInvalidNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getLongInvalidString() throws Exception { try { - Map result = client.getDictionaryOperations().getLongInvalidString().getBody(); + Map result = client.dictionarys().getLongInvalidString().getBody(); fail(); } catch (InvalidFormatException ex) { // expected @@ -192,7 +194,7 @@ public void getLongInvalidString() throws Exception { @Test public void getFloatValid() throws Exception { - Map result = client.getDictionaryOperations().getFloatValid().getBody(); + Map result = client.dictionarys().getFloatValid().getBody(); Map expected = new HashMap(); expected.put("0", 0d); expected.put("1", -0.01d); @@ -206,19 +208,19 @@ public void putFloatValid() throws Exception { testdata.put("0", 0d); testdata.put("1", -0.01d); testdata.put("2", -1.2e20d); - client.getDictionaryOperations().putFloatValid(testdata); + client.dictionarys().putFloatValid(testdata); } @Test public void getFloatInvalidNull() throws Exception { - Map result = client.getDictionaryOperations().getFloatInvalidNull().getBody(); + Map result = client.dictionarys().getFloatInvalidNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getFloatInvalidString() throws Exception { try { - Map result = client.getDictionaryOperations().getFloatInvalidString().getBody(); + Map result = client.dictionarys().getFloatInvalidString().getBody(); fail(); } catch (InvalidFormatException ex) { // expected @@ -228,7 +230,7 @@ public void getFloatInvalidString() throws Exception { @Test public void getDoubleValid() throws Exception { - Map result = client.getDictionaryOperations().getDoubleValid().getBody(); + Map result = client.dictionarys().getDoubleValid().getBody(); Map expected = new HashMap(); expected.put("0", 0d); expected.put("1", -0.01d); @@ -243,19 +245,19 @@ public void putDoubleValid() throws Exception { testdata.put("0", 0d); testdata.put("1", -0.01d); testdata.put("2", -1.2e20d); - client.getDictionaryOperations().putDoubleValid(testdata); + client.dictionarys().putDoubleValid(testdata); } @Test public void getDoubleInvalidNull() throws Exception { - Map result = client.getDictionaryOperations().getDoubleInvalidNull().getBody(); + Map result = client.dictionarys().getDoubleInvalidNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getDoubleInvalidString() throws Exception { try { - Map result = client.getDictionaryOperations().getDoubleInvalidString().getBody(); + Map result = client.dictionarys().getDoubleInvalidString().getBody(); fail(); } catch (InvalidFormatException ex) { // expected @@ -265,7 +267,7 @@ public void getDoubleInvalidString() throws Exception { @Test public void getStringValid() throws Exception { - Map result = client.getDictionaryOperations().getStringValid().getBody(); + Map result = client.dictionarys().getStringValid().getBody(); Map expected = new HashMap(); expected.put("0", "foo1"); expected.put("1", "foo2"); @@ -279,24 +281,24 @@ public void putStringValid() throws Exception { testdata.put("0", "foo1"); testdata.put("1", "foo2"); testdata.put("2", "foo3"); - client.getDictionaryOperations().putStringValid(testdata); + client.dictionarys().putStringValid(testdata); } @Test public void getStringWithNull() throws Exception { - Map result = client.getDictionaryOperations().getStringWithNull().getBody(); + Map result = client.dictionarys().getStringWithNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getStringWithInvalid() throws Exception { - Map result = client.getDictionaryOperations().getStringWithInvalid().getBody(); + Map result = client.dictionarys().getStringWithInvalid().getBody(); Assert.assertEquals("123", result.get("1")); } @Test public void getDateValid() throws Exception { - Map result = client.getDictionaryOperations().getDateValid().getBody(); + Map result = client.dictionarys().getDateValid().getBody(); Map expected = new HashMap(); expected.put("0", new LocalDate(2000, 12, 1)); expected.put("1", new LocalDate(1980, 1, 2)); @@ -310,19 +312,19 @@ public void putDateValid() throws Exception { testdata.put("0", new LocalDate(2000, 12, 1)); testdata.put("1", new LocalDate(1980, 1, 2)); testdata.put("2", new LocalDate(1492, 10, 12)); - client.getDictionaryOperations().putDateValid(testdata); + client.dictionarys().putDateValid(testdata); } @Test public void getDateInvalidNull() throws Exception { - Map result = client.getDictionaryOperations().getDateInvalidNull().getBody(); + Map result = client.dictionarys().getDateInvalidNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getDateInvalidString() throws Exception { try { - Map result = client.getDictionaryOperations().getDateInvalidChars().getBody(); + Map result = client.dictionarys().getDateInvalidChars().getBody(); fail(); } catch (JsonMappingException ex) { // expected @@ -332,7 +334,7 @@ public void getDateInvalidString() throws Exception { @Test public void getDateTimeValid() throws Exception { - Map result = client.getDictionaryOperations().getDateTimeValid().getBody(); + Map result = client.dictionarys().getDateTimeValid().getBody(); Map expected = new HashMap(); expected.put("0", new DateTime(2000, 12, 1, 0, 0, 1, DateTimeZone.UTC)); expected.put("1", new DateTime(1980, 1, 2, 0, 11, 35, DateTimeZone.forOffsetHours(1)) @@ -348,19 +350,19 @@ public void putDateTimeValid() throws Exception { testdata.put("0", new DateTime(2000, 12, 1, 0, 0, 1, DateTimeZone.UTC)); testdata.put("1", new DateTime(1980, 1, 2, 0, 11, 35, DateTimeZone.forOffsetHours(1))); testdata.put("2", new DateTime(1492, 10, 12, 10, 15, 1, DateTimeZone.forOffsetHours(-8))); - client.getDictionaryOperations().putDateTimeValid(testdata); + client.dictionarys().putDateTimeValid(testdata); } @Test public void getDateTimeInvalidNull() throws Exception { - Map result = client.getDictionaryOperations().getDateTimeInvalidNull().getBody(); + Map result = client.dictionarys().getDateTimeInvalidNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getDateTimeInvalidString() throws Exception { try { - Map result = client.getDictionaryOperations().getDateTimeInvalidChars().getBody(); + Map result = client.dictionarys().getDateTimeInvalidChars().getBody(); fail(); } catch (JsonMappingException ex) { // expected @@ -370,7 +372,7 @@ public void getDateTimeInvalidString() throws Exception { @Test public void getDateTimeRfc1123Valid() throws Exception { - Map result = client.getDictionaryOperations().getDateTimeRfc1123Valid().getBody(); + Map result = client.dictionarys().getDateTimeRfc1123Valid().getBody(); Map expected = new HashMap(); expected.put("0", new DateTime(2000, 12, 1, 0, 0, 1, DateTimeZone.UTC)); expected.put("1", new DateTime(1980, 1, 2, 0, 11, 35, DateTimeZone.UTC)); @@ -384,12 +386,12 @@ public void putDateTimeRfc1123Valid() throws Exception { testdata.put("0", new DateTime(2000, 12, 1, 0, 0, 1, DateTimeZone.UTC)); testdata.put("1", new DateTime(1980, 1, 2, 0, 11, 35, DateTimeZone.UTC)); testdata.put("2", new DateTime(1492, 10, 12, 10, 15, 1, DateTimeZone.UTC)); - client.getDictionaryOperations().putDateTimeRfc1123Valid(testdata); + client.dictionarys().putDateTimeRfc1123Valid(testdata); } @Test public void getDurationValid() throws Exception { - Map result = client.getDictionaryOperations().getDurationValid().getBody(); + Map result = client.dictionarys().getDurationValid().getBody(); Map expected = new HashMap(); expected.put("0", new Period(0, 0, 0, 123, 22, 14, 12, 11)); expected.put("1", new Period(0, 0, 0, 5, 1, 0, 0, 0)); @@ -401,12 +403,12 @@ public void putDurationValid() throws Exception { Map testdata = new HashMap(); testdata.put("0", new Period(0, 0, 0, 123, 22, 14, 12, 11)); testdata.put("1", new Period(0, 0, 0, 5, 1, 0, 0, 0)); - client.getDictionaryOperations().putDurationValid(testdata); + client.dictionarys().putDurationValid(testdata); } @Test public void getByteValid() throws Exception { - Map result = client.getDictionaryOperations().getByteValid().getBody(); + Map result = client.dictionarys().getByteValid().getBody(); Map expected = new HashMap(); expected.put("0", new byte[] {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFA}); expected.put("1", new byte[] {(byte) 0x01, (byte) 0x02, (byte) 0x03}); @@ -422,95 +424,95 @@ public void putByteValid() throws Exception { testdata.put("0", new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFA}); testdata.put("1", new byte[]{(byte) 0x01, (byte) 0x02, (byte) 0x03}); testdata.put("2", new byte[]{(byte) 0x25, (byte) 0x29, (byte) 0x43}); - client.getDictionaryOperations().putByteValid(testdata); + client.dictionarys().putByteValid(testdata); } @Test public void getByteInvalidNull() throws Exception { - Map result = client.getDictionaryOperations().getByteInvalidNull().getBody(); + Map result = client.dictionarys().getByteInvalidNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getComplexNull() throws Exception { - Map result = client.getDictionaryOperations().getComplexNull().getBody(); + Map result = client.dictionarys().getComplexNull().getBody(); Assert.assertNull(result); } @Test public void getComplexEmpty() throws Exception { - Map result = client.getDictionaryOperations().getComplexEmpty().getBody(); + Map result = client.dictionarys().getComplexEmpty().getBody(); Assert.assertEquals(0, result.size()); } @Test public void getComplexItemNull() throws Exception { - Map result = client.getDictionaryOperations().getComplexItemNull().getBody(); + Map result = client.dictionarys().getComplexItemNull().getBody(); Assert.assertEquals(3, result.size()); Assert.assertNull(result.get("1")); } @Test public void getComplexItemEmpty() throws Exception { - Map result = client.getDictionaryOperations().getComplexItemEmpty().getBody(); + Map result = client.dictionarys().getComplexItemEmpty().getBody(); Assert.assertEquals(3, result.size()); - Assert.assertNull(result.get("1").getInteger()); - Assert.assertNull(result.get("1").getStringProperty()); + Assert.assertNull(result.get("1").integer()); + Assert.assertNull(result.get("1").stringProperty()); } @Test public void getComplexValid() throws Exception { - Map result = client.getDictionaryOperations().getComplexValid().getBody(); + Map result = client.dictionarys().getComplexValid().getBody(); Assert.assertEquals(3, result.size()); - Assert.assertEquals(1, result.get("0").getInteger().intValue()); - Assert.assertEquals("4", result.get("1").getStringProperty()); + Assert.assertEquals(1, result.get("0").integer().intValue()); + Assert.assertEquals("4", result.get("1").stringProperty()); } @Test public void putComplexValid() throws Exception { Map body = new HashMap(); Widget w1 = new Widget(); - w1.setInteger(1); - w1.setStringProperty("2"); + w1.withInteger(1); + w1.withStringProperty("2"); body.put("0", w1); Widget w2 = new Widget(); - w2.setInteger(3); - w2.setStringProperty("4"); + w2.withInteger(3); + w2.withStringProperty("4"); body.put("1", w2); Widget w3 = new Widget(); - w3.setInteger(5); - w3.setStringProperty("6"); + w3.withInteger(5); + w3.withStringProperty("6"); body.put("2", w3); - client.getDictionaryOperations().putComplexValid(body); + client.dictionarys().putComplexValid(body); } @Test public void getArrayNull() throws Exception { - Map> result = client.getDictionaryOperations().getArrayNull().getBody(); + Map> result = client.dictionarys().getArrayNull().getBody(); Assert.assertNull(result); } @Test public void getArrayEmpty() throws Exception { - Map> result = client.getDictionaryOperations().getArrayEmpty().getBody(); + Map> result = client.dictionarys().getArrayEmpty().getBody(); Assert.assertEquals(0, result.size()); } @Test public void getArrayItemNull() throws Exception { - Map> result = client.getDictionaryOperations().getArrayItemNull().getBody(); + Map> result = client.dictionarys().getArrayItemNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getArrayItemEmpty() throws Exception { - Map> result = client.getDictionaryOperations().getArrayItemEmpty().getBody(); + Map> result = client.dictionarys().getArrayItemEmpty().getBody(); Assert.assertEquals(0, result.get("1").size()); } @Test public void getArrayValid() throws Exception { - Map> result = client.getDictionaryOperations().getArrayValid().getBody(); + Map> result = client.dictionarys().getArrayValid().getBody(); Assert.assertArrayEquals(new String[] {"1", "2", "3" }, result.get("0").toArray()); Assert.assertArrayEquals(new String[] {"4", "5", "6" }, result.get("1").toArray()); Assert.assertArrayEquals(new String[] {"7", "8", "9" }, result.get("2").toArray()); @@ -522,35 +524,35 @@ public void putArrayValid() throws Exception { body.put("0", Arrays.asList("1", "2", "3")); body.put("1", Arrays.asList("4", "5", "6")); body.put("2", Arrays.asList("7", "8", "9")); - client.getDictionaryOperations().putArrayValid(body); + client.dictionarys().putArrayValid(body); } @Test public void getDictionaryNull() throws Exception { - Assert.assertNull(client.getDictionaryOperations().getDictionaryNull().getBody()); + Assert.assertNull(client.dictionarys().getDictionaryNull().getBody()); } @Test public void getDictionaryEmpty() throws Exception { - Map> result = client.getDictionaryOperations().getDictionaryEmpty().getBody(); + Map> result = client.dictionarys().getDictionaryEmpty().getBody(); Assert.assertEquals(0, result.size()); } @Test public void getDictionaryItemNull() throws Exception { - Map> result = client.getDictionaryOperations().getDictionaryItemNull().getBody(); + Map> result = client.dictionarys().getDictionaryItemNull().getBody(); Assert.assertNull(result.get("1")); } @Test public void getDictionaryItemEmpty() throws Exception { - Map> result = client.getDictionaryOperations().getDictionaryItemEmpty().getBody(); + Map> result = client.dictionarys().getDictionaryItemEmpty().getBody(); Assert.assertEquals(0, result.get("1").size()); } @Test public void getDictionaryValid() throws Exception { - Map> result = client.getDictionaryOperations().getDictionaryValid().getBody(); + Map> result = client.dictionarys().getDictionaryValid().getBody(); Map map1 = new HashMap(); map1.put("1", "one"); map1.put("2", "two"); @@ -588,6 +590,6 @@ public void putDictionaryValid() throws Exception { body.put("0", map1); body.put("1", map2); body.put("2", map3); - client.getDictionaryOperations().putDictionaryValid(body); + client.dictionarys().putDictionaryValid(body); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyduration/DurationOperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyduration/DurationOperationsTests.java index 9f822e65e8561..6eaa5ca26addc 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyduration/DurationOperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyduration/DurationOperationsTests.java @@ -5,6 +5,8 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.bodyduration.implementation.AutoRestDurationTestServiceImpl; + public class DurationOperationsTests { private static AutoRestDurationTestService client; @@ -16,13 +18,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getDurationOperations().getNull().getBody()); + Assert.assertNull(client.durations().getNull().getBody()); } @Test public void getInvalid() throws Exception { try { - client.getDurationOperations().getInvalid(); + client.durations().getInvalid(); Assert.fail(); //Should not reach here } catch (IllegalArgumentException e) { @@ -32,11 +34,11 @@ public void getInvalid() throws Exception { @Test public void getPositiveDuration() throws Exception { - client.getDurationOperations().getPositiveDuration(); + client.durations().getPositiveDuration(); } @Test public void putPositiveDuration() throws Exception { - client.getDurationOperations().putPositiveDuration(new Period(0, 0, 0, 123, 22, 14, 12, 11)); + client.durations().putPositiveDuration(new Period(0, 0, 0, 123, 22, 14, 12, 11)); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyfile/FilesTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyfile/FilesTests.java index c51730e8f4bba..53f6097719ada 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyfile/FilesTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyfile/FilesTests.java @@ -8,6 +8,7 @@ import java.io.InputStream; import java.util.concurrent.TimeUnit; +import fixtures.bodyfile.implementation.AutoRestSwaggerBATFileServiceImpl; import okhttp3.OkHttpClient; import retrofit2.Retrofit; @@ -23,7 +24,7 @@ public static void setup() { @Test public void getFile() throws Exception { ClassLoader classLoader = getClass().getClassLoader(); - try (InputStream result = client.getFilesOperations().getFile().getBody(); + try (InputStream result = client.files().getFile().getBody(); InputStream file = classLoader.getResourceAsStream("sample.png")) { byte[] actual = IOUtils.toByteArray(result); byte[] expected = IOUtils.toByteArray(file); @@ -33,7 +34,7 @@ public void getFile() throws Exception { @Test public void getLargeFile() throws Exception { - try (InputStream result = client.getFilesOperations().getFileLarge().getBody()) { + try (InputStream result = client.files().getFileLarge().getBody()) { long streamSize = 3000L * 1024L * 1024L; long skipped = result.skip(streamSize); Assert.assertEquals(streamSize, skipped); @@ -42,7 +43,7 @@ public void getLargeFile() throws Exception { @Test public void getEmptyFile() throws Exception { - try (InputStream result = client.getFilesOperations().getEmptyFile().getBody()) { + try (InputStream result = client.files().getEmptyFile().getBody()) { byte[] actual = IOUtils.toByteArray(result); Assert.assertEquals(0, actual.length); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyformdata/FormdataTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyformdata/FormdataTests.java index b3bed03723cdb..1c83b9481e31d 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyformdata/FormdataTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyformdata/FormdataTests.java @@ -7,6 +7,8 @@ import java.io.InputStream; +import fixtures.bodyformdata.implementation.AutoRestSwaggerBATFormDataServiceImpl; + public class FormdataTests { private static AutoRestSwaggerBATFormDataService client; @@ -21,7 +23,7 @@ public void uploadFile() throws Exception { InputStream stream = classLoader.getResourceAsStream("upload.txt"); byte[] bytes = IOUtils.toByteArray(stream); stream.close(); - InputStream result = client.getFormdataOperations().uploadFile(bytes, "sample.png").getBody(); + InputStream result = client.formdatas().uploadFile(bytes, "sample.png").getBody(); try { Assert.assertEquals(new String(bytes), IOUtils.toString(result)); } finally { @@ -35,7 +37,7 @@ public void uploadFileViaBody() throws Exception { InputStream stream = classLoader.getResourceAsStream("upload.txt"); byte[] bytes = IOUtils.toByteArray(stream); stream.close(); - InputStream result = client.getFormdataOperations().uploadFileViaBody(bytes).getBody(); + InputStream result = client.formdatas().uploadFileViaBody(bytes).getBody(); try { Assert.assertEquals(new String(bytes), IOUtils.toString(result)); } finally { diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyinteger/IntOperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyinteger/IntOperationsTests.java index db96a44d922ba..1204413d5d8d9 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyinteger/IntOperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodyinteger/IntOperationsTests.java @@ -10,6 +10,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import fixtures.bodyinteger.implementation.AutoRestIntegerTestServiceImpl; + public class IntOperationsTests { private static AutoRestIntegerTestService client; private CountDownLatch lock = new CountDownLatch(1); @@ -21,13 +23,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getIntOperations().getNull().getBody()); + Assert.assertNull(client.ints().getNull().getBody()); } @Test public void getInvalid() throws Exception { try { - client.getIntOperations().getInvalid(); + client.ints().getInvalid(); Assert.assertTrue(false); } catch (Exception exception) { Assert.assertEquals(JsonParseException.class, exception.getClass()); @@ -37,7 +39,7 @@ public void getInvalid() throws Exception { @Test public void getOverflowInt32() throws Exception { try { - client.getIntOperations().getOverflowInt32(); + client.ints().getOverflowInt32(); Assert.assertTrue(false); } catch (Exception exception) { Assert.assertEquals(JsonParseException.class, exception.getClass()); @@ -47,7 +49,7 @@ public void getOverflowInt32() throws Exception { @Test public void getUnderflowInt32() throws Exception { try { - client.getIntOperations().getUnderflowInt32(); + client.ints().getUnderflowInt32(); Assert.assertTrue(false); } catch (Exception exception) { Assert.assertEquals(JsonParseException.class, exception.getClass()); @@ -57,7 +59,7 @@ public void getUnderflowInt32() throws Exception { @Test public void getOverflowInt64() throws Exception { try { - long value = client.getIntOperations().getOverflowInt64().getBody(); + long value = client.ints().getOverflowInt64().getBody(); Assert.assertEquals(Long.MAX_VALUE, value); } catch (Exception exception) { Assert.assertEquals(JsonParseException.class, exception.getClass()); @@ -67,7 +69,7 @@ public void getOverflowInt64() throws Exception { @Test public void getUnderflowInt64() throws Exception { try { - long value = client.getIntOperations().getUnderflowInt64().getBody(); + long value = client.ints().getUnderflowInt64().getBody(); Assert.assertEquals(Long.MIN_VALUE, value); } catch (Exception exception) { Assert.assertEquals(JsonParseException.class, exception.getClass()); @@ -76,7 +78,7 @@ public void getUnderflowInt64() throws Exception { @Test public void putMax32() throws Exception { - client.getIntOperations().putMax32Async(Integer.MAX_VALUE, new ServiceCallback() { + client.ints().putMax32Async(Integer.MAX_VALUE, new ServiceCallback() { @Override public void failure(Throwable t) { } @@ -91,7 +93,7 @@ public void success(ServiceResponse response) { @Test public void putMax64() throws Exception { - client.getIntOperations().putMax64Async(Long.MAX_VALUE, new ServiceCallback() { + client.ints().putMax64Async(Long.MAX_VALUE, new ServiceCallback() { @Override public void failure(Throwable t) { } @@ -107,7 +109,7 @@ public void success(ServiceResponse response) { @Test public void putMin32() throws Exception { - client.getIntOperations().putMin32Async(Integer.MIN_VALUE, new ServiceCallback() { + client.ints().putMin32Async(Integer.MIN_VALUE, new ServiceCallback() { @Override public void failure(Throwable t) { } @@ -122,7 +124,7 @@ public void success(ServiceResponse response) { @Test public void putMin64() throws Exception { - client.getIntOperations().putMin64Async(Long.MIN_VALUE, new ServiceCallback() { + client.ints().putMin64Async(Long.MIN_VALUE, new ServiceCallback() { @Override public void failure(Throwable t) { } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodynumber/NumberTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodynumber/NumberTests.java index fb95218ec45d2..e9cb061b89dae 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodynumber/NumberTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodynumber/NumberTests.java @@ -5,6 +5,8 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.bodynumber.implementation.AutoRestNumberTestServiceImpl; + public class NumberTests { private static AutoRestNumberTestService client; @@ -15,13 +17,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getNumberOperations().getNull().getBody()); + Assert.assertNull(client.numbers().getNull().getBody()); } @Test public void getInvalidFloat() throws Exception { try { - client.getNumberOperations().getInvalidFloat(); + client.numbers().getInvalidFloat(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -32,7 +34,7 @@ public void getInvalidFloat() throws Exception { @Test public void getInvalidDouble() throws Exception { try { - client.getNumberOperations().getInvalidDouble(); + client.numbers().getInvalidDouble(); Assert.assertTrue(false); } catch (Exception exception) { // expected @@ -42,67 +44,67 @@ public void getInvalidDouble() throws Exception { @Test public void putBigFloat() throws Exception { - client.getNumberOperations().putBigFloat(3.402823e+20); + client.numbers().putBigFloat(3.402823e+20); } @Test public void putBigDouble() throws Exception { - client.getNumberOperations().putBigDouble(2.5976931e+101); + client.numbers().putBigDouble(2.5976931e+101); } @Test public void getBigFloat() throws Exception { - double result = client.getNumberOperations().getBigFloat().getBody(); + double result = client.numbers().getBigFloat().getBody(); Assert.assertEquals(3.402823e+20, result, 0.0f); } @Test public void getBigDouble() throws Exception { - double result = client.getNumberOperations().getBigDouble().getBody(); + double result = client.numbers().getBigDouble().getBody(); Assert.assertEquals(2.5976931e+101, result, 0.0f); } @Test public void putBigDoublePositiveDecimal() throws Exception { - client.getNumberOperations().putBigDoublePositiveDecimal(99999999.99); + client.numbers().putBigDoublePositiveDecimal(99999999.99); } @Test public void getBigDoublePositiveDecimal() throws Exception { - double result = client.getNumberOperations().getBigDoublePositiveDecimal().getBody(); + double result = client.numbers().getBigDoublePositiveDecimal().getBody(); Assert.assertEquals(99999999.99, result, 0.0f); } @Test public void putBigDoubleNegativeDecimal() throws Exception { - client.getNumberOperations().putBigDoubleNegativeDecimal(-99999999.99); + client.numbers().putBigDoubleNegativeDecimal(-99999999.99); } @Test public void getBigDoubleNegativeDecimal() throws Exception { - double result = client.getNumberOperations().getBigDoubleNegativeDecimal().getBody(); + double result = client.numbers().getBigDoubleNegativeDecimal().getBody(); Assert.assertEquals(-99999999.99, result, 0.0f); } @Test public void putSmallFloat() throws Exception { - client.getNumberOperations().putSmallFloat(3.402823e-20); + client.numbers().putSmallFloat(3.402823e-20); } @Test public void getSmallFloat() throws Exception { - double result = client.getNumberOperations().getSmallFloat().getBody(); + double result = client.numbers().getSmallFloat().getBody(); Assert.assertEquals(3.402823e-20, result, 0.0f); } @Test public void putSmallDouble() throws Exception { - client.getNumberOperations().putSmallDouble(2.5976931e-101); + client.numbers().putSmallDouble(2.5976931e-101); } @Test public void getSmallDouble() throws Exception { - double result = client.getNumberOperations().getSmallDouble().getBody(); + double result = client.numbers().getSmallDouble().getBody(); Assert.assertEquals(2.5976931e-101, result, 0.0f); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodystring/EnumOperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodystring/EnumOperationsTests.java index 0b09ab6ebbba2..f4a22963acfdb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodystring/EnumOperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodystring/EnumOperationsTests.java @@ -1,5 +1,6 @@ package fixtures.bodystring; +import fixtures.bodystring.implementation.AutoRestSwaggerBATServiceImpl; import fixtures.bodystring.models.Colors; import org.junit.Assert; import org.junit.BeforeClass; @@ -18,12 +19,12 @@ public static void setup() { @Test public void getNotExpandable() throws Exception { - Colors result = client.getEnumOperations().getNotExpandable().getBody(); + Colors result = client.enums().getNotExpandable().getBody(); Assert.assertEquals(Colors.RED_COLOR, result); } @Test public void putNotExpandable() throws Exception { - client.getEnumOperations().putNotExpandable(Colors.RED_COLOR); + client.enums().putNotExpandable(Colors.RED_COLOR); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodystring/StringOperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodystring/StringOperationsTests.java index edd5fb211e941..7947587ed7e09 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodystring/StringOperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/bodystring/StringOperationsTests.java @@ -10,6 +10,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import fixtures.bodystring.implementation.AutoRestSwaggerBATServiceImpl; + public class StringOperationsTests { private static AutoRestSwaggerBATService client; private CountDownLatch lock = new CountDownLatch(1); @@ -21,13 +23,13 @@ public static void setup() { @Test public void getNull() throws Exception { - Assert.assertNull(client.getStringOperations().getNull().getBody()); + Assert.assertNull(client.strings().getNull().getBody()); } @Test public void putNull() throws Exception { try { - client.getStringOperations().putNull(null); + client.strings().putNull(null); } catch (Exception ex) { Assert.assertEquals(IllegalArgumentException.class, ex.getClass()); Assert.assertTrue(ex.getMessage().contains("Body parameter value must not be null")); @@ -36,13 +38,13 @@ public void putNull() throws Exception { @Test public void getEmpty() throws Exception { - String result = client.getStringOperations().getEmpty().getBody(); + String result = client.strings().getEmpty().getBody(); Assert.assertEquals("", result); } @Test public void putEmpty() throws Exception { - client.getStringOperations().putEmptyAsync("", new ServiceCallback() { + client.strings().putEmptyAsync("", new ServiceCallback() { @Override public void failure(Throwable t) { } @@ -58,7 +60,7 @@ public void success(ServiceResponse response) { @Test public void getMbcs() throws Exception { - String result = client.getStringOperations().getMbcs().getBody(); + String result = client.strings().getMbcs().getBody(); String expected = "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑ\uE7C7ɡ〇〾⿻⺁\uE843䜣\uE864€"; Assert.assertEquals(expected, result); } @@ -66,24 +68,24 @@ public void getMbcs() throws Exception { @Test public void putMbcs() throws Exception { String content = "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑ\uE7C7ɡ〇〾⿻⺁\uE843䜣\uE864€"; - client.getStringOperations().putMbcs(content); + client.strings().putMbcs(content); } @Test public void getWhitespace() throws Exception { - String result = client.getStringOperations().getWhitespace().getBody(); + String result = client.strings().getWhitespace().getBody(); Assert.assertEquals(" Now is the time for all good men to come to the aid of their country ", result); } @Test public void putWhitespace() throws Exception { - client.getStringOperations().putWhitespace(" Now is the time for all good men to come to the aid of their country "); + client.strings().putWhitespace(" Now is the time for all good men to come to the aid of their country "); } @Test public void getNotProvided() throws Exception { try { - client.getStringOperations().getNotProvided(); + client.strings().getNotProvided(); } catch (Exception ex) { Assert.assertEquals(ServiceException.class, ex.getClass()); Assert.assertTrue(ex.getMessage().contains("JsonMappingException")); diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/custombaseuri/CustomBaseUriTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/custombaseuri/CustomBaseUriTests.java index c21afb1666878..02d63aa4885d0 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/custombaseuri/CustomBaseUriTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/custombaseuri/CustomBaseUriTests.java @@ -4,7 +4,18 @@ import org.junit.BeforeClass; import org.junit.Test; +import java.io.IOException; import java.net.UnknownHostException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import fixtures.custombaseuri.implementation.AutoRestParameterizedHostTestClientImpl; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Response; +import retrofit2.Retrofit; + +import static org.junit.Assert.fail; public class CustomBaseUriTests { private static AutoRestParameterizedHostTestClient client; @@ -17,14 +28,14 @@ public static void setup() { // Positive test case @Test public void getEmptyWithValidCustomUri() throws Exception { - client.setHost("host:3000"); - Assert.assertTrue(client.getPathsOperations().getEmpty("local").getResponse().isSuccess()); + client.withHost("host:3000"); + Assert.assertTrue(client.paths().getEmpty("local").getResponse().isSuccessful()); } @Test public void getEmptyWithInvalidCustomUriAccountName() throws Exception { try { - client.getPathsOperations().getEmpty("bad"); + client.paths().getEmpty("bad"); Assert.assertTrue(false); } catch (UnknownHostException e) { @@ -35,26 +46,72 @@ public void getEmptyWithInvalidCustomUriAccountName() throws Exception { @Test public void getEmptyWithInvalidCustomUriHostName() throws Exception { try { - client.setHost("badhost"); - client.getPathsOperations().getEmpty("local"); + client.withHost("badhost"); + client.paths().getEmpty("local"); Assert.assertTrue(false); } catch (UnknownHostException e) { Assert.assertTrue(true); } finally { - client.setHost("host:3000"); + client.withHost("host:3000"); } } @Test public void getEmptyWithEmptyCustomUriAccountName() throws Exception { try { - client.getPathsOperations().getEmpty(null); + client.paths().getEmpty(null); Assert.assertTrue(false); } catch (IllegalArgumentException e) { Assert.assertTrue(true); } } + + @Test + public void getEmptyMultipleThreads() throws Exception { + final CountDownLatch latch = new CountDownLatch(2); + OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder() + .addInterceptor(new Interceptor() { + @Override + public Response intercept(Chain chain) throws IOException { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // do nothing + } + return chain.proceed(chain.request()); + } + }); + final AutoRestParameterizedHostTestClient client1 = new AutoRestParameterizedHostTestClientImpl(clientBuilder, new Retrofit.Builder()); + client1.withHost("host:3000"); + Thread t1 = new Thread(new Runnable() { + @Override + public void run() { + try { + client1.paths().getEmpty("badlocal"); + fail(); + } catch (UnknownHostException e) { + latch.countDown(); + } catch (Exception e) { + fail(); + } + } + }); + Thread t2 = new Thread(new Runnable() { + @Override + public void run() { + try { + Assert.assertTrue(client1.paths().getEmpty("local").getResponse().isSuccessful()); + latch.countDown(); + } catch (Exception ex) { + fail(); + } + } + }); + t1.start(); + t2.start(); + Assert.assertTrue(latch.await(5, TimeUnit.SECONDS)); + } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/header/HeaderOperationsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/header/HeaderOperationsTests.java index 20d444933093e..ec45d21b18388 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/header/HeaderOperationsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/header/HeaderOperationsTests.java @@ -17,6 +17,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import fixtures.header.implementation.AutoRestSwaggerBATHeaderServiceImpl; import fixtures.header.models.ErrorException; import fixtures.header.models.GreyscaleColors; import okhttp3.Headers; @@ -34,13 +35,13 @@ public static void setup() { @Test public void paramExistingKey() throws Exception { - client.getHeaderOperations().paramExistingKey("overwrite"); + client.headers().paramExistingKey("overwrite"); } @Test public void responseExistingKey() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseExistingKeyAsync(new ServiceCallback() { + client.headers().responseExistingKeyAsync(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -61,7 +62,7 @@ public void success(ServiceResponse response) { @Test public void paramProtectedKey() throws Exception { try { - client.getHeaderOperations().paramProtectedKey("text/html"); + client.headers().paramProtectedKey("text/html"); } catch (ErrorException ex) { // OkHttp can actually overwrite header "Content-Type" } @@ -70,7 +71,7 @@ public void paramProtectedKey() throws Exception { @Test public void responseProtectedKey() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseProtectedKeyAsync(new ServiceCallback() { + client.headers().responseProtectedKeyAsync(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -90,14 +91,14 @@ public void success(ServiceResponse response) { @Test public void paramInteger() throws Exception { - client.getHeaderOperations().paramInteger("positive", 1); - client.getHeaderOperations().paramInteger("negative", -2); + client.headers().paramInteger("positive", 1); + client.headers().paramInteger("negative", -2); } @Test public void responseInteger() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseIntegerAsync("positive", new ServiceCallback() { + client.headers().responseIntegerAsync("positive", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -114,7 +115,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseIntegerAsync("negative", new ServiceCallback() { + client.headers().responseIntegerAsync("negative", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -134,14 +135,14 @@ public void success(ServiceResponse response) { @Test public void paramLong() throws Exception { - client.getHeaderOperations().paramLong("positive", 105); - client.getHeaderOperations().paramLong("negative", -2); + client.headers().paramLong("positive", 105); + client.headers().paramLong("negative", -2); } @Test public void responseLong() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseLongAsync("positive", new ServiceCallback() { + client.headers().responseLongAsync("positive", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -158,7 +159,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseLongAsync("negative", new ServiceCallback() { + client.headers().responseLongAsync("negative", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -178,14 +179,14 @@ public void success(ServiceResponse response) { @Test public void paramFloat() throws Exception { - client.getHeaderOperations().paramFloat("positive", 0.07); - client.getHeaderOperations().paramFloat("negative", -3.0); + client.headers().paramFloat("positive", 0.07); + client.headers().paramFloat("negative", -3.0); } @Test public void responseFloat() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseFloatAsync("positive", new ServiceCallback() { + client.headers().responseFloatAsync("positive", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -202,7 +203,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseFloatAsync("negative", new ServiceCallback() { + client.headers().responseFloatAsync("negative", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -222,14 +223,14 @@ public void success(ServiceResponse response) { @Test public void paramDouble() throws Exception { - client.getHeaderOperations().paramDouble("positive", 7e120); - client.getHeaderOperations().paramDouble("negative", -3.0); + client.headers().paramDouble("positive", 7e120); + client.headers().paramDouble("negative", -3.0); } @Test public void responseDouble() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseDoubleAsync("positive", new ServiceCallback() { + client.headers().responseDoubleAsync("positive", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -246,7 +247,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseDoubleAsync("negative", new ServiceCallback() { + client.headers().responseDoubleAsync("negative", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -266,14 +267,14 @@ public void success(ServiceResponse response) { @Test public void paramBool() throws Exception { - client.getHeaderOperations().paramBool("true", true); - client.getHeaderOperations().paramBool("false", false); + client.headers().paramBool("true", true); + client.headers().paramBool("false", false); } @Test public void responseBool() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseBoolAsync("true", new ServiceCallback() { + client.headers().responseBoolAsync("true", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -290,7 +291,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseBoolAsync("false", new ServiceCallback() { + client.headers().responseBoolAsync("false", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -310,15 +311,15 @@ public void success(ServiceResponse response) { @Test public void paramString() throws Exception { - client.getHeaderOperations().paramString("valid", "The quick brown fox jumps over the lazy dog"); - client.getHeaderOperations().paramString("null", null); - client.getHeaderOperations().paramString("empty", ""); + client.headers().paramString("valid", "The quick brown fox jumps over the lazy dog"); + client.headers().paramString("null", null); + client.headers().paramString("empty", ""); } @Test public void responseString() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseStringAsync("valid", new ServiceCallback() { + client.headers().responseStringAsync("valid", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -335,7 +336,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseStringAsync("null", new ServiceCallback() { + client.headers().responseStringAsync("null", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -352,7 +353,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseStringAsync("empty", new ServiceCallback() { + client.headers().responseStringAsync("empty", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -372,14 +373,14 @@ public void success(ServiceResponse response) { @Test public void paramDate() throws Exception { - client.getHeaderOperations().paramDate("valid", new LocalDate(2010, 1, 1)); - client.getHeaderOperations().paramDate("min", new LocalDate(1, 1, 1)); + client.headers().paramDate("valid", new LocalDate(2010, 1, 1)); + client.headers().paramDate("min", new LocalDate(1, 1, 1)); } @Test public void responseDate() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseDateAsync("valid", new ServiceCallback() { + client.headers().responseDateAsync("valid", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -396,7 +397,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseDateAsync("min", new ServiceCallback() { + client.headers().responseDateAsync("min", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -416,13 +417,13 @@ public void success(ServiceResponse response) { @Test public void paramDuration() throws Exception { - client.getHeaderOperations().paramDuration("valid", new Period(0, 0, 0, 123, 22, 14, 12, 11)); + client.headers().paramDuration("valid", new Period(0, 0, 0, 123, 22, 14, 12, 11)); } @Test public void responseDuration() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseDurationAsync("valid", new ServiceCallback() { + client.headers().responseDurationAsync("valid", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -442,14 +443,14 @@ public void success(ServiceResponse response) { @Test public void paramDatetimeRfc1123() throws Exception { - client.getHeaderOperations().paramDatetimeRfc1123("valid", new DateTime(2010, 1, 1, 12, 34, 56, DateTimeZone.UTC)); - client.getHeaderOperations().paramDatetimeRfc1123("min", new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC)); + client.headers().paramDatetimeRfc1123("valid", new DateTime(2010, 1, 1, 12, 34, 56, DateTimeZone.UTC)); + client.headers().paramDatetimeRfc1123("min", new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC)); } @Test public void responseDatetimeRfc1123() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseDatetimeRfc1123Async("valid", new ServiceCallback() { + client.headers().responseDatetimeRfc1123Async("valid", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -466,7 +467,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(100000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseDatetimeRfc1123Async("min", new ServiceCallback() { + client.headers().responseDatetimeRfc1123Async("min", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -488,14 +489,14 @@ public void success(ServiceResponse response) { @Test public void paramDatetime() throws Exception { - client.getHeaderOperations().paramDatetime("valid", new DateTime(2010, 1, 1, 12, 34, 56, DateTimeZone.UTC)); - client.getHeaderOperations().paramDatetime("min", new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC)); + client.headers().paramDatetime("valid", new DateTime(2010, 1, 1, 12, 34, 56, DateTimeZone.UTC)); + client.headers().paramDatetime("min", new DateTime(1, 1, 1, 0, 0, 0, DateTimeZone.UTC)); } @Test public void responseDatetime() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseDatetimeAsync("valid", new ServiceCallback() { + client.headers().responseDatetimeAsync("valid", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -512,7 +513,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseDatetimeAsync("min", new ServiceCallback() { + client.headers().responseDatetimeAsync("min", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -532,13 +533,13 @@ public void success(ServiceResponse response) { @Test public void paramByte() throws Exception { - client.getHeaderOperations().paramByte("valid", "啊齄丂狛狜隣郎隣兀﨩".getBytes(Charset.forName("UTF-8"))); + client.headers().paramByte("valid", "啊齄丂狛狜隣郎隣兀﨩".getBytes(Charset.forName("UTF-8"))); } @Test public void responseByte() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseByteAsync("valid", new ServiceCallback() { + client.headers().responseByteAsync("valid", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -560,14 +561,14 @@ public void success(ServiceResponse response) { @Test public void paramEnum() throws Exception { - client.getHeaderOperations().paramEnum("valid", GreyscaleColors.GREY); - client.getHeaderOperations().paramEnum("null", null); + client.headers().paramEnum("valid", GreyscaleColors.GREY); + client.headers().paramEnum("null", null); } @Test public void responseEnum() throws Exception { lock = new CountDownLatch(1); - client.getHeaderOperations().responseEnumAsync("valid", new ServiceCallback() { + client.headers().responseEnumAsync("valid", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -584,7 +585,7 @@ public void success(ServiceResponse response) { }); Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); lock = new CountDownLatch(1); - client.getHeaderOperations().responseEnumAsync("null", new ServiceCallback() { + client.headers().responseEnumAsync("null", new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -605,6 +606,6 @@ public void success(ServiceResponse response) { @Test @Ignore("Custom header not supported yet") public void customRequestId() throws Exception { - client.getHeaderOperations().customRequestId(); + client.headers().customRequestId(); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpClientFailureTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpClientFailureTests.java index a6883e990357a..6ac1d1ecd96cb 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpClientFailureTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpClientFailureTests.java @@ -1,5 +1,6 @@ package fixtures.http; +import fixtures.http.implementation.AutoRestHttpInfrastructureTestServiceImpl; import fixtures.http.models.ErrorException; import org.junit.Assert; import org.junit.BeforeClass; @@ -20,7 +21,7 @@ public static void setup() { @Test public void head400() throws Exception { try { - client.getHttpClientFailureOperations().head400(); + client.httpClientFailures().head400(); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -30,7 +31,7 @@ public void head400() throws Exception { @Test public void get400() throws Exception { try { - client.getHttpClientFailureOperations().get400(); + client.httpClientFailures().get400(); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -40,7 +41,7 @@ public void get400() throws Exception { @Test public void put400() throws Exception { try { - client.getHttpClientFailureOperations().put400(true); + client.httpClientFailures().put400(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -50,7 +51,7 @@ public void put400() throws Exception { @Test public void patch400() throws Exception { try { - client.getHttpClientFailureOperations().patch400(true); + client.httpClientFailures().patch400(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -60,7 +61,7 @@ public void patch400() throws Exception { @Test public void post400() throws Exception { try { - client.getHttpClientFailureOperations().post400(true); + client.httpClientFailures().post400(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -70,7 +71,7 @@ public void post400() throws Exception { @Test public void delete400() throws Exception { try { - client.getHttpClientFailureOperations().delete400(true); + client.httpClientFailures().delete400(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -80,7 +81,7 @@ public void delete400() throws Exception { @Test public void head401() throws Exception { try { - client.getHttpClientFailureOperations().head401(); + client.httpClientFailures().head401(); fail(); } catch (ErrorException ex) { Assert.assertEquals(401, ex.getResponse().code()); @@ -90,7 +91,7 @@ public void head401() throws Exception { @Test public void get402() throws Exception { try { - client.getHttpClientFailureOperations().get402(); + client.httpClientFailures().get402(); fail(); } catch (ErrorException ex) { Assert.assertEquals(402, ex.getResponse().code()); @@ -100,7 +101,7 @@ public void get402() throws Exception { @Test public void get403() throws Exception { try { - client.getHttpClientFailureOperations().get403(); + client.httpClientFailures().get403(); fail(); } catch (ErrorException ex) { Assert.assertEquals(403, ex.getResponse().code()); @@ -110,7 +111,7 @@ public void get403() throws Exception { @Test public void put404() throws Exception { try { - client.getHttpClientFailureOperations().put404(true); + client.httpClientFailures().put404(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(404, ex.getResponse().code()); @@ -120,7 +121,7 @@ public void put404() throws Exception { @Test public void patch405() throws Exception { try { - client.getHttpClientFailureOperations().patch405(true); + client.httpClientFailures().patch405(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(405, ex.getResponse().code()); @@ -130,7 +131,7 @@ public void patch405() throws Exception { @Test public void post406() throws Exception { try { - client.getHttpClientFailureOperations().post406(true); + client.httpClientFailures().post406(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(406, ex.getResponse().code()); @@ -140,7 +141,7 @@ public void post406() throws Exception { @Test public void delete407() throws Exception { try { - client.getHttpClientFailureOperations().delete407(true); + client.httpClientFailures().delete407(true); fail(); } catch (ProtocolException ex) { Assert.assertTrue(ex.getMessage().contains("Received HTTP_PROXY_AUTH (407) code while not using proxy")); @@ -150,7 +151,7 @@ public void delete407() throws Exception { @Test public void put409() throws Exception { try { - client.getHttpClientFailureOperations().put409(true); + client.httpClientFailures().put409(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(409, ex.getResponse().code()); @@ -160,7 +161,7 @@ public void put409() throws Exception { @Test public void head410() throws Exception { try { - client.getHttpClientFailureOperations().head410(); + client.httpClientFailures().head410(); fail(); } catch (ErrorException ex) { Assert.assertEquals(410, ex.getResponse().code()); @@ -170,7 +171,7 @@ public void head410() throws Exception { @Test public void get411() throws Exception { try { - client.getHttpClientFailureOperations().get411(); + client.httpClientFailures().get411(); fail(); } catch (ErrorException ex) { Assert.assertEquals(411, ex.getResponse().code()); @@ -180,7 +181,7 @@ public void get411() throws Exception { @Test public void get412() throws Exception { try { - client.getHttpClientFailureOperations().get412(); + client.httpClientFailures().get412(); fail(); } catch (ErrorException ex) { Assert.assertEquals(412, ex.getResponse().code()); @@ -190,7 +191,7 @@ public void get412() throws Exception { @Test public void put413() throws Exception { try { - client.getHttpClientFailureOperations().put413(true); + client.httpClientFailures().put413(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(413, ex.getResponse().code()); @@ -200,7 +201,7 @@ public void put413() throws Exception { @Test public void patch414() throws Exception { try { - client.getHttpClientFailureOperations().patch414(true); + client.httpClientFailures().patch414(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(414, ex.getResponse().code()); @@ -210,7 +211,7 @@ public void patch414() throws Exception { @Test public void post415() throws Exception { try { - client.getHttpClientFailureOperations().post415(true); + client.httpClientFailures().post415(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(415, ex.getResponse().code()); @@ -220,7 +221,7 @@ public void post415() throws Exception { @Test public void get416() throws Exception { try { - client.getHttpClientFailureOperations().get416(); + client.httpClientFailures().get416(); fail(); } catch (ErrorException ex) { Assert.assertEquals(416, ex.getResponse().code()); @@ -230,7 +231,7 @@ public void get416() throws Exception { @Test public void delete417() throws Exception { try { - client.getHttpClientFailureOperations().delete417(true); + client.httpClientFailures().delete417(true); fail(); } catch (ErrorException ex) { Assert.assertEquals(417, ex.getResponse().code()); @@ -240,7 +241,7 @@ public void delete417() throws Exception { @Test public void head429() throws Exception { try { - client.getHttpClientFailureOperations().head429(); + client.httpClientFailures().head429(); fail(); } catch (ErrorException ex) { Assert.assertEquals(429, ex.getResponse().code()); diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpFailureTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpFailureTests.java index 473c9dfe929e0..dbb2a3144a76b 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpFailureTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpFailureTests.java @@ -1,6 +1,8 @@ package fixtures.http; import com.microsoft.rest.ServiceException; + +import fixtures.http.implementation.AutoRestHttpInfrastructureTestServiceImpl; import fixtures.http.models.ErrorException; import org.junit.Assert; import org.junit.BeforeClass; @@ -19,7 +21,7 @@ public static void setup() { @Test public void getEmptyError() throws Exception { try { - client.getHttpFailureOperations().getEmptyError(); + client.httpFailures().getEmptyError(); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -29,7 +31,7 @@ public void getEmptyError() throws Exception { @Test public void getNoModelError() throws Exception { try { - client.getHttpFailureOperations().getNoModelError(); + client.httpFailures().getNoModelError(); fail(); } catch (ServiceException ex) { Assert.assertEquals(400, ex.getResponse().code()); diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpRedirectsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpRedirectsTests.java index 273dfe1e932cb..cd4335b33497e 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpRedirectsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpRedirectsTests.java @@ -11,6 +11,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import fixtures.http.implementation.AutoRestHttpInfrastructureTestServiceImpl; + import static org.junit.Assert.fail; public class HttpRedirectsTests { @@ -24,7 +26,7 @@ public static void setup() { @Test public void head300() throws Exception { - client.getHttpRedirectsOperations().head300Async(new ServiceCallback() { + client.httpRedirects().head300Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -41,7 +43,7 @@ public void success(ServiceResponse response) { @Test public void get300() throws Exception { - client.getHttpRedirectsOperations().get300Async(new ServiceCallback>() { + client.httpRedirects().get300Async(new ServiceCallback>() { @Override public void failure(Throwable t) { fail(); @@ -58,7 +60,7 @@ public void success(ServiceResponse> response) { @Test public void head301() throws Exception { - client.getHttpRedirectsOperations().head301Async(new ServiceCallback() { + client.httpRedirects().head301Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -75,7 +77,7 @@ public void success(ServiceResponse response) { @Test public void get301() throws Exception { - client.getHttpRedirectsOperations().get301Async(new ServiceCallback() { + client.httpRedirects().get301Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -93,7 +95,7 @@ public void success(ServiceResponse response) { @Test @Ignore("Not supported yet") public void put301() throws Exception { - client.getHttpRedirectsOperations().put301Async(true, new ServiceCallback() { + client.httpRedirects().put301Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -110,7 +112,7 @@ public void success(ServiceResponse response) { @Test public void head302() throws Exception { - client.getHttpRedirectsOperations().head302Async(new ServiceCallback() { + client.httpRedirects().head302Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -127,7 +129,7 @@ public void success(ServiceResponse response) { @Test public void get302() throws Exception { - client.getHttpRedirectsOperations().get302Async(new ServiceCallback() { + client.httpRedirects().get302Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -145,7 +147,7 @@ public void success(ServiceResponse response) { @Test @Ignore("Not supported yet") public void patch302() throws Exception { - client.getHttpRedirectsOperations().patch302Async(true, new ServiceCallback() { + client.httpRedirects().patch302Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -162,7 +164,7 @@ public void success(ServiceResponse response) { @Test public void post303() throws Exception { - client.getHttpRedirectsOperations().post303Async(true, new ServiceCallback() { + client.httpRedirects().post303Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -179,7 +181,7 @@ public void success(ServiceResponse response) { @Test public void head307() throws Exception { - client.getHttpRedirectsOperations().head307Async(new ServiceCallback() { + client.httpRedirects().head307Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -196,7 +198,7 @@ public void success(ServiceResponse response) { @Test public void get307() throws Exception { - client.getHttpRedirectsOperations().get307Async(new ServiceCallback() { + client.httpRedirects().get307Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -213,7 +215,7 @@ public void success(ServiceResponse response) { @Test public void put307() throws Exception { - client.getHttpRedirectsOperations().put307Async(true, new ServiceCallback() { + client.httpRedirects().put307Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -230,7 +232,7 @@ public void success(ServiceResponse response) { @Test public void patch307() throws Exception { - client.getHttpRedirectsOperations().patch307Async(true, new ServiceCallback() { + client.httpRedirects().patch307Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -247,7 +249,7 @@ public void success(ServiceResponse response) { @Test public void post307() throws Exception { - client.getHttpRedirectsOperations().post307Async(true, new ServiceCallback() { + client.httpRedirects().post307Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -264,7 +266,7 @@ public void success(ServiceResponse response) { @Test public void delete307() throws Exception { - client.getHttpRedirectsOperations().delete307Async(true, new ServiceCallback() { + client.httpRedirects().delete307Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpRetryTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpRetryTests.java index f4ea5b2f4df2c..bad74d0beaf6f 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpRetryTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpRetryTests.java @@ -9,6 +9,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import fixtures.http.implementation.AutoRestHttpInfrastructureTestServiceImpl; + import static org.junit.Assert.fail; public class HttpRetryTests { @@ -22,7 +24,7 @@ public static void setup() { @Test public void head408() throws Exception { - client.getHttpRetryOperations().head408Async(new ServiceCallback() { + client.httpRetrys().head408Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -39,7 +41,7 @@ public void success(ServiceResponse response) { @Test public void put500() throws Exception { - client.getHttpRetryOperations().put500Async(true, new ServiceCallback() { + client.httpRetrys().put500Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -56,7 +58,7 @@ public void success(ServiceResponse response) { @Test public void patch500() throws Exception { - client.getHttpRetryOperations().patch500Async(true, new ServiceCallback() { + client.httpRetrys().patch500Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -73,7 +75,7 @@ public void success(ServiceResponse response) { @Test public void get502() throws Exception { - client.getHttpRetryOperations().get502Async(new ServiceCallback() { + client.httpRetrys().get502Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -85,12 +87,12 @@ public void success(ServiceResponse response) { lock.countDown(); } }); - Assert.assertTrue(lock.await(1000, TimeUnit.MILLISECONDS)); + Assert.assertTrue(lock.await(50000, TimeUnit.MILLISECONDS)); } @Test public void post503() throws Exception { - client.getHttpRetryOperations().post503Async(true, new ServiceCallback() { + client.httpRetrys().post503Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -107,7 +109,7 @@ public void success(ServiceResponse response) { @Test public void delete503() throws Exception { - client.getHttpRetryOperations().delete503Async(true, new ServiceCallback() { + client.httpRetrys().delete503Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -124,7 +126,7 @@ public void success(ServiceResponse response) { @Test public void put504() throws Exception { - client.getHttpRetryOperations().put504Async(true, new ServiceCallback() { + client.httpRetrys().put504Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -141,7 +143,7 @@ public void success(ServiceResponse response) { @Test public void patch504() throws Exception { - client.getHttpRetryOperations().patch504Async(true, new ServiceCallback() { + client.httpRetrys().patch504Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpServerFailureTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpServerFailureTests.java index 471f9cc753950..98729208fefcc 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpServerFailureTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpServerFailureTests.java @@ -1,5 +1,6 @@ package fixtures.http; +import fixtures.http.implementation.AutoRestHttpInfrastructureTestServiceImpl; import fixtures.http.models.ErrorException; import org.junit.Assert; import org.junit.BeforeClass; @@ -16,7 +17,7 @@ public static void setup() { @Test public void head501() throws Exception { try { - client.getHttpServerFailureOperations().head501(); + client.httpServerFailures().head501(); } catch (ErrorException ex) { Assert.assertEquals(501, ex.getResponse().code()); } @@ -25,7 +26,7 @@ public void head501() throws Exception { @Test public void get501() throws Exception { try { - client.getHttpServerFailureOperations().get501(); + client.httpServerFailures().get501(); } catch (ErrorException ex) { Assert.assertEquals(501, ex.getResponse().code()); } @@ -34,7 +35,7 @@ public void get501() throws Exception { @Test public void post505() throws Exception { try { - client.getHttpServerFailureOperations().post505(true); + client.httpServerFailures().post505(true); } catch (ErrorException ex) { Assert.assertEquals(505, ex.getResponse().code()); } @@ -43,7 +44,7 @@ public void post505() throws Exception { @Test public void delete505() throws Exception { try { - client.getHttpServerFailureOperations().delete505(true); + client.httpServerFailures().delete505(true); } catch (ErrorException ex) { Assert.assertEquals(505, ex.getResponse().code()); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpSuccessTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpSuccessTests.java index 85e7f08c14d0a..0cc2a4bbfea8f 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpSuccessTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/HttpSuccessTests.java @@ -9,6 +9,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import fixtures.http.implementation.AutoRestHttpInfrastructureTestServiceImpl; + import static org.junit.Assert.fail; public class HttpSuccessTests { @@ -22,7 +24,7 @@ public static void setup() { @Test public void head200() throws Exception { - client.getHttpSuccessOperations().head200Async(new ServiceCallback() { + client.httpSuccess().head200Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -39,7 +41,7 @@ public void success(ServiceResponse response) { @Test public void get200() throws Exception { - client.getHttpSuccessOperations().get200Async(new ServiceCallback() { + client.httpSuccess().get200Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -56,7 +58,7 @@ public void success(ServiceResponse response) { @Test public void put200() throws Exception { - client.getHttpSuccessOperations().put200Async(true, new ServiceCallback() { + client.httpSuccess().put200Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -73,7 +75,7 @@ public void success(ServiceResponse response) { @Test public void patch200() throws Exception { - client.getHttpSuccessOperations().patch200Async(true, new ServiceCallback() { + client.httpSuccess().patch200Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -90,7 +92,7 @@ public void success(ServiceResponse response) { @Test public void post200() throws Exception { - client.getHttpSuccessOperations().post200Async(true, new ServiceCallback() { + client.httpSuccess().post200Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -107,7 +109,7 @@ public void success(ServiceResponse response) { @Test public void delete200() throws Exception { - client.getHttpSuccessOperations().delete200Async(true, new ServiceCallback() { + client.httpSuccess().delete200Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -124,7 +126,7 @@ public void success(ServiceResponse response) { @Test public void put201() throws Exception { - client.getHttpSuccessOperations().put201Async(true, new ServiceCallback() { + client.httpSuccess().put201Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -141,7 +143,7 @@ public void success(ServiceResponse response) { @Test public void post201() throws Exception { - client.getHttpSuccessOperations().post201Async(true, new ServiceCallback() { + client.httpSuccess().post201Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -158,7 +160,7 @@ public void success(ServiceResponse response) { @Test public void put202() throws Exception { - client.getHttpSuccessOperations().put202Async(true, new ServiceCallback() { + client.httpSuccess().put202Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -175,7 +177,7 @@ public void success(ServiceResponse response) { @Test public void patch202() throws Exception { - client.getHttpSuccessOperations().patch202Async(true, new ServiceCallback() { + client.httpSuccess().patch202Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -192,7 +194,7 @@ public void success(ServiceResponse response) { @Test public void post202() throws Exception { - client.getHttpSuccessOperations().post202Async(true, new ServiceCallback() { + client.httpSuccess().post202Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -209,7 +211,7 @@ public void success(ServiceResponse response) { @Test public void delete202() throws Exception { - client.getHttpSuccessOperations().delete202Async(true, new ServiceCallback() { + client.httpSuccess().delete202Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -226,7 +228,7 @@ public void success(ServiceResponse response) { @Test public void head204() throws Exception { - client.getHttpSuccessOperations().head204Async(new ServiceCallback() { + client.httpSuccess().head204Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -243,7 +245,7 @@ public void success(ServiceResponse response) { @Test public void put204() throws Exception { - client.getHttpSuccessOperations().put204Async(true, new ServiceCallback() { + client.httpSuccess().put204Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -260,7 +262,7 @@ public void success(ServiceResponse response) { @Test public void patch204() throws Exception { - client.getHttpSuccessOperations().patch204Async(true, new ServiceCallback() { + client.httpSuccess().patch204Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -277,7 +279,7 @@ public void success(ServiceResponse response) { @Test public void post204() throws Exception { - client.getHttpSuccessOperations().post204Async(true, new ServiceCallback() { + client.httpSuccess().post204Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -294,7 +296,7 @@ public void success(ServiceResponse response) { @Test public void delete204() throws Exception { - client.getHttpSuccessOperations().delete204Async(true, new ServiceCallback() { + client.httpSuccess().delete204Async(true, new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -311,7 +313,7 @@ public void success(ServiceResponse response) { @Test public void head404() throws Exception { - client.getHttpSuccessOperations().head404Async(new ServiceCallback() { + client.httpSuccess().head404Async(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/MultipleResponsesTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/MultipleResponsesTests.java index 589e916f29169..7e29490968c61 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/MultipleResponsesTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/http/MultipleResponsesTests.java @@ -11,6 +11,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import fixtures.http.implementation.AutoRestHttpInfrastructureTestServiceImpl; import fixtures.http.models.A; import fixtures.http.models.C; import fixtures.http.models.D; @@ -21,7 +22,7 @@ import static org.junit.Assert.fail; public class MultipleResponsesTests { - private static AutoRestHttpInfrastructureTestService client; + private static AutoRestHttpInfrastructureTestServiceImpl client; private CountDownLatch lock = new CountDownLatch(1); @BeforeClass @@ -31,21 +32,21 @@ public static void setup() { @Test public void get200Model204NoModelDefaultError200Valid() throws Exception { - A result = client.getMultipleResponsesOperations().get200Model204NoModelDefaultError200Valid().getBody(); + A result = client.multipleResponses().get200Model204NoModelDefaultError200Valid().getBody(); Assert.assertEquals(A.class, result.getClass()); - Assert.assertEquals("200", result.getStatusCode()); + Assert.assertEquals("200", result.statusCode()); } @Test public void get200Model204NoModelDefaultError204Valid() throws Exception { - A result = client.getMultipleResponsesOperations().get200Model204NoModelDefaultError204Valid().getBody(); + A result = client.multipleResponses().get200Model204NoModelDefaultError204Valid().getBody(); Assert.assertNull(result); } @Test public void get200Model204NoModelDefaultError201Invalid() throws Exception { try { - client.getMultipleResponsesOperations().get200Model204NoModelDefaultError201Invalid(); + client.multipleResponses().get200Model204NoModelDefaultError201Invalid(); fail(); } catch (ErrorException ex) { Assert.assertEquals(201, ex.getResponse().code()); @@ -55,7 +56,7 @@ public void get200Model204NoModelDefaultError201Invalid() throws Exception { @Test public void get200Model204NoModelDefaultError202None() throws Exception { try { - A result = client.getMultipleResponsesOperations().get200Model204NoModelDefaultError202None().getBody(); + A result = client.multipleResponses().get200Model204NoModelDefaultError202None().getBody(); } catch (ErrorException ex) { Assert.assertEquals(202, ex.getResponse().code()); } @@ -64,7 +65,7 @@ public void get200Model204NoModelDefaultError202None() throws Exception { @Test public void get200Model204NoModelDefaultError400Valid() throws Exception { try { - client.getMultipleResponsesOperations().get200Model204NoModelDefaultError400Valid(); + client.multipleResponses().get200Model204NoModelDefaultError400Valid(); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -73,68 +74,68 @@ public void get200Model204NoModelDefaultError400Valid() throws Exception { @Test public void get200Model201ModelDefaultError200Valid() throws Exception { - A result = client.getMultipleResponsesOperations().get200Model201ModelDefaultError200Valid().getBody(); - Assert.assertEquals("200", result.getStatusCode()); + A result = client.multipleResponses().get200Model201ModelDefaultError200Valid().getBody(); + Assert.assertEquals("200", result.statusCode()); } @Test public void get200Model201ModelDefaultError201Valid() throws Exception { - A result = client.getMultipleResponsesOperations().get200Model201ModelDefaultError201Valid().getBody(); - Assert.assertEquals("201", result.getStatusCode()); + A result = client.multipleResponses().get200Model201ModelDefaultError201Valid().getBody(); + Assert.assertEquals("201", result.statusCode()); } @Test public void get200Model201ModelDefaultError400Valid() throws Exception { try { - client.getMultipleResponsesOperations().get200Model201ModelDefaultError400Valid(); + client.multipleResponses().get200Model201ModelDefaultError400Valid(); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); - Error model = client.getMapperAdapter().getObjectMapper().convertValue( + Error model = client.mapperAdapter().getObjectMapper().convertValue( ex.getBody(), Error.class); - Assert.assertEquals(400, model.getStatus().intValue()); - Assert.assertEquals("client error", model.getMessage()); + Assert.assertEquals(400, model.status().intValue()); + Assert.assertEquals("client error", model.message()); } } @Test public void get200ModelA201ModelC404ModelDDefaultError200Valid() throws Exception { - Object result = client.getMultipleResponsesOperations().get200ModelA201ModelC404ModelDDefaultError200Valid().getBody(); + Object result = client.multipleResponses().get200ModelA201ModelC404ModelDDefaultError200Valid().getBody(); A actual = (A) result; - Assert.assertEquals("200", actual.getStatusCode()); + Assert.assertEquals("200", actual.statusCode()); } @Test public void get200ModelA201ModelC404ModelDDefaultError201Valid() throws Exception { - Object result = client.getMultipleResponsesOperations().get200ModelA201ModelC404ModelDDefaultError201Valid().getBody(); + Object result = client.multipleResponses().get200ModelA201ModelC404ModelDDefaultError201Valid().getBody(); C actual = (C) result; - Assert.assertEquals("201", actual.getHttpCode()); + Assert.assertEquals("201", actual.httpCode()); } @Test public void get200ModelA201ModelC404ModelDDefaultError404Valid() throws Exception { - Object result = client.getMultipleResponsesOperations().get200ModelA201ModelC404ModelDDefaultError404Valid().getBody(); + Object result = client.multipleResponses().get200ModelA201ModelC404ModelDDefaultError404Valid().getBody(); D actual = (D) result; - Assert.assertEquals("404", actual.getHttpStatusCode()); + Assert.assertEquals("404", actual.httpStatusCode()); } @Test public void get200ModelA201ModelC404ModelDDefaultError400Valid() throws Exception { try { - client.getMultipleResponsesOperations().get200ModelA201ModelC404ModelDDefaultError400Valid(); + client.multipleResponses().get200ModelA201ModelC404ModelDDefaultError400Valid(); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); - Error model = client.getMapperAdapter().getObjectMapper().convertValue( + Error model = client.mapperAdapter().getObjectMapper().convertValue( ex.getBody(), Error.class); - Assert.assertEquals(400, model.getStatus().intValue()); - Assert.assertEquals("client error", model.getMessage()); + Assert.assertEquals(400, model.status().intValue()); + Assert.assertEquals("client error", model.message()); } } @Test public void get202None204NoneDefaultError202None() throws Exception { - client.getMultipleResponsesOperations().get202None204NoneDefaultError202NoneAsync(new ServiceCallback() { + client.multipleResponses().get202None204NoneDefaultError202NoneAsync(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -151,7 +152,7 @@ public void success(ServiceResponse response) { @Test public void get202None204NoneDefaultError204None() throws Exception { - client.getMultipleResponsesOperations().get202None204NoneDefaultError204NoneAsync(new ServiceCallback() { + client.multipleResponses().get202None204NoneDefaultError204NoneAsync(new ServiceCallback() { @Override public void failure(Throwable t) { fail(); @@ -169,31 +170,31 @@ public void success(ServiceResponse response) { @Test public void get202None204NoneDefaultError400Valid() throws Exception { try { - client.getMultipleResponsesOperations().get202None204NoneDefaultError400Valid(); + client.multipleResponses().get202None204NoneDefaultError400Valid(); fail(); } catch (ErrorException ex) { Assert.assertEquals(400, ex.getResponse().code()); - Error model = client.getMapperAdapter().getObjectMapper().convertValue( + Error model = client.mapperAdapter().getObjectMapper().convertValue( ex.getBody(), Error.class); - Assert.assertEquals(400, model.getStatus().intValue()); - Assert.assertEquals("client error", model.getMessage()); + Assert.assertEquals(400, model.status().intValue()); + Assert.assertEquals("client error", model.message()); } } @Test public void get202None204NoneDefaultNone202Invalid() throws Exception { - client.getMultipleResponsesOperations().get202None204NoneDefaultNone202Invalid(); + client.multipleResponses().get202None204NoneDefaultNone202Invalid(); } @Test public void get202None204NoneDefaultNone204None() throws Exception { - client.getMultipleResponsesOperations().get202None204NoneDefaultNone204None(); + client.multipleResponses().get202None204NoneDefaultNone204None(); } @Test public void get202None204NoneDefaultNone400None() throws Exception { try { - client.getMultipleResponsesOperations().get202None204NoneDefaultNone400None(); + client.multipleResponses().get202None204NoneDefaultNone400None(); fail(); } catch (ServiceException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -203,7 +204,7 @@ public void get202None204NoneDefaultNone400None() throws Exception { @Test public void get202None204NoneDefaultNone400Invalid() throws Exception { try { - client.getMultipleResponsesOperations().get202None204NoneDefaultNone400Invalid(); + client.multipleResponses().get202None204NoneDefaultNone400Invalid(); fail(); } catch (ServiceException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -212,33 +213,33 @@ public void get202None204NoneDefaultNone400Invalid() throws Exception { @Test public void getDefaultModelA200Valid() throws Exception { - A result = client.getMultipleResponsesOperations().getDefaultModelA200Valid().getBody(); - Assert.assertEquals("200", result.getStatusCode()); + A result = client.multipleResponses().getDefaultModelA200Valid().getBody(); + Assert.assertEquals("200", result.statusCode()); } @Test public void getDefaultModelA200None() throws Exception { - A result = client.getMultipleResponsesOperations().getDefaultModelA200None().getBody(); + A result = client.multipleResponses().getDefaultModelA200None().getBody(); Assert.assertNull(result); } @Test public void getDefaultModelA400Valid() throws Exception { try { - client.getMultipleResponsesOperations().getDefaultModelA400Valid(); + client.multipleResponses().getDefaultModelA400Valid(); fail(); } catch (MyException ex) { Assert.assertEquals(400, ex.getResponse().code()); - A model = client.getMapperAdapter().getObjectMapper().convertValue( + A model = client.mapperAdapter().getObjectMapper().convertValue( ex.getBody(), A.class); - Assert.assertEquals("400", model.getStatusCode()); + Assert.assertEquals("400", model.statusCode()); } } @Test public void getDefaultModelA400None() throws Exception { try { - client.getMultipleResponsesOperations().getDefaultModelA400None(); + client.multipleResponses().getDefaultModelA400None(); fail(); } catch (MyException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -247,18 +248,18 @@ public void getDefaultModelA400None() throws Exception { @Test public void getDefaultNone200Invalid() throws Exception { - client.getMultipleResponsesOperations().getDefaultNone200Invalid(); + client.multipleResponses().getDefaultNone200Invalid(); } @Test public void getDefaultNone200None() throws Exception { - client.getMultipleResponsesOperations().getDefaultNone200None(); + client.multipleResponses().getDefaultNone200None(); } @Test public void getDefaultNone400Invalid() throws Exception { try { - client.getMultipleResponsesOperations().getDefaultNone400Invalid(); + client.multipleResponses().getDefaultNone400Invalid(); fail(); } catch (ServiceException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -268,7 +269,7 @@ public void getDefaultNone400Invalid() throws Exception { @Test public void getDefaultNone400None() throws Exception { try { - client.getMultipleResponsesOperations().getDefaultNone400None(); + client.multipleResponses().getDefaultNone400None(); fail(); } catch (ServiceException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -277,25 +278,25 @@ public void getDefaultNone400None() throws Exception { @Test public void get200ModelA200None() throws Exception { - A result = client.getMultipleResponsesOperations().get200ModelA200None().getBody(); + A result = client.multipleResponses().get200ModelA200None().getBody(); Assert.assertNull(result); } @Test public void get200ModelA200Valid() throws Exception { - A result = client.getMultipleResponsesOperations().get200ModelA200Valid().getBody(); - Assert.assertEquals("200", result.getStatusCode()); + A result = client.multipleResponses().get200ModelA200Valid().getBody(); + Assert.assertEquals("200", result.statusCode()); } @Test public void get200ModelA200Invalid() throws Exception { - Assert.assertEquals(null, client.getMultipleResponsesOperations().get200ModelA200Invalid().getBody().getStatusCode()); + Assert.assertEquals(null, client.multipleResponses().get200ModelA200Invalid().getBody().statusCode()); } @Test public void get200ModelA400None() throws Exception { try { - client.getMultipleResponsesOperations().get200ModelA400None(); + client.multipleResponses().get200ModelA400None(); fail(); } catch (ServiceException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -306,7 +307,7 @@ public void get200ModelA400None() throws Exception { @Test public void get200ModelA400Valid() throws Exception { try { - client.getMultipleResponsesOperations().get200ModelA400Valid(); + client.multipleResponses().get200ModelA400Valid(); fail(); } catch (ServiceException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -316,7 +317,7 @@ public void get200ModelA400Valid() throws Exception { @Test public void get200ModelA400Invalid() throws Exception { try { - client.getMultipleResponsesOperations().get200ModelA400Invalid(); + client.multipleResponses().get200ModelA400Invalid(); fail(); } catch (ServiceException ex) { Assert.assertEquals(400, ex.getResponse().code()); @@ -326,7 +327,7 @@ public void get200ModelA400Invalid() throws Exception { @Test public void get200ModelA202Valid() throws Exception { try { - client.getMultipleResponsesOperations().get200ModelA202Valid(); + client.multipleResponses().get200ModelA202Valid(); fail(); } catch (ServiceException ex) { Assert.assertEquals(202, ex.getResponse().code()); diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/modelflattening/ModelFlatteningTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/modelflattening/ModelFlatteningTests.java index bbead9a816854..0902568b6a881 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/modelflattening/ModelFlatteningTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/modelflattening/ModelFlatteningTests.java @@ -11,12 +11,12 @@ import java.util.List; import java.util.Map; +import fixtures.modelflattening.implementation.AutoRestResourceFlatteningTestServiceImpl; import fixtures.modelflattening.models.FlattenParameterGroup; import fixtures.modelflattening.models.FlattenedProduct; -import fixtures.modelflattening.models.SimpleProduct; import fixtures.modelflattening.models.Resource; import fixtures.modelflattening.models.ResourceCollection; -import okhttp3.logging.HttpLoggingInterceptor; +import fixtures.modelflattening.models.SimpleProduct; public class ModelFlatteningTests { private static AutoRestResourceFlatteningTestService client; @@ -24,7 +24,6 @@ public class ModelFlatteningTests { @BeforeClass public static void setup() { client = new AutoRestResourceFlatteningTestServiceImpl("http://localhost:3000"); - client.setLogLevel(HttpLoggingInterceptor.Level.BODY); } @Test @@ -32,36 +31,36 @@ public void getArray() throws Exception { List result = client.getArray().getBody(); Assert.assertEquals(3, result.size()); // Resource 1 - Assert.assertEquals("1", result.get(0).getId()); - Assert.assertEquals("OK", result.get(0).getProvisioningStateValues()); - Assert.assertEquals("Product1", result.get(0).getPname()); - Assert.assertEquals("Flat", result.get(0).getFlattenedProductType()); - Assert.assertEquals("Building 44", result.get(0).getLocation()); - Assert.assertEquals("Resource1", result.get(0).getName()); - Assert.assertEquals("Succeeded", result.get(0).getProvisioningState()); - Assert.assertEquals("Microsoft.Web/sites", result.get(0).getType()); - Assert.assertEquals("value1", result.get(0).getTags().get("tag1")); - Assert.assertEquals("value3", result.get(0).getTags().get("tag2")); + Assert.assertEquals("1", result.get(0).id()); + Assert.assertEquals("OK", result.get(0).provisioningStateValues()); + Assert.assertEquals("Product1", result.get(0).pname()); + Assert.assertEquals("Flat", result.get(0).flattenedProductType()); + Assert.assertEquals("Building 44", result.get(0).location()); + Assert.assertEquals("Resource1", result.get(0).name()); + Assert.assertEquals("Succeeded", result.get(0).provisioningState()); + Assert.assertEquals("Microsoft.Web/sites", result.get(0).type()); + Assert.assertEquals("value1", result.get(0).tags().get("tag1")); + Assert.assertEquals("value3", result.get(0).tags().get("tag2")); // Resource 2 - Assert.assertEquals("2", result.get(1).getId()); - Assert.assertEquals("Resource2", result.get(1).getName()); - Assert.assertEquals("Building 44", result.get(1).getLocation()); + Assert.assertEquals("2", result.get(1).id()); + Assert.assertEquals("Resource2", result.get(1).name()); + Assert.assertEquals("Building 44", result.get(1).location()); // Resource 3 - Assert.assertEquals("3", result.get(2).getId()); - Assert.assertEquals("Resource3", result.get(2).getName()); + Assert.assertEquals("3", result.get(2).id()); + Assert.assertEquals("Resource3", result.get(2).name()); } @Test public void putArray() throws Exception { List body = new ArrayList<>(); FlattenedProduct product = new FlattenedProduct(); - product.setLocation("West US"); - product.setTags(new HashMap()); - product.getTags().put("tag1", "value1"); - product.getTags().put("tag2", "value3"); + product.withLocation("West US"); + product.withTags(new HashMap()); + product.tags().put("tag1", "value1"); + product.tags().put("tag2", "value3"); body.add(product); FlattenedProduct product1 = new FlattenedProduct(); - product1.setLocation("Building 44"); + product1.withLocation("Building 44"); body.add(product1); ServiceResponse response = client.putArray(body); Assert.assertEquals(200, response.getResponse().code()); @@ -72,40 +71,40 @@ public void getDictionary() throws Exception { Map result = client.getDictionary().getBody(); Assert.assertEquals(3, result.size()); // Resource 1 - Assert.assertEquals("1", result.get("Product1").getId()); - Assert.assertEquals("OK", result.get("Product1").getProvisioningStateValues()); - Assert.assertEquals("Product1", result.get("Product1").getPname()); - Assert.assertEquals("Flat", result.get("Product1").getFlattenedProductType()); - Assert.assertEquals("Building 44", result.get("Product1").getLocation()); - Assert.assertEquals("Resource1", result.get("Product1").getName()); - Assert.assertEquals("Succeeded", result.get("Product1").getProvisioningState()); - Assert.assertEquals("Microsoft.Web/sites", result.get("Product1").getType()); - Assert.assertEquals("value1", result.get("Product1").getTags().get("tag1")); - Assert.assertEquals("value3", result.get("Product1").getTags().get("tag2")); + Assert.assertEquals("1", result.get("Product1").id()); + Assert.assertEquals("OK", result.get("Product1").provisioningStateValues()); + Assert.assertEquals("Product1", result.get("Product1").pname()); + Assert.assertEquals("Flat", result.get("Product1").flattenedProductType()); + Assert.assertEquals("Building 44", result.get("Product1").location()); + Assert.assertEquals("Resource1", result.get("Product1").name()); + Assert.assertEquals("Succeeded", result.get("Product1").provisioningState()); + Assert.assertEquals("Microsoft.Web/sites", result.get("Product1").type()); + Assert.assertEquals("value1", result.get("Product1").tags().get("tag1")); + Assert.assertEquals("value3", result.get("Product1").tags().get("tag2")); // Resource 2 - Assert.assertEquals("2", result.get("Product2").getId()); - Assert.assertEquals("Resource2", result.get("Product2").getName()); - Assert.assertEquals("Building 44", result.get("Product2").getLocation()); + Assert.assertEquals("2", result.get("Product2").id()); + Assert.assertEquals("Resource2", result.get("Product2").name()); + Assert.assertEquals("Building 44", result.get("Product2").location()); // Resource 3 - Assert.assertEquals("3", result.get("Product3").getId()); - Assert.assertEquals("Resource3", result.get("Product3").getName()); + Assert.assertEquals("3", result.get("Product3").id()); + Assert.assertEquals("Resource3", result.get("Product3").name()); } @Test public void putDictionary() throws Exception { Map body = new HashMap<>(); FlattenedProduct product = new FlattenedProduct(); - product.setLocation("West US"); - product.setTags(new HashMap()); - product.getTags().put("tag1", "value1"); - product.getTags().put("tag2", "value3"); - product.setPname("Product1"); - product.setFlattenedProductType("Flat"); + product.withLocation("West US"); + product.withTags(new HashMap()); + product.tags().put("tag1", "value1"); + product.tags().put("tag2", "value3"); + product.withPname("Product1"); + product.withFlattenedProductType("Flat"); body.put("Resource1", product); FlattenedProduct product1 = new FlattenedProduct(); - product1.setLocation("Building 44"); - product1.setPname("Product2"); - product1.setFlattenedProductType("Flat"); + product1.withLocation("Building 44"); + product1.withPname("Product2"); + product1.withFlattenedProductType("Flat"); body.put("Resource2", product1); ServiceResponse response = client.putDictionary(body); Assert.assertEquals(200, response.getResponse().code()); @@ -115,82 +114,82 @@ public void putDictionary() throws Exception { public void getResourceCollection() throws Exception { ResourceCollection resultResource = client.getResourceCollection().getBody(); //Dictionaryofresources - Assert.assertEquals(3, resultResource.getDictionaryofresources().size()); + Assert.assertEquals(3, resultResource.dictionaryofresources().size()); // Resource 1 - Assert.assertEquals("1", resultResource.getDictionaryofresources().get("Product1").getId()); - Assert.assertEquals("OK", resultResource.getDictionaryofresources().get("Product1").getProvisioningStateValues()); - Assert.assertEquals("Product1", resultResource.getDictionaryofresources().get("Product1").getPname()); - Assert.assertEquals("Flat", resultResource.getDictionaryofresources().get("Product1").getFlattenedProductType()); - Assert.assertEquals("Building 44", resultResource.getDictionaryofresources().get("Product1").getLocation()); - Assert.assertEquals("Resource1", resultResource.getDictionaryofresources().get("Product1").getName()); - Assert.assertEquals("Succeeded", resultResource.getDictionaryofresources().get("Product1").getProvisioningState()); - Assert.assertEquals("Microsoft.Web/sites", resultResource.getDictionaryofresources().get("Product1").getType()); - Assert.assertEquals("value1", resultResource.getDictionaryofresources().get("Product1").getTags().get("tag1")); - Assert.assertEquals("value3", resultResource.getDictionaryofresources().get("Product1").getTags().get("tag2")); + Assert.assertEquals("1", resultResource.dictionaryofresources().get("Product1").id()); + Assert.assertEquals("OK", resultResource.dictionaryofresources().get("Product1").provisioningStateValues()); + Assert.assertEquals("Product1", resultResource.dictionaryofresources().get("Product1").pname()); + Assert.assertEquals("Flat", resultResource.dictionaryofresources().get("Product1").flattenedProductType()); + Assert.assertEquals("Building 44", resultResource.dictionaryofresources().get("Product1").location()); + Assert.assertEquals("Resource1", resultResource.dictionaryofresources().get("Product1").name()); + Assert.assertEquals("Succeeded", resultResource.dictionaryofresources().get("Product1").provisioningState()); + Assert.assertEquals("Microsoft.Web/sites", resultResource.dictionaryofresources().get("Product1").type()); + Assert.assertEquals("value1", resultResource.dictionaryofresources().get("Product1").tags().get("tag1")); + Assert.assertEquals("value3", resultResource.dictionaryofresources().get("Product1").tags().get("tag2")); // Resource 2 - Assert.assertEquals("2", resultResource.getDictionaryofresources().get("Product2").getId()); - Assert.assertEquals("Resource2", resultResource.getDictionaryofresources().get("Product2").getName()); - Assert.assertEquals("Building 44", resultResource.getDictionaryofresources().get("Product2").getLocation()); + Assert.assertEquals("2", resultResource.dictionaryofresources().get("Product2").id()); + Assert.assertEquals("Resource2", resultResource.dictionaryofresources().get("Product2").name()); + Assert.assertEquals("Building 44", resultResource.dictionaryofresources().get("Product2").location()); // Resource 3 - Assert.assertEquals("3", resultResource.getDictionaryofresources().get("Product3").getId()); - Assert.assertEquals("Resource3", resultResource.getDictionaryofresources().get("Product3").getName()); + Assert.assertEquals("3", resultResource.dictionaryofresources().get("Product3").id()); + Assert.assertEquals("Resource3", resultResource.dictionaryofresources().get("Product3").name()); //Arrayofresources - Assert.assertEquals(3, resultResource.getArrayofresources().size()); + Assert.assertEquals(3, resultResource.arrayofresources().size()); // Resource 1 - Assert.assertEquals("4", resultResource.getArrayofresources().get(0).getId()); - Assert.assertEquals("OK", resultResource.getArrayofresources().get(0).getProvisioningStateValues()); - Assert.assertEquals("Product4", resultResource.getArrayofresources().get(0).getPname()); - Assert.assertEquals("Flat", resultResource.getArrayofresources().get(0).getFlattenedProductType()); - Assert.assertEquals("Building 44", resultResource.getArrayofresources().get(0).getLocation()); - Assert.assertEquals("Resource4", resultResource.getArrayofresources().get(0).getName()); - Assert.assertEquals("Succeeded", resultResource.getArrayofresources().get(0).getProvisioningState()); - Assert.assertEquals("Microsoft.Web/sites", resultResource.getArrayofresources().get(0).getType()); - Assert.assertEquals("value1", resultResource.getArrayofresources().get(0).getTags().get("tag1")); - Assert.assertEquals("value3", resultResource.getArrayofresources().get(0).getTags().get("tag2")); + Assert.assertEquals("4", resultResource.arrayofresources().get(0).id()); + Assert.assertEquals("OK", resultResource.arrayofresources().get(0).provisioningStateValues()); + Assert.assertEquals("Product4", resultResource.arrayofresources().get(0).pname()); + Assert.assertEquals("Flat", resultResource.arrayofresources().get(0).flattenedProductType()); + Assert.assertEquals("Building 44", resultResource.arrayofresources().get(0).location()); + Assert.assertEquals("Resource4", resultResource.arrayofresources().get(0).name()); + Assert.assertEquals("Succeeded", resultResource.arrayofresources().get(0).provisioningState()); + Assert.assertEquals("Microsoft.Web/sites", resultResource.arrayofresources().get(0).type()); + Assert.assertEquals("value1", resultResource.arrayofresources().get(0).tags().get("tag1")); + Assert.assertEquals("value3", resultResource.arrayofresources().get(0).tags().get("tag2")); // Resource 2 - Assert.assertEquals("5", resultResource.getArrayofresources().get(1).getId()); - Assert.assertEquals("Resource5", resultResource.getArrayofresources().get(1).getName()); - Assert.assertEquals("Building 44", resultResource.getArrayofresources().get(1).getLocation()); + Assert.assertEquals("5", resultResource.arrayofresources().get(1).id()); + Assert.assertEquals("Resource5", resultResource.arrayofresources().get(1).name()); + Assert.assertEquals("Building 44", resultResource.arrayofresources().get(1).location()); // Resource 3 - Assert.assertEquals("6", resultResource.getArrayofresources().get(2).getId()); - Assert.assertEquals("Resource6", resultResource.getArrayofresources().get(2).getName()); + Assert.assertEquals("6", resultResource.arrayofresources().get(2).id()); + Assert.assertEquals("Resource6", resultResource.arrayofresources().get(2).name()); //productresource - Assert.assertEquals("7", resultResource.getProductresource().getId()); - Assert.assertEquals("Resource7", resultResource.getProductresource().getName()); + Assert.assertEquals("7", resultResource.productresource().id()); + Assert.assertEquals("Resource7", resultResource.productresource().name()); } @Test public void putResourceCollection() throws Exception { Map resources = new HashMap<>(); resources.put("Resource1", new FlattenedProduct()); - resources.get("Resource1").setLocation("West US"); - resources.get("Resource1").setPname("Product1"); - resources.get("Resource1").setFlattenedProductType("Flat"); - resources.get("Resource1").setTags(new HashMap()); - resources.get("Resource1").getTags().put("tag1", "value1"); - resources.get("Resource1").getTags().put("tag2", "value3"); + resources.get("Resource1").withLocation("West US"); + resources.get("Resource1").withPname("Product1"); + resources.get("Resource1").withFlattenedProductType("Flat"); + resources.get("Resource1").withTags(new HashMap()); + resources.get("Resource1").tags().put("tag1", "value1"); + resources.get("Resource1").tags().put("tag2", "value3"); resources.put("Resource2", new FlattenedProduct()); - resources.get("Resource2").setLocation("Building 44"); - resources.get("Resource2").setPname("Product2"); - resources.get("Resource2").setFlattenedProductType("Flat"); + resources.get("Resource2").withLocation("Building 44"); + resources.get("Resource2").withPname("Product2"); + resources.get("Resource2").withFlattenedProductType("Flat"); ResourceCollection complexObj = new ResourceCollection(); - complexObj.setDictionaryofresources(resources); - complexObj.setArrayofresources(new ArrayList()); - complexObj.getArrayofresources().add(resources.get("Resource1")); + complexObj.withDictionaryofresources(resources); + complexObj.withArrayofresources(new ArrayList()); + complexObj.arrayofresources().add(resources.get("Resource1")); FlattenedProduct p1 = new FlattenedProduct(); - p1.setLocation("East US"); - p1.setPname("Product2"); - p1.setFlattenedProductType("Flat"); - complexObj.getArrayofresources().add(p1); + p1.withLocation("East US"); + p1.withPname("Product2"); + p1.withFlattenedProductType("Flat"); + complexObj.arrayofresources().add(p1); FlattenedProduct pr = new FlattenedProduct(); - pr.setLocation("India"); - pr.setPname("Azure"); - pr.setFlattenedProductType("Flat"); - complexObj.setProductresource(pr); + pr.withLocation("India"); + pr.withPname("Azure"); + pr.withFlattenedProductType("Flat"); + complexObj.withProductresource(pr); ServiceResponse response = client.putResourceCollection(complexObj); Assert.assertEquals(200, response.getResponse().code()); @@ -199,12 +198,12 @@ public void putResourceCollection() throws Exception { @Test public void putSimpleProduct() throws Exception { SimpleProduct simpleProduct = new SimpleProduct(); - simpleProduct.setDescription("product description"); - simpleProduct.setProductId("123"); - simpleProduct.setMaxProductDisplayName("max name"); - simpleProduct.setCapacity("Large"); - simpleProduct.setOdatavalue("http://foo"); - simpleProduct.setGenericValue("https://generic"); + simpleProduct.withDescription("product description"); + simpleProduct.withProductId("123"); + simpleProduct.withMaxProductDisplayName("max name"); + simpleProduct.withCapacity("Large"); + simpleProduct.withOdatavalue("http://foo"); + simpleProduct.withGenericValue("https://generic"); SimpleProduct product = client.putSimpleProduct(simpleProduct).getBody(); assertSimpleProductEquals(simpleProduct, product); @@ -213,39 +212,39 @@ public void putSimpleProduct() throws Exception { @Test public void postFlattenedSimpleProduct() throws Exception { SimpleProduct simpleProduct = new SimpleProduct(); - simpleProduct.setDescription("product description"); - simpleProduct.setProductId("123"); - simpleProduct.setMaxProductDisplayName("max name"); - simpleProduct.setCapacity("Large"); - simpleProduct.setOdatavalue("http://foo"); + simpleProduct.withDescription("product description"); + simpleProduct.withProductId("123"); + simpleProduct.withMaxProductDisplayName("max name"); + simpleProduct.withCapacity("Large"); + simpleProduct.withOdatavalue("http://foo"); client.postFlattenedSimpleProduct("123", "max name", "product description", null, "http://foo"); } @Test public void putSimpleProductWithGrouping() throws Exception { SimpleProduct simpleProduct = new SimpleProduct(); - simpleProduct.setDescription("product description"); - simpleProduct.setProductId("123"); - simpleProduct.setMaxProductDisplayName("max name"); - simpleProduct.setCapacity("Large"); - simpleProduct.setOdatavalue("http://foo"); + simpleProduct.withDescription("product description"); + simpleProduct.withProductId("123"); + simpleProduct.withMaxProductDisplayName("max name"); + simpleProduct.withCapacity("Large"); + simpleProduct.withOdatavalue("http://foo"); FlattenParameterGroup flattenParameterGroup = new FlattenParameterGroup(); - flattenParameterGroup.setDescription("product description"); - flattenParameterGroup.setProductId("123"); - flattenParameterGroup.setMaxProductDisplayName("max name"); - flattenParameterGroup.setOdatavalue("http://foo"); - flattenParameterGroup.setName("groupproduct"); + flattenParameterGroup.withDescription("product description"); + flattenParameterGroup.withProductId("123"); + flattenParameterGroup.withMaxProductDisplayName("max name"); + flattenParameterGroup.withOdatavalue("http://foo"); + flattenParameterGroup.withName("groupproduct"); SimpleProduct product = client.putSimpleProductWithGrouping(flattenParameterGroup).getBody(); assertSimpleProductEquals(simpleProduct, product); } private void assertSimpleProductEquals(SimpleProduct expected, SimpleProduct actual) throws Exception { - Assert.assertEquals(expected.getProductId(), actual.getProductId()); - Assert.assertEquals(expected.getDescription(), actual.getDescription()); - Assert.assertEquals(expected.getCapacity(), actual.getCapacity()); - Assert.assertEquals(expected.getMaxProductDisplayName(), actual.getMaxProductDisplayName()); - Assert.assertEquals(expected.getOdatavalue(), actual.getOdatavalue()); + Assert.assertEquals(expected.productId(), actual.productId()); + Assert.assertEquals(expected.description(), actual.description()); + Assert.assertEquals(expected.capacity(), actual.capacity()); + Assert.assertEquals(expected.maxProductDisplayName(), actual.maxProductDisplayName()); + Assert.assertEquals(expected.odatavalue(), actual.odatavalue()); } } \ No newline at end of file diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/report/CoverageReporter.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/report/CoverageReporter.java index f394131cc8b52..2ab838e9c3f77 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/report/CoverageReporter.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/report/CoverageReporter.java @@ -4,6 +4,8 @@ import java.util.List; import java.util.Map; +import fixtures.report.implementation.AutoRestReportServiceImpl; + public final class CoverageReporter { private static AutoRestReportService client = new AutoRestReportServiceImpl("http://localhost:3000"); diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/requiredoptional/ExplicitTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/requiredoptional/ExplicitTests.java index e2c061f50d924..12af990172355 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/requiredoptional/ExplicitTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/requiredoptional/ExplicitTests.java @@ -1,5 +1,6 @@ package fixtures.requiredoptional; +import fixtures.requiredoptional.implementation.AutoRestRequiredOptionalTestServiceImpl; import fixtures.requiredoptional.models.ArrayOptionalWrapper; import fixtures.requiredoptional.models.ArrayWrapper; import fixtures.requiredoptional.models.ClassOptionalWrapper; @@ -24,13 +25,13 @@ public static void setup() { @Test public void postRequiredIntegerParameter() throws Exception { // Compile time error - //client.getExplicitOperations().postRequiredIntegerParameter(null); + //client.explicits().postRequiredIntegerParameter(null); } @Test public void postOptionalIntegerParameter() throws Exception { try { - client.getExplicitOperations().postOptionalIntegerParameter(null); + client.explicits().postOptionalIntegerParameter(null); fail(); } catch (IllegalArgumentException ex) { // Body parameter cannot be null @@ -41,31 +42,31 @@ public void postOptionalIntegerParameter() throws Exception { public void postRequiredIntegerProperty() throws Exception { // Compile time error //IntWrapper body = new IntWrapper(); - //body.setValue(null); + //body.withValue(null); } @Test public void postOptionalIntegerProperty() throws Exception { IntOptionalWrapper body = new IntOptionalWrapper(); - body.setValue(null); - client.getExplicitOperations().postOptionalIntegerProperty(body); + body.withValue(null); + client.explicits().postOptionalIntegerProperty(body); } @Test public void postRequiredIntegerHeader() throws Exception { // Compile time error - //client.getExplicitOperations().postRequiredIntegerHeader(null); + //client.explicits().postRequiredIntegerHeader(null); } @Test public void postOptionalIntegerHeader() throws Exception { - client.getExplicitOperations().postOptionalIntegerHeader(null); + client.explicits().postOptionalIntegerHeader(null); } @Test public void postRequiredStringParameter() throws Exception { try { - client.getExplicitOperations().postRequiredStringParameter(null); + client.explicits().postRequiredStringParameter(null); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter bodyParameter is required")); @@ -75,7 +76,7 @@ public void postRequiredStringParameter() throws Exception { @Test public void postOptionalStringParameter() throws Exception { try { - client.getExplicitOperations().postOptionalIntegerParameter(null); + client.explicits().postOptionalIntegerParameter(null); fail(); } catch (IllegalArgumentException ex) { // Body parameter cannot be null @@ -86,8 +87,8 @@ public void postOptionalStringParameter() throws Exception { public void postRequiredStringProperty() throws Exception { try { StringWrapper body = new StringWrapper(); - body.setValue(null); - client.getExplicitOperations().postRequiredStringProperty(body); + body.withValue(null); + client.explicits().postRequiredStringProperty(body); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("value is required")); @@ -97,14 +98,14 @@ public void postRequiredStringProperty() throws Exception { @Test public void postOptionalStringProperty() throws Exception { StringOptionalWrapper body = new StringOptionalWrapper(); - body.setValue(null); - client.getExplicitOperations().postOptionalStringProperty(body); + body.withValue(null); + client.explicits().postOptionalStringProperty(body); } @Test public void postRequiredStringHeader() throws Exception { try { - client.getExplicitOperations().postRequiredStringHeader(null); + client.explicits().postRequiredStringHeader(null); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter headerParameter is required")); @@ -113,13 +114,13 @@ public void postRequiredStringHeader() throws Exception { @Test public void postOptionalStringHeader() throws Exception { - client.getExplicitOperations().postOptionalStringHeader(null); + client.explicits().postOptionalStringHeader(null); } @Test public void postRequiredClassParameter() throws Exception { try { - client.getExplicitOperations().postRequiredClassParameter(null); + client.explicits().postRequiredClassParameter(null); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter bodyParameter is required")); @@ -129,7 +130,7 @@ public void postRequiredClassParameter() throws Exception { @Test public void postOptionalClassParameter() throws Exception { try { - client.getExplicitOperations().postOptionalClassParameter(null); + client.explicits().postOptionalClassParameter(null); fail(); } catch (IllegalArgumentException ex) { // Body parameter cannot be null @@ -140,8 +141,8 @@ public void postOptionalClassParameter() throws Exception { public void postRequiredClassProperty() throws Exception { try { ClassWrapper body = new ClassWrapper(); - body.setValue(null); - client.getExplicitOperations().postRequiredClassProperty(body); + body.withValue(null); + client.explicits().postRequiredClassProperty(body); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("value is required")); @@ -151,14 +152,14 @@ public void postRequiredClassProperty() throws Exception { @Test public void postOptionalClassProperty() throws Exception { ClassOptionalWrapper body = new ClassOptionalWrapper(); - body.setValue(null); - client.getExplicitOperations().postOptionalClassProperty(body); + body.withValue(null); + client.explicits().postOptionalClassProperty(body); } @Test public void postRequiredArrayParameter() throws Exception { try { - client.getExplicitOperations().postRequiredArrayParameter(null); + client.explicits().postRequiredArrayParameter(null); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter bodyParameter is required")); @@ -168,7 +169,7 @@ public void postRequiredArrayParameter() throws Exception { @Test public void postOptionalArrayParameter() throws Exception { try { - client.getExplicitOperations().postOptionalArrayParameter(null); + client.explicits().postOptionalArrayParameter(null); fail(); } catch (IllegalArgumentException ex) { // Body parameter cannot be null @@ -179,8 +180,8 @@ public void postOptionalArrayParameter() throws Exception { public void postRequiredArrayProperty() throws Exception { try { ArrayWrapper body = new ArrayWrapper(); - body.setValue(null); - client.getExplicitOperations().postRequiredArrayProperty(body); + body.withValue(null); + client.explicits().postRequiredArrayProperty(body); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("value is required")); @@ -190,14 +191,14 @@ public void postRequiredArrayProperty() throws Exception { @Test public void postOptionalArrayProperty() throws Exception { ArrayOptionalWrapper body = new ArrayOptionalWrapper(); - body.setValue(null); - client.getExplicitOperations().postOptionalArrayProperty(body); + body.withValue(null); + client.explicits().postOptionalArrayProperty(body); } @Test public void postRequiredArrayHeader() throws Exception { try { - client.getExplicitOperations().postRequiredArrayHeader(null); + client.explicits().postRequiredArrayHeader(null); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter headerParameter is required")); @@ -206,6 +207,6 @@ public void postRequiredArrayHeader() throws Exception { @Test public void postOptionalArrayHeader() throws Exception { - client.getExplicitOperations().postOptionalArrayHeader(null); + client.explicits().postOptionalArrayHeader(null); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/requiredoptional/ImplicitTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/requiredoptional/ImplicitTests.java index ec3f53914001d..a169404f35fde 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/requiredoptional/ImplicitTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/requiredoptional/ImplicitTests.java @@ -4,6 +4,8 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.requiredoptional.implementation.AutoRestRequiredOptionalTestServiceImpl; + import static org.junit.Assert.fail; public class ImplicitTests { @@ -17,7 +19,7 @@ public static void setup() { @Test public void getRequiredPath() throws Exception { try { - client.getImplicitOperations().getRequiredPath(null); + client.implicits().getRequiredPath(null); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter pathParameter is required")); @@ -26,18 +28,18 @@ public void getRequiredPath() throws Exception { @Test public void putOptionalQuery() throws Exception { - client.getImplicitOperations().putOptionalQuery(null); + client.implicits().putOptionalQuery(null); } @Test public void putOptionalHeader() throws Exception { - client.getImplicitOperations().putOptionalHeader(null); + client.implicits().putOptionalHeader(null); } @Test public void putOptionalBody() throws Exception { try { - client.getImplicitOperations().putOptionalBody(null); + client.implicits().putOptionalBody(null); fail(); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Body parameter value must not be null")); @@ -47,25 +49,25 @@ public void putOptionalBody() throws Exception { @Test public void getRequiredGlobalPath() throws Exception { try { - client.getImplicitOperations().getRequiredGlobalPath(); + client.implicits().getRequiredGlobalPath(); fail(); } catch (IllegalArgumentException ex) { - Assert.assertTrue(ex.getMessage().contains("this.client.getRequiredGlobalPath() is required")); + Assert.assertTrue(ex.getMessage().contains("this.client.requiredGlobalPath() is required")); } } @Test public void getRequiredGlobalQuery() throws Exception { try { - client.getImplicitOperations().getRequiredGlobalQuery(); + client.implicits().getRequiredGlobalQuery(); fail(); } catch (IllegalArgumentException ex) { - Assert.assertTrue(ex.getMessage().contains("this.client.getRequiredGlobalQuery() is required")); + Assert.assertTrue(ex.getMessage().contains("this.client.requiredGlobalQuery() is required")); } } @Test public void getOptionalGlobalQuery() throws Exception { - client.getImplicitOperations().getOptionalGlobalQuery(); + client.implicits().getOptionalGlobalQuery(); } } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/PathItemsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/PathItemsTests.java index 971476f32794e..dc040079bbfea 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/PathItemsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/PathItemsTests.java @@ -3,6 +3,8 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.url.implementation.AutoRestUrlTestServiceImpl; + public class PathItemsTests { private static AutoRestUrlTestService client; @@ -13,9 +15,9 @@ public static void setup() { @Test public void getAllWithValues() throws Exception { - client.setGlobalStringPath("globalStringPath"); - client.setGlobalStringQuery("globalStringQuery"); - client.getPathItemsOperations().getAllWithValues( + client.withGlobalStringPath("globalStringPath"); + client.withGlobalStringQuery("globalStringQuery"); + client.pathItems().getAllWithValues( "localStringPath", "pathItemStringPath", "localStringQuery", @@ -25,9 +27,9 @@ public void getAllWithValues() throws Exception { @Test public void getGlobalQueryNull() throws Exception { - client.setGlobalStringPath("globalStringPath"); - client.setGlobalStringQuery(null); - client.getPathItemsOperations().getGlobalQueryNull( + client.withGlobalStringPath("globalStringPath"); + client.withGlobalStringQuery(null); + client.pathItems().getGlobalQueryNull( "localStringPath", "pathItemStringPath", "localStringQuery", @@ -37,9 +39,9 @@ public void getGlobalQueryNull() throws Exception { @Test public void getGlobalAndLocalQueryNull() throws Exception { - client.setGlobalStringPath("globalStringPath"); - client.setGlobalStringQuery(null); - client.getPathItemsOperations().getGlobalAndLocalQueryNull( + client.withGlobalStringPath("globalStringPath"); + client.withGlobalStringQuery(null); + client.pathItems().getGlobalAndLocalQueryNull( "localStringPath", "pathItemStringPath", null, @@ -49,9 +51,9 @@ public void getGlobalAndLocalQueryNull() throws Exception { @Test public void getLocalPathItemQueryNull() throws Exception { - client.setGlobalStringPath("globalStringPath"); - client.setGlobalStringQuery("globalStringQuery"); - client.getPathItemsOperations().getLocalPathItemQueryNull( + client.withGlobalStringPath("globalStringPath"); + client.withGlobalStringQuery("globalStringQuery"); + client.pathItems().getLocalPathItemQueryNull( "localStringPath", "pathItemStringPath", null, diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/PathsTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/PathsTests.java index 07d6abe3dcb20..d24e3079c4074 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/PathsTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/PathsTests.java @@ -4,6 +4,7 @@ import org.junit.BeforeClass; import org.junit.Test; +import fixtures.url.implementation.AutoRestUrlTestServiceImpl; import fixtures.url.models.UriColor; public class PathsTests { @@ -16,68 +17,68 @@ public static void setup() { @Test public void getBooleanTrue() throws Exception { - client.getPathsOperations().getBooleanTrue(); + client.paths().getBooleanTrue(); } @Test public void getBooleanFalse() throws Exception { - client.getPathsOperations().getBooleanFalse(); + client.paths().getBooleanFalse(); } @Test public void getIntOneMillion() throws Exception { - client.getPathsOperations().getIntOneMillion(); + client.paths().getIntOneMillion(); } @Test public void getIntNegativeOneMillion() throws Exception { - client.getPathsOperations().getIntNegativeOneMillion(); + client.paths().getIntNegativeOneMillion(); } @Test public void getTenBillion() throws Exception { - client.getPathsOperations().getTenBillion(); + client.paths().getTenBillion(); } @Test public void getNegativeTenBillion() throws Exception { - client.getPathsOperations().getNegativeTenBillion(); + client.paths().getNegativeTenBillion(); } @Test public void floatScientificPositive() throws Exception { - client.getPathsOperations().floatScientificPositive(); + client.paths().floatScientificPositive(); } @Test public void floatScientificNegative() throws Exception { - client.getPathsOperations().floatScientificNegative(); + client.paths().floatScientificNegative(); } @Test public void doubleDecimalPositive() throws Exception { - client.getPathsOperations().doubleDecimalPositive(); + client.paths().doubleDecimalPositive(); } @Test public void doubleDecimalNegative() throws Exception { - client.getPathsOperations().doubleDecimalNegative(); + client.paths().doubleDecimalNegative(); } @Test public void stringUrlEncoded() throws Exception { - client.getPathsOperations().stringUrlEncoded(); + client.paths().stringUrlEncoded(); } @Test public void stringEmpty() throws Exception { - client.getPathsOperations().stringEmpty(); + client.paths().stringEmpty(); } @Test public void stringNull() throws Exception { try { - client.getPathsOperations().stringNull(null); + client.paths().stringNull(null); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter stringPath is required")); } @@ -85,13 +86,13 @@ public void stringNull() throws Exception { @Test public void enumValid() throws Exception { - client.getPathsOperations().enumValid(UriColor.GREEN_COLOR); + client.paths().enumValid(UriColor.GREEN_COLOR); } @Test public void enumNull() throws Exception { try { - client.getPathsOperations().enumNull(null); + client.paths().enumNull(null); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter enumPath is required")); } @@ -99,18 +100,18 @@ public void enumNull() throws Exception { @Test public void byteMultiByte() throws Exception { - client.getPathsOperations().byteMultiByte("啊齄丂狛狜隣郎隣兀﨩".getBytes("UTF-8")); + client.paths().byteMultiByte("啊齄丂狛狜隣郎隣兀﨩".getBytes("UTF-8")); } @Test public void byteEmpty() throws Exception { - client.getPathsOperations().byteEmpty(); + client.paths().byteEmpty(); } @Test public void byteNull() throws Exception { try { - client.getPathsOperations().byteNull(null); + client.paths().byteNull(null); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter bytePath is required")); } @@ -118,13 +119,13 @@ public void byteNull() throws Exception { @Test public void dateValid() throws Exception { - client.getPathsOperations().dateValid(); + client.paths().dateValid(); } @Test public void dateNull() throws Exception { try { - client.getPathsOperations().dateNull(null); + client.paths().dateNull(null); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter datePath is required")); } @@ -132,13 +133,13 @@ public void dateNull() throws Exception { @Test public void dateTimeValid() throws Exception { - client.getPathsOperations().dateTimeValid(); + client.paths().dateTimeValid(); } @Test public void dateTimeNull() throws Exception { try { - client.getPathsOperations().dateTimeNull(null); + client.paths().dateTimeNull(null); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter dateTimePath is required")); } diff --git a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/QueriesTests.java b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/QueriesTests.java index 26bbc9fc3763f..3568063282956 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/QueriesTests.java +++ b/AutoRest/Generators/Java/Java.Tests/src/test/java/fixtures/url/QueriesTests.java @@ -7,9 +7,9 @@ import java.util.ArrayList; import java.util.List; +import fixtures.url.implementation.AutoRestUrlTestServiceImpl; import fixtures.url.models.ErrorException; import fixtures.url.models.UriColor; -import okhttp3.logging.HttpLoggingInterceptor; public class QueriesTests { private static AutoRestUrlTestService client; @@ -17,98 +17,97 @@ public class QueriesTests { @BeforeClass public static void setup() { client = new AutoRestUrlTestServiceImpl("http://localhost:3000"); - client.setLogLevel(HttpLoggingInterceptor.Level.HEADERS); } @Test public void getBooleanTrue() throws Exception { - client.getQueriesOperations().getBooleanTrue(); + client.queries().getBooleanTrue(); } @Test public void getBooleanFalse() throws Exception { - client.getQueriesOperations().getBooleanFalse(); + client.queries().getBooleanFalse(); } @Test public void getBooleanNull() throws Exception { - client.getQueriesOperations().getBooleanNull(null); + client.queries().getBooleanNull(null); } @Test public void getIntOneMillion() throws Exception { - client.getQueriesOperations().getIntOneMillion(); + client.queries().getIntOneMillion(); } @Test public void getIntNegativeOneMillion() throws Exception { - client.getQueriesOperations().getIntNegativeOneMillion(); + client.queries().getIntNegativeOneMillion(); } @Test public void getIntNull() throws Exception { - client.getQueriesOperations().getIntNull(null); + client.queries().getIntNull(null); } @Test public void getTenBillion() throws Exception { - client.getQueriesOperations().getTenBillion(); + client.queries().getTenBillion(); } @Test public void getNegativeTenBillion() throws Exception { - client.getQueriesOperations().getNegativeTenBillion(); + client.queries().getNegativeTenBillion(); } @Test public void getLongNull() throws Exception { - client.getQueriesOperations().getLongNull(null); + client.queries().getLongNull(null); } @Test public void floatScientificPositive() throws Exception { - client.getQueriesOperations().floatScientificPositive(); + client.queries().floatScientificPositive(); } @Test public void floatScientificNegative() throws Exception { - client.getQueriesOperations().floatScientificNegative(); + client.queries().floatScientificNegative(); } @Test public void floatNull() throws Exception { - client.getQueriesOperations().floatNull(null); + client.queries().floatNull(null); } @Test public void doubleDecimalPositive() throws Exception { - client.getQueriesOperations().doubleDecimalPositive(); + client.queries().doubleDecimalPositive(); } @Test public void doubleDecimalNegative() throws Exception { - client.getQueriesOperations().doubleDecimalNegative(); + client.queries().doubleDecimalNegative(); } @Test public void doubleNull() throws Exception { - client.getQueriesOperations().doubleNull(null); + client.queries().doubleNull(null); } @Test public void stringUrlEncoded() throws Exception { - client.getQueriesOperations().stringUrlEncoded(); + client.queries().stringUrlEncoded(); } @Test public void stringEmpty() throws Exception { - client.getQueriesOperations().stringEmpty(); + client.queries().stringEmpty(); } @Test public void stringNull() throws Exception { try { - client.getQueriesOperations().stringNull(null); + client.queries().stringNull(null); } catch (ErrorException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter stringPath is required")); } @@ -116,13 +115,13 @@ public void stringNull() throws Exception { @Test public void enumValid() throws Exception { - client.getQueriesOperations().enumValid(UriColor.GREEN_COLOR); + client.queries().enumValid(UriColor.GREEN_COLOR); } @Test public void enumNull() throws Exception { try { - client.getQueriesOperations().enumNull(null); + client.queries().enumNull(null); } catch (ErrorException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter enumPath is required")); } @@ -130,18 +129,18 @@ public void enumNull() throws Exception { @Test public void byteMultiByte() throws Exception { - client.getQueriesOperations().byteMultiByte("啊齄丂狛狜隣郎隣兀﨩".getBytes("UTF-8")); + client.queries().byteMultiByte("啊齄丂狛狜隣郎隣兀﨩".getBytes("UTF-8")); } @Test public void byteEmpty() throws Exception { - client.getQueriesOperations().byteEmpty(); + client.queries().byteEmpty(); } @Test public void byteNull() throws Exception { try { - client.getQueriesOperations().byteNull(null); + client.queries().byteNull(null); } catch (ErrorException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter bytePath is required")); } @@ -149,13 +148,13 @@ public void byteNull() throws Exception { @Test public void dateValid() throws Exception { - client.getQueriesOperations().dateValid(); + client.queries().dateValid(); } @Test public void dateNull() throws Exception { try { - client.getQueriesOperations().dateNull(null); + client.queries().dateNull(null); } catch (ErrorException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter datePath is required")); } @@ -163,13 +162,13 @@ public void dateNull() throws Exception { @Test public void dateTimeValid() throws Exception { - client.getQueriesOperations().dateTimeValid(); + client.queries().dateTimeValid(); } @Test public void dateTimeNull() throws Exception { try { - client.getQueriesOperations().dateTimeNull(null); + client.queries().dateTimeNull(null); } catch (ErrorException ex) { Assert.assertTrue(ex.getMessage().contains("Parameter dateTimePath is required")); } @@ -182,17 +181,17 @@ public void arrayStringCsvValid() throws Exception { query.add("begin!*'();:@ &=+$,/?#[]end"); query.add(null); query.add(""); - client.getQueriesOperations().arrayStringCsvValid(query); + client.queries().arrayStringCsvValid(query); } @Test public void arrayStringCsvNull() throws Exception { - client.getQueriesOperations().arrayStringCsvNull(null); + client.queries().arrayStringCsvNull(null); } @Test public void arrayStringCsvEmpty() throws Exception { - client.getQueriesOperations().arrayStringCsvEmpty(new ArrayList()); + client.queries().arrayStringCsvEmpty(new ArrayList()); } @Test @@ -202,7 +201,7 @@ public void arrayStringSsvValid() throws Exception { query.add("begin!*'();:@ &=+$,/?#[]end"); query.add(null); query.add(""); - client.getQueriesOperations().arrayStringSsvValid(query); + client.queries().arrayStringSsvValid(query); } @Test @@ -212,7 +211,7 @@ public void arrayStringTsvValid() throws Exception { query.add("begin!*'();:@ &=+$,/?#[]end"); query.add(null); query.add(""); - client.getQueriesOperations().arrayStringTsvValid(query); + client.queries().arrayStringTsvValid(query); } @Test @@ -222,6 +221,6 @@ public void arrayStringPipesValid() throws Exception { query.add("begin!*'();:@ &=+$,/?#[]end"); query.add(null); query.add(""); - client.getQueriesOperations().arrayStringPipesValid(query); + client.queries().arrayStringPipesValid(query); } } diff --git a/AutoRest/Generators/Java/Java/GlobalSuppressions.cs b/AutoRest/Generators/Java/Java/GlobalSuppressions.cs index 9273ec6f370ce..607af3e5b6e51 100644 --- a/AutoRest/Generators/Java/Java/GlobalSuppressions.cs +++ b/AutoRest/Generators/Java/Java/GlobalSuppressions.cs @@ -184,3 +184,12 @@ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Rest.Generator.Utilities.IndentedStringBuilder.AppendLine(System.String)", Scope = "member", Target = "Microsoft.Rest.Generator.Java.MethodTemplateModel.#SuccessCallback(System.Boolean)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Rest.Generator.Utilities.IndentedStringBuilder.AppendLine(System.String)", Scope = "member", Target = "Microsoft.Rest.Generator.Java.ParameterModel.#convertClientTypeToWireType(Microsoft.Rest.Generator.Java.ITypeModel,System.String,System.String,System.String,System.Int32)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "Microsoft.Rest.Generator.Java.PrimaryTypeModel.#DefaultValue(Microsoft.Rest.Generator.ClientModel.Method)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.MethodGroupTemplateModel.#MethodGroupTypeString")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Rest.Generator.Java.MethodGroupTemplateModel.#MethodGroupFullType")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "Microsoft.Rest.Generator.Java.PackageInfoTemplateModel.#.ctor(Microsoft.Rest.Generator.ClientModel.ServiceClient,System.String,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Scope = "member", Target = "Microsoft.Rest.Generator.Java.JavaCodeNamer.#NormalizeTypeDeclaration(Microsoft.Rest.Generator.ClientModel.IType)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.Rest.Generator.Java.MethodTemplateModel.#GetMapping(Microsoft.Rest.Generator.ClientModel.ParameterMapping,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Scope = "member", Target = "Microsoft.Rest.Generator.Java.ModelTemplateModel.#PropertyModels")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Scope = "member", Target = "Microsoft.Rest.Generator.Java.PropertyModel.#_package")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Imports", Scope = "member", Target = "Microsoft.Rest.Generator.Java.PropertyModel.#Imports")] + diff --git a/AutoRest/Generators/Java/Java/JavaCodeGenerator.cs b/AutoRest/Generators/Java/Java/JavaCodeGenerator.cs index 66621e2f0034c..2392e74faeba2 100644 --- a/AutoRest/Generators/Java/Java/JavaCodeGenerator.cs +++ b/AutoRest/Generators/Java/Java/JavaCodeGenerator.cs @@ -89,7 +89,7 @@ public override async Task Generate(ServiceClient serviceClient) { Model = serviceClientTemplateModel, }; - await Write(serviceClientTemplate, serviceClient.Name.ToPascalCase() + "Impl.java"); + await Write(serviceClientTemplate, Path.Combine("implementation", serviceClient.Name.ToPascalCase() + "Impl.java")); var serviceClientInterfaceTemplate = new ServiceClientInterfaceTemplate { @@ -116,7 +116,7 @@ public override async Task Generate(ServiceClient serviceClient) { Model = methodGroupModel }; - await Write(methodGroupTemplate, methodGroupModel.MethodGroupType.ToPascalCase() + "Impl.java"); + await Write(methodGroupTemplate, Path.Combine("implementation", methodGroupModel.MethodGroupType.ToPascalCase() + "Impl.java")); var methodGroupInterfaceTemplate = new MethodGroupInterfaceTemplate { Model = methodGroupModel @@ -152,7 +152,11 @@ await Write(new PackageInfoTemplate }, _packageInfoFileName); await Write(new PackageInfoTemplate { - Model = new PackageInfoTemplateModel(serviceClient, serviceClient.Name, true) + Model = new PackageInfoTemplateModel(serviceClient, serviceClient.Name, "implementation") + }, Path.Combine("implementation", _packageInfoFileName)); + await Write(new PackageInfoTemplate + { + Model = new PackageInfoTemplateModel(serviceClient, serviceClient.Name, "models") }, Path.Combine("models", _packageInfoFileName)); } } diff --git a/AutoRest/Generators/Java/Java/JavaCodeNamer.cs b/AutoRest/Generators/Java/Java/JavaCodeNamer.cs index 3c4921479f9e1..71b969347518e 100644 --- a/AutoRest/Generators/Java/Java/JavaCodeNamer.cs +++ b/AutoRest/Generators/Java/Java/JavaCodeNamer.cs @@ -88,15 +88,14 @@ public JavaCodeNamer(string nameSpace) #region naming /// - /// Skips name collision resolution for method groups (operations) as they get - /// renamed in template models. + /// Resolves name collisions in the client model for method groups (operations). /// /// /// protected override void ResolveMethodGroupNameCollision(ServiceClient serviceClient, Dictionary exclusionDictionary) { - // Do nothing + // do nothing } public override string GetFieldName(string name) @@ -122,10 +121,19 @@ public override string GetMethodName(string name) name = GetEscapedReservedName(name, "Method"); return CamelCase(name); } - + public override string GetMethodGroupName(string name) { - return PascalCase(name); + if (string.IsNullOrWhiteSpace(name)) + { + return name; + } + name = PascalCase(name); + if (!name.EndsWith("s", StringComparison.OrdinalIgnoreCase)) + { + name += "s"; + } + return name; } public override string GetEnumMemberName(string name) @@ -134,7 +142,20 @@ public override string GetEnumMemberName(string name) { return name; } - return RemoveInvalidCharacters(new Regex("[\\ -]+").Replace(name, "_")).ToUpper(CultureInfo.InvariantCulture); + string result = RemoveInvalidCharacters(new Regex("[\\ -]+").Replace(name, "_")); + Func isUpper = new Func(c => c >= 'A' && c <= 'Z'); + Func isLower = new Func(c => c >= 'a' && c <= 'z'); + for (int i = 1; i < result.Length - 1; i++) + { + if (isUpper(result[i])) + { + if (result[i - 1] != '_' && isLower(result[i - 1])) + { + result = result.Insert(i, "_"); + } + } + } + return result.ToUpper(CultureInfo.InvariantCulture); } public override string GetParameterName(string name) @@ -179,9 +200,9 @@ public override void NormalizeClientModel(ServiceClient client) if (parameter.ClientProperty != null) { parameter.Name = string.Format(CultureInfo.InvariantCulture, - "{0}.get{1}()", + "{0}.{1}()", method.Group == null ? "this" : "this.client", - parameter.ClientProperty.Name.ToPascalCase()); + parameter.ClientProperty.Name.ToCamelCase()); } if (!parameter.IsRequired) @@ -217,6 +238,7 @@ protected override void NormalizeParameters(Method method) foreach (var parameterMapping in parameterTransformation.ParameterMappings) { + parameterMapping.InputParameter.Name = GetParameterName(parameterMapping.InputParameter.GetClientName()); if (parameterMapping.InputParameterProperty != null) { parameterMapping.InputParameterProperty = GetPropertyName(parameterMapping.InputParameterProperty); @@ -254,22 +276,16 @@ public override Response NormalizeTypeReference(Response typePair) } public override IType NormalizeTypeDeclaration(IType type) - { - return NormalizeTypeReference(type); - } - - public override IType NormalizeTypeReference(IType type) { if (type == null) { return null; } - var enumType = type as EnumType; - if (enumType != null && enumType.ModelAsString) + + if (type is ITypeModel) { - type = new PrimaryTypeModel(KnownPrimaryType.String); + return type; } - if (_visited.ContainsKey(type)) { return _visited[type]; @@ -300,27 +316,41 @@ public override IType NormalizeTypeReference(IType type) } if (type is EnumType) { - EnumTypeModel model = new EnumTypeModel(type as EnumType, _package); + EnumTypeModel model = NewEnumTypeModel(type as EnumType); _visited[type] = model; return NormalizeEnumType(model); } - throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, + throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Type {0} is not supported.", type.GetType())); } - private IType NormalizeEnumType(EnumType enumType) + public override IType NormalizeTypeReference(IType type) { - if (enumType.ModelAsString) + if (type == null) { - enumType.SerializedName = "string"; - enumType.Name = "string"; + return null; } - else + + if (type is ITypeModel) + { + return type; + } + + var enumType = type as EnumType; + if (enumType != null && enumType.ModelAsString) { - enumType.Name = GetTypeName(enumType.Name); + type = new PrimaryTypeModel(KnownPrimaryType.String); } + + return NormalizeTypeDeclaration(type); + } + + private IType NormalizeEnumType(EnumType enumType) + { + enumType.Name = GetTypeName(enumType.Name); + for (int i = 0; i < enumType.Values.Count; i++) { enumType.Values[i].Name = GetEnumMemberName(enumType.Values[i].Name); @@ -330,7 +360,12 @@ private IType NormalizeEnumType(EnumType enumType) protected virtual CompositeTypeModel NewCompositeTypeModel(CompositeType compositeType) { - return new CompositeTypeModel(compositeType as CompositeType, _package); + return new CompositeTypeModel(compositeType, _package); + } + + protected virtual EnumTypeModel NewEnumTypeModel(EnumType enumType) + { + return new EnumTypeModel(enumType, _package); } protected virtual IType NormalizeCompositeType(CompositeType compositeType) @@ -347,6 +382,10 @@ protected virtual IType NormalizeCompositeType(CompositeType compositeType) } } + if (compositeType.BaseModelType != null) { + compositeType.BaseModelType = (CompositeType) NormalizeTypeReference(compositeType.BaseModelType); + } + return compositeType; } @@ -424,8 +463,8 @@ public static string GetJavaException(string exception, ServiceClient serviceCli return "com.microsoft.rest.ServiceException"; case "CloudException": return "com.microsoft.azure.CloudException"; - case "AutoRestException": - return "com.microsoft.rest.AutoRestException"; + case "RestException": + return "com.microsoft.rest.RestException"; case "IllegalArgumentException": return null; case "InterruptedException": diff --git a/AutoRest/Generators/Java/Java/TemplateModels/EnumTemplateModel.cs b/AutoRest/Generators/Java/Java/TemplateModels/EnumTemplateModel.cs index b383f2bf46bf5..2b1acd4d65d5d 100644 --- a/AutoRest/Generators/Java/Java/TemplateModels/EnumTemplateModel.cs +++ b/AutoRest/Generators/Java/Java/TemplateModels/EnumTemplateModel.cs @@ -12,5 +12,13 @@ public EnumTemplateModel(EnumType source) { this.LoadFrom(source); } + + public virtual string ModelsPackage + { + get + { + return ".models"; + } + } } } \ No newline at end of file diff --git a/AutoRest/Generators/Java/Java/TemplateModels/MethodGroupTemplateModel.cs b/AutoRest/Generators/Java/Java/TemplateModels/MethodGroupTemplateModel.cs index 521c9612f45a3..72d86331b20aa 100644 --- a/AutoRest/Generators/Java/Java/TemplateModels/MethodGroupTemplateModel.cs +++ b/AutoRest/Generators/Java/Java/TemplateModels/MethodGroupTemplateModel.cs @@ -21,10 +21,6 @@ public MethodGroupTemplateModel(ServiceClient serviceClient, string methodGroupN // changed in derived classes MethodGroupName = methodGroupName; MethodGroupType = methodGroupName.ToPascalCase(); - if (MethodGroupType != null) - { - MethodGroupType += "Operations"; - } Methods.Where(m => m.Group == MethodGroupName) .ForEach(m => MethodTemplateModels.Add(new MethodTemplateModel(m, serviceClient))); } @@ -34,6 +30,68 @@ public MethodGroupTemplateModel(ServiceClient serviceClient, string methodGroupN public string MethodGroupType { get; set; } + public string MethodGroupFullType + { + get + { + return Namespace.ToLower(CultureInfo.InvariantCulture) + "." + MethodGroupType; + } + } + + public virtual string MethodGroupDeclarationType + { + get + { + return MethodGroupType; + } + } + + public string MethodGroupImplType + { + get + { + return MethodGroupType + ImplClassSuffix; + } + } + + public virtual string ImplClassSuffix + { + get + { + return "Impl"; + } + } + + public virtual string ParentDeclaration + { + get + { + return " implements " + MethodGroupTypeString; + } + } + + public virtual string ImplPackage + { + get + { + return "implementation"; + } + } + + public string MethodGroupTypeString + { + get + { + if (this.MethodTemplateModels + .SelectMany(m => m.ImplImports) + .Any(i => i.Split('.').LastOrDefault() == MethodGroupType)) + { + return MethodGroupFullType; + } + return MethodGroupType; + } + } + public string MethodGroupServiceType { get @@ -42,13 +100,28 @@ public string MethodGroupServiceType } } + public virtual string ServiceClientType + { + get + { + return this.Name + "Impl"; + } + } + public virtual IEnumerable ImplImports { get { - return this.MethodTemplateModels + var imports = new List(); + imports.Add("retrofit2.Retrofit"); + if (MethodGroupTypeString == MethodGroupType) + { + imports.Add(MethodGroupFullType); + } + imports.AddRange(this.MethodTemplateModels .SelectMany(m => m.ImplImports) - .OrderBy(i => i).Distinct(); + .OrderBy(i => i).Distinct()); + return imports; } } diff --git a/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs index 7b9afbb821d68..99cd16b939fef 100644 --- a/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs +++ b/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs @@ -68,12 +68,24 @@ public virtual Dictionary ResponseModels } } - public IEnumerable RetrofitParameters + public virtual IEnumerable RetrofitParameters { get { - return LogicalParameterModels.Where(p => p.Location != ParameterLocation.None) - .Where(p => !p.Extensions.ContainsKey("hostParameter")); + var parameters = LogicalParameterModels.Where(p => p.Location != ParameterLocation.None) + .Where(p => !p.Extensions.ContainsKey("hostParameter")).ToList(); + if (IsParameterizedHost) + { + parameters.Add(new ParameterModel(new Parameter + { + Name = "parameterizedHost", + SerializedName = "x-ms-parameterized-host", + Location = ParameterLocation.Header, + IsRequired = true, + Type = new PrimaryTypeModel(KnownPrimaryType.String) + }, this)); + } + return parameters; } } @@ -230,6 +242,14 @@ public string MethodRequiredParameterApiInvocation } } + public virtual bool IsParameterizedHost + { + get + { + return ServiceClient.Extensions.ContainsKey(Generator.Extensions.ParameterizedHostExtension); + } + } + public string ParameterConversion { get @@ -292,22 +312,11 @@ public virtual string BuildInputMappings(bool filterRequired = false) foreach (var mapping in transformation.ParameterMappings) { - if (filterRequired && !mapping.InputParameter.IsRequired) - { - builder.AppendLine("{0}{1}{2};", - !conditionalAssignment && !(transformation.OutputParameter.Type is CompositeType) ? - ((ParameterModel)transformation.OutputParameter).WireType + " " : "", - ((ParameterModel)transformation.OutputParameter).WireName, - " = " + ((ParameterModel)transformation.OutputParameter).WireType.DefaultValue(this)); - } - else - { - builder.AppendLine("{0}{1}{2};", - !conditionalAssignment && !(transformation.OutputParameter.Type is CompositeType) ? - ((ParameterModel)transformation.OutputParameter).ClientType.ParameterVariant + " " : "", - transformation.OutputParameter.Name, - GetMapping(mapping)); - } + builder.AppendLine("{0}{1}{2};", + !conditionalAssignment && !(transformation.OutputParameter.Type is CompositeType) ? + ((ParameterModel)transformation.OutputParameter).ClientType.ParameterVariant + " " : "", + transformation.OutputParameter.Name, + GetMapping(mapping, filterRequired)); } if (conditionalAssignment) @@ -320,18 +329,22 @@ public virtual string BuildInputMappings(bool filterRequired = false) return builder.ToString(); } - private static string GetMapping(ParameterMapping mapping) + private static string GetMapping(ParameterMapping mapping, bool filterRequired = false) { string inputPath = mapping.InputParameter.Name; if (mapping.InputParameterProperty != null) { - inputPath += ".get" + CodeNamer.PascalCase(mapping.InputParameterProperty) + "()"; + inputPath += "." + CodeNamer.CamelCase(mapping.InputParameterProperty) + "()"; + } + if (filterRequired && !mapping.InputParameter.IsRequired) + { + inputPath = "null"; } string outputPath = ""; if (mapping.OutputParameterProperty != null) { - outputPath += ".set" + CodeNamer.PascalCase(mapping.OutputParameterProperty); + outputPath += ".with" + CodeNamer.PascalCase(mapping.OutputParameterProperty); return string.Format(CultureInfo.InvariantCulture, "{0}({1})", outputPath, inputPath); } else @@ -400,23 +413,6 @@ public virtual string InitializeResponseBody } } - /// - /// Generate the method parameter declarations with callback for a method - /// - public string MethodParameterApiDeclarationWithCallback - { - get - { - var parameters = MethodParameterApiDeclaration; - if (!parameters.IsNullOrEmpty()) - { - parameters += ", "; - } - parameters += "ServiceResponseCallback cb"; - return parameters; - } - } - public virtual string MethodParameterDeclarationWithCallback { get @@ -490,6 +486,19 @@ public IEnumerable LocalParameters } } + public string HostParameterReplacementArgs + { + get + { + var args = new List(); + foreach (var param in Parameters.Where(p => p.Extensions.ContainsKey("hostParameter"))) + { + args.Add("\"{" + param.SerializedName + "}\", " + param.Name); + } + return string.Join(", ", args); + } + } + /// /// Get the type for operation exception /// @@ -500,15 +509,7 @@ public virtual string OperationExceptionTypeString if (this.DefaultResponse.Body is CompositeType) { CompositeType type = this.DefaultResponse.Body as CompositeType; - if (type.Extensions.ContainsKey(Microsoft.Rest.Generator.Extensions.NameOverrideExtension)) - { - var ext = type.Extensions[Microsoft.Rest.Generator.Extensions.NameOverrideExtension] as Newtonsoft.Json.Linq.JContainer; - if (ext != null && ext["name"] != null) - { - return ext["name"].ToString(); - } - } - return type.Name + "Exception"; + return new ModelTemplateModel(type, ServiceClient).ExceptionTypeDefinitionName; } else { @@ -698,7 +699,6 @@ public virtual List ImplImports imports.Add("retrofit2.http.Headers"); } imports.Add("retrofit2.Response"); - imports.Add("retrofit2.Retrofit"); if (this.HttpMethod != HttpMethod.Head) { imports.Add("okhttp3.ResponseBody"); @@ -731,7 +731,8 @@ public virtual List ImplImports } // parameters this.LocalParameters.Concat(this.LogicalParameterModels) - .ForEach(p => imports.AddRange(p.ImplImports)); + .ForEach(p => imports.AddRange(p.ClientImplImports)); + this.RetrofitParameters.ForEach(p => imports.AddRange(p.WireImplImports)); // return type imports.AddRange(this.ReturnTypeModel.ImplImports); if (ReturnType.Body.IsPrimaryType(KnownPrimaryType.Stream)) @@ -747,6 +748,11 @@ public virtual List ImplImports string exceptionImport = JavaCodeNamer.GetJavaException(ex, ServiceClient); if (exceptionImport != null) imports.Add(JavaCodeNamer.GetJavaException(ex, ServiceClient)); }); + // parameterized host + if (IsParameterizedHost) + { + imports.Add("com.google.common.base.Joiner"); + } return imports.ToList(); } } diff --git a/AutoRest/Generators/Java/Java/TemplateModels/ModelTemplateModel.cs b/AutoRest/Generators/Java/Java/TemplateModels/ModelTemplateModel.cs index a47aa6b345011..8e35867d9a531 100644 --- a/AutoRest/Generators/Java/Java/TemplateModels/ModelTemplateModel.cs +++ b/AutoRest/Generators/Java/Java/TemplateModels/ModelTemplateModel.cs @@ -40,7 +40,7 @@ protected virtual JavaCodeNamer Namer public ServiceClient ServiceClient { get; set; } - public List PropertyModels { get; private set; } + public List PropertyModels { get; protected set; } public bool IsPolymorphic { @@ -140,7 +140,8 @@ private bool isSpecial(IType type) return false; } - public virtual IEnumerable ImportList { + public virtual IEnumerable ImportList + { get { var classes = new HashSet(); @@ -183,5 +184,13 @@ public virtual string ExceptionTypeDefinitionName return this.Name + "Exception"; } } + + public virtual string ModelsPackage + { + get + { + return ".models"; + } + } } } \ No newline at end of file diff --git a/AutoRest/Generators/Java/Java/TemplateModels/PackageInfoTemplateModel.cs b/AutoRest/Generators/Java/Java/TemplateModels/PackageInfoTemplateModel.cs index 712f6c1133144..243588e17974b 100644 --- a/AutoRest/Generators/Java/Java/TemplateModels/PackageInfoTemplateModel.cs +++ b/AutoRest/Generators/Java/Java/TemplateModels/PackageInfoTemplateModel.cs @@ -10,9 +10,9 @@ public class PackageInfoTemplateModel : ServiceClient { public string Title { get; private set; } public string Description { get; private set; } - public bool IsModel { get; private set; } + public string SubPackage { get; private set; } - public PackageInfoTemplateModel(ServiceClient serviceClient, string clientName, bool isModel = false) + public PackageInfoTemplateModel(ServiceClient serviceClient, string clientName, string subPackage = null) { this.LoadFrom(serviceClient); this.Title = clientName; @@ -20,7 +20,7 @@ public PackageInfoTemplateModel(ServiceClient serviceClient, string clientName, { this.Description = serviceClient.Documentation; } - this.IsModel = isModel; + this.SubPackage = subPackage; } } } \ No newline at end of file diff --git a/AutoRest/Generators/Java/Java/TemplateModels/ServiceClientTemplateModel.cs b/AutoRest/Generators/Java/Java/TemplateModels/ServiceClientTemplateModel.cs index 204d8783772cd..7acb9bcf871ad 100644 --- a/AutoRest/Generators/Java/Java/TemplateModels/ServiceClientTemplateModel.cs +++ b/AutoRest/Generators/Java/Java/TemplateModels/ServiceClientTemplateModel.cs @@ -54,21 +54,32 @@ public string ServiceClientServiceType } } + public virtual string ImplPackage + { + get + { + return "implementation"; + } + } + public virtual IEnumerable ImplImports { get { HashSet classes = new HashSet(); - + classes.Add(Namespace.ToLower(CultureInfo.InvariantCulture) + "." + this.Name); + foreach(var methodGroup in this.MethodGroupModels) + { + classes.Add(methodGroup.MethodGroupFullType); + } if (this.Properties.Any(p => p.Type.IsPrimaryType(KnownPrimaryType.Credentials))) { classes.Add("com.microsoft.rest.credentials.ServiceClientCredentials"); } classes.AddRange(new[]{ "com.microsoft.rest.ServiceClient", - "com.microsoft.rest.AutoRestBaseUrl", "okhttp3.OkHttpClient", - "retrofit2.Retrofit" + "retrofit2.Retrofit" }); if (this.MethodTemplateModels.IsNullOrEmpty()) @@ -76,14 +87,10 @@ public virtual IEnumerable ImplImports return classes; } - // The following are for client level methods - classes.Add("okhttp3.logging.HttpLoggingInterceptor.Level"); - classes.AddRange(this.MethodTemplateModels .SelectMany(m => m.ImplImports) .OrderBy(i => i)); - return classes.AsEnumerable(); } } @@ -93,15 +100,6 @@ public virtual List InterfaceImports get { HashSet classes = new HashSet(); - classes.Add("java.util.List"); - classes.Add("okhttp3.Interceptor"); - classes.Add("okhttp3.logging.HttpLoggingInterceptor.Level"); - classes.Add("com.microsoft.rest.AutoRestBaseUrl"); - classes.Add("com.microsoft.rest.serializer.JacksonMapperAdapter"); - if (this.Properties.Any(p => p.Type.IsPrimaryType(KnownPrimaryType.Credentials))) - { - classes.Add("com.microsoft.rest.credentials.ServiceClientCredentials"); - } if (this.MethodTemplateModels.IsNullOrEmpty()) { diff --git a/AutoRest/Generators/Java/Java/Templates/EnumTemplate.cshtml b/AutoRest/Generators/Java/Java/Templates/EnumTemplate.cshtml index d974f639c110e..c07e5b150c296 100644 --- a/AutoRest/Generators/Java/Java/Templates/EnumTemplate.cshtml +++ b/AutoRest/Generators/Java/Java/Templates/EnumTemplate.cshtml @@ -7,15 +7,23 @@ */ @EmptyLine -package @(Settings.Namespace.ToLower()).models; +package @(Settings.Namespace.ToLower())@Model.ModelsPackage; @EmptyLine +@if (!Model.ModelAsString) +{ + import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; @EmptyLine + +} /** * Defines values for @(Model.Name). */ +@if (!Model.ModelAsString) +{ + public enum @(Model.Name) { @for (int i = 0; i < Model.Values.Count - 1; i++) { @@ -36,17 +44,6 @@ public enum @(Model.Name) { } @EmptyLine - /** - * Gets the serialized value for a @(Model.Name) instance. - * - * @@return the serialized value. - */ - @@JsonValue - public String toValue() { - return this.value; - } - @EmptyLine - /** * Parses a serialized value to a @(Model.Name) instance. * @@ -54,19 +51,37 @@ public enum @(Model.Name) { * @@return the parsed @(Model.Name) object, or null if unable to parse. */ @@JsonCreator - public static @Model.Name fromValue(String value) { + public static @Model.Name fromString(String value) { @(Model.Name)[] items = @(Model.Name).values(); for (@(Model.Name) item : items) { - if (item.toValue().equals(value)) { + if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; } @EmptyLine - + + @@JsonValue @@Override public String toString() { - return toValue(); + return this.value; } } + +} +else +{ + +public final class @(Model.Name) { +@for (int i = 0; i < Model.Values.Count; i++) +{ +@: /** Static value @(Model.Values[i].SerializedName) for @(Model.Name). */ +@: public static final String @(Model.Values[i].Name) = "@(Model.Values[i].SerializedName)"; +@EmptyLine +} + private @(Model.Name)() { + } +} + +} diff --git a/AutoRest/Generators/Java/Java/Templates/ExceptionTemplate.cshtml b/AutoRest/Generators/Java/Java/Templates/ExceptionTemplate.cshtml index c49ff08651630..33c548d874ddf 100644 --- a/AutoRest/Generators/Java/Java/Templates/ExceptionTemplate.cshtml +++ b/AutoRest/Generators/Java/Java/Templates/ExceptionTemplate.cshtml @@ -9,17 +9,17 @@ */ @EmptyLine -package @(Settings.Namespace.ToLower()).models; +package @(Settings.Namespace.ToLower())@Model.ModelsPackage; @EmptyLine -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; @EmptyLine /** @WrapComment(" * ", "Exception thrown for an invalid response with " + Model.Name + " information.") */ -public class @Model.ExceptionTypeDefinitionName extends AutoRestException { +public class @Model.ExceptionTypeDefinitionName extends RestException { /** * Information about the associated HTTP response. */ diff --git a/AutoRest/Generators/Java/Java/Templates/MethodGroupTemplate.cshtml b/AutoRest/Generators/Java/Java/Templates/MethodGroupTemplate.cshtml index 5edc2e090fc91..7ba2a1a58f95a 100644 --- a/AutoRest/Generators/Java/Java/Templates/MethodGroupTemplate.cshtml +++ b/AutoRest/Generators/Java/Java/Templates/MethodGroupTemplate.cshtml @@ -10,7 +10,7 @@ */ @EmptyLine -package @(Settings.Namespace.ToLower()); +package @(Settings.Namespace.ToLower()).@(Model.ImplPackage); @EmptyLine @foreach (var importClass in Model.ImplImports) { @@ -22,11 +22,11 @@ package @(Settings.Namespace.ToLower()); * An instance of this class provides access to all the operations defined * in @(Model.MethodGroupType). */ -public final class @(Model.MethodGroupType)Impl implements @Model.MethodGroupType { +public final class @(Model.MethodGroupImplType)@(Model.ParentDeclaration) { /** The Retrofit service to perform REST calls. */ private @Model.MethodGroupServiceType service; /** The service client containing this operation class. */ - private @Model.Name client; + private @(Model.ServiceClientType) client; @EmptyLine /** * Initializes an instance of @(Model.MethodGroupType). @@ -34,7 +34,7 @@ public final class @(Model.MethodGroupType)Impl implements @Model.MethodGroupTyp * @@param retrofit the Retrofit instance built from a Retrofit Builder. * @@param client the instance of the service client containing this operation class. */ - public @(Model.MethodGroupType)Impl(Retrofit retrofit, @Model.Name client) { + public @(Model.MethodGroupImplType)(Retrofit retrofit, @(Model.ServiceClientType) client) { this.service = retrofit.create(@(Model.MethodGroupServiceType).class); this.client = client; } diff --git a/AutoRest/Generators/Java/Java/Templates/MethodTemplate.cshtml b/AutoRest/Generators/Java/Java/Templates/MethodTemplate.cshtml index 10c86bd6adb4f..4e8dfdc451322 100644 --- a/AutoRest/Generators/Java/Java/Templates/MethodTemplate.cshtml +++ b/AutoRest/Generators/Java/Java/Templates/MethodTemplate.cshtml @@ -19,7 +19,7 @@ * @foreach (var param in Model.LocalParameters.Where(p => !p.IsConstant && p.IsRequired)) { -@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment()) +@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment().Trim()) } @foreach (var exception in Model.ExceptionStatements) { @@ -49,7 +49,7 @@ public @Model.ReturnTypeModel.ClientResponseTypeString @(Model.Name)(@Model.Meth { if (!parameter.IsRequired) { -@: final @(parameter.WireType.Name) @(parameter.WireName) = @(parameter.WireType.DefaultValue(Model)); +@: final @(parameter.ClientType.Name) @(parameter.Name) = @(parameter.ClientType.DefaultValue(Model)); } if (parameter.IsConstant) { @@ -59,14 +59,11 @@ public @Model.ReturnTypeModel.ClientResponseTypeString @(Model.Name)(@Model.Meth } @Model.BuildInputMappings(true) -@if (Model.ServiceClient.Extensions.ContainsKey(Microsoft.Rest.Generator.Extensions.ParameterizedHostExtension)) +@if (Model.IsParameterizedHost) { -foreach (var param in Model.Parameters.Where(p => p.Extensions.ContainsKey("hostParameter"))) -{ -@: @(Model.ClientReference).getBaseUrl().set("{@(param.SerializedName)}", @param.Name); -} +@: String parameterizedHost = Joiner.on(", ").join(@Model.HostParameterReplacementArgs); } - @Model.RequiredParameterConversion + @Model.ParameterConversion Call<@Model.CallType> call = service.@(Model.Name)(@Model.MethodRequiredParameterApiInvocation); @Model.ResponseGeneration(true) return @Model.ReturnValue; @@ -84,7 +81,7 @@ foreach (var param in Model.Parameters.Where(p => p.Extensions.ContainsKey("host * @foreach (var param in Model.LocalParameters.Where(p => !p.IsConstant && p.IsRequired)) { -@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment()) +@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment().Trim()) } @Model.CallbackDocumentation * @@throws IllegalArgumentException thrown if callback is null @@ -110,7 +107,7 @@ public ServiceCall @(Model.Name)Async(@Model.MethodRequiredParameterDeclarationW { if (!parameter.IsRequired) { -@: final @(parameter.WireType.Name) @(parameter.WireName) = @(parameter.WireType.DefaultValue(Model)); +@: final @(parameter.ClientType.Name) @(parameter.Name) = @(parameter.ClientType.DefaultValue(Model)); } if (parameter.IsConstant) { @@ -119,14 +116,11 @@ public ServiceCall @(Model.Name)Async(@Model.MethodRequiredParameterDeclarationW } @Model.BuildInputMappings(true) -@if (Model.ServiceClient.Extensions.ContainsKey(Microsoft.Rest.Generator.Extensions.ParameterizedHostExtension)) +@if (Model.IsParameterizedHost) { -foreach (var param in Model.Parameters.Where(p => p.Extensions.ContainsKey("hostParameter"))) -{ -@: @(Model.ClientReference).getBaseUrl().set("{@(param.SerializedName)}", @param.Name); -} +@: String parameterizedHost = Joiner.on(", ").join(@Model.HostParameterReplacementArgs); } - @Model.RequiredParameterConversion + @Model.ParameterConversion Call<@Model.CallType> call = service.@(Model.Name)(@Model.MethodRequiredParameterApiInvocation); @Model.ServiceCallConstruction call.enqueue(new @Model.InternalCallback<@(Model.ReturnTypeModel.ClientCallbackTypeString)>(serviceCallback) { @@ -156,7 +150,7 @@ foreach (var param in Model.Parameters.Where(p => p.Extensions.ContainsKey("host * @foreach (var param in Model.LocalParameters.Where(p => !p.IsConstant)) { -@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment()) +@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment().Trim()) } @foreach (var exception in Model.ExceptionStatements) { @@ -191,12 +185,9 @@ public @Model.ReturnTypeModel.ClientResponseTypeString @(Model.Name)(@Model.Meth } @Model.BuildInputMappings() -@if (Model.ServiceClient.Extensions.ContainsKey(Microsoft.Rest.Generator.Extensions.ParameterizedHostExtension)) -{ -foreach (var param in Model.Parameters.Where(p => p.Extensions.ContainsKey("hostParameter"))) +@if (Model.IsParameterizedHost) { -@: @(Model.ClientReference).getBaseUrl().set("{@(param.SerializedName)}", @param.Name); -} +@: String parameterizedHost = Joiner.on(", ").join(@Model.HostParameterReplacementArgs); } @Model.ParameterConversion Call<@Model.CallType> call = service.@(Model.Name)(@Model.MethodParameterApiInvocation); @@ -216,7 +207,7 @@ foreach (var param in Model.Parameters.Where(p => p.Extensions.ContainsKey("host * @foreach (var param in Model.LocalParameters.Where(p => !p.IsConstant)) { -@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment()) +@: * @@param @param.Name @((param.Documentation ?? "the " + param.Type.ToString() + " value").EscapeXmlComment().Trim()) } @Model.CallbackDocumentation * @@throws IllegalArgumentException thrown if callback is null @@ -247,12 +238,9 @@ public ServiceCall @(Model.Name)Async(@Model.MethodParameterDeclarationWithCallb } @Model.BuildInputMappings() -@if (Model.ServiceClient.Extensions.ContainsKey(Microsoft.Rest.Generator.Extensions.ParameterizedHostExtension)) +@if (Model.IsParameterizedHost) { -foreach (var param in Model.Parameters.Where(p => p.Extensions.ContainsKey("hostParameter"))) -{ -@: @(Model.ClientReference).getBaseUrl().set("{@(param.SerializedName)}", @param.Name); -} +@: String parameterizedHost = Joiner.on(", ").join(@Model.HostParameterReplacementArgs); } @Model.ParameterConversion Call<@Model.CallType> call = service.@(Model.Name)(@Model.MethodParameterApiInvocation); @@ -271,7 +259,7 @@ foreach (var param in Model.Parameters.Where(p => p.Extensions.ContainsKey("host } @EmptyLine private @Model.ReturnTypeModel.WireResponseTypeString @(Model.Name)Delegate(Response<@Model.CallType> response) throws @Model.ExceptionString { - return new @Model.ResponseBuilder<@Model.ReturnTypeModel.GenericBodyWireTypeString, @Model.OperationExceptionTypeString>(@(Model.ClientReference).getMapperAdapter()) + return new @Model.ResponseBuilder<@Model.ReturnTypeModel.GenericBodyWireTypeString, @Model.OperationExceptionTypeString>(@(Model.ClientReference).mapperAdapter()) @foreach (var response in Model.ResponseModels) { diff --git a/AutoRest/Generators/Java/Java/Templates/ModelTemplate.cshtml b/AutoRest/Generators/Java/Java/Templates/ModelTemplate.cshtml index 08e3689b3b76e..c7bd708e5c9db 100644 --- a/AutoRest/Generators/Java/Java/Templates/ModelTemplate.cshtml +++ b/AutoRest/Generators/Java/Java/Templates/ModelTemplate.cshtml @@ -10,7 +10,7 @@ */ @EmptyLine -package @(Settings.Namespace.ToLower()).models; +package @(Settings.Namespace.ToLower())@Model.ModelsPackage; @EmptyLine @foreach (var importClass in Model.ImportList) @@ -103,7 +103,7 @@ if (!jsonSetting.IsNullOrEmpty()) @: * @: * @@return the @property.Name value @: */ -@: public @(((ITypeModel)property.Type).ResponseVariant) get@(property.Name.ToPascalCase())() { +@: public @(((ITypeModel)property.Type).ResponseVariant) @(property.Name.ToCamelCase())() { if (property.Type.Name != ((ITypeModel) property.Type).ResponseVariant.Name) { @: if (this.@(property.Name) == null) { @@ -123,8 +123,9 @@ if (!property.IsReadOnly) @: * Set the @property.Name value. @: * @: * @@param @property.Name the @property.Name value to set +@: * @@return the @(Model.Name) object itself. @: */ -@: public void set@(property.Name.ToPascalCase())(@(((ITypeModel)property.Type).ResponseVariant) @property.Name) { +@: public @(Model.Name) with@(property.Name.ToPascalCase())(@(((ITypeModel)property.Type).ResponseVariant) @property.Name) { if (property.Type.Name != ((ITypeModel)property.Type).ResponseVariant.Name) { @: this.@(property.Name) = new @(property.Type.Name)(@property.Name); @@ -133,6 +134,7 @@ else { @: this.@(property.Name) = @property.Name; } +@: return this; @: } @EmptyLine } diff --git a/AutoRest/Generators/Java/Java/Templates/PackageInfoTemplate.cshtml b/AutoRest/Generators/Java/Java/Templates/PackageInfoTemplate.cshtml index a1a79d6ff4790..9de89d617cdf0 100644 --- a/AutoRest/Generators/Java/Java/Templates/PackageInfoTemplate.cshtml +++ b/AutoRest/Generators/Java/Java/Templates/PackageInfoTemplate.cshtml @@ -6,13 +6,13 @@ @EmptyLine /** -@if (!Model.IsModel) +@if (string.IsNullOrEmpty(Model.SubPackage)) { @: * This package contains the classes for @(Model.Title). } else { -@: * This package contains the model classes for @(Model.Title). +@: * This package contains the @Model.SubPackage classes for @(Model.Title). } @if (!string.IsNullOrEmpty(Model.Description)) { @@ -20,11 +20,11 @@ else } */ -@if (!Model.IsModel) +@if (string.IsNullOrEmpty(Model.SubPackage)) { @:package @(Settings.Namespace.ToLower()); } else { -@:package @(Settings.Namespace.ToLower()).models; +@:package @(Settings.Namespace.ToLower()).@(Model.SubPackage); } \ No newline at end of file diff --git a/AutoRest/Generators/Java/Java/Templates/ServiceClientInterfaceTemplate.cshtml b/AutoRest/Generators/Java/Java/Templates/ServiceClientInterfaceTemplate.cshtml index 5b1d8f4dd0f90..513a1d4a833c2 100644 --- a/AutoRest/Generators/Java/Java/Templates/ServiceClientInterfaceTemplate.cshtml +++ b/AutoRest/Generators/Java/Java/Templates/ServiceClientInterfaceTemplate.cshtml @@ -23,33 +23,9 @@ package @(Settings.Namespace.ToLower()); */ public interface @Model.Name { /** - * Gets the URL used as the base for all cloud service requests. - * - * @@return the BaseUrl object. + * The default base URL. */ - AutoRestBaseUrl getBaseUrl(); -@EmptyLine - /** - * Gets the list of interceptors the OkHttp client will execute. - * - * @@return the list of interceptors. - */ - List getClientInterceptors(); -@EmptyLine - /** - * Sets the logging level for OkHttp client. - * - * @@param logLevel the logging level enum. - */ - void setLogLevel(Level logLevel); -@EmptyLine - /** - * Gets the adapter for {@@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @@return the adapter. - */ - JacksonMapperAdapter getMapperAdapter(); + String DEFAULT_BASE_URL = "@Model.BaseUrl"; @foreach (var property in Model.Properties) { @EmptyLine @@ -58,7 +34,7 @@ public interface @Model.Name { @: * @: * @@return the @(property.Name) value. @: */ -@: @property.Type get@(property.Name.ToPascalCase())(); +@: @property.Type @(property.Name.ToCamelCase())(); if(!property.IsReadOnly) { @EmptyLine @@ -66,8 +42,9 @@ if(!property.IsReadOnly) @: * Sets @(property.Documentation). @: * @: * @@param @(property.Name.ToCamelCase()) the @(property.Name) value. +@: * @@return the service client itself @: */ -@: void set@(property.Name.ToPascalCase())(@(property.Type) @(property.Name.ToCamelCase())); +@: @(Model.Name) with@(property.Name.ToPascalCase())(@(property.Type) @(property.Name.ToCamelCase())); } } @@ -78,7 +55,7 @@ if(!property.IsReadOnly) @: * Gets the @(operation.MethodGroupType) object to access its operations. @: * @@return the @(operation.MethodGroupType) object. @: */ -@: @(operation.MethodGroupType) get@(operation.MethodGroupType)(); +@: @(operation.MethodGroupType) @(operation.MethodGroupName)(); } @EmptyLine @if (Model.MethodTemplateModels.Any()) diff --git a/AutoRest/Generators/Java/Java/Templates/ServiceClientTemplate.cshtml b/AutoRest/Generators/Java/Java/Templates/ServiceClientTemplate.cshtml index cb2b13b88d8c3..be1201e52817c 100644 --- a/AutoRest/Generators/Java/Java/Templates/ServiceClientTemplate.cshtml +++ b/AutoRest/Generators/Java/Java/Templates/ServiceClientTemplate.cshtml @@ -10,7 +10,7 @@ */ @EmptyLine -package @(Settings.Namespace.ToLower()); +package @(Settings.Namespace.ToLower()).@(Model.ImplPackage); @EmptyLine @foreach (var importClass in Model.ImplImports) @@ -30,19 +30,6 @@ public final class @(Model.Name)Impl extends ServiceClient implements @Model.Nam @: */ @: private @Model.ServiceClientServiceType service; } - /** - * The URL used as the base for all cloud service requests. - */ - private final AutoRestBaseUrl baseUrl; -@EmptyLine - /** - * Gets the URL used as the base for all cloud service requests. - * - * @@return The BaseUrl value. - */ - public AutoRestBaseUrl getBaseUrl() { - return this.baseUrl; - } @foreach (var property in Model.Properties) { @EmptyLine @@ -54,7 +41,7 @@ public final class @(Model.Name)Impl extends ServiceClient implements @Model.Nam @: * @: * @@return the @(property.Name) value. @: */ -@: public @(property.Type) get@(property.Name.ToPascalCase())() { +@: public @(property.Type) @(property.Name.ToCamelCase())() { @: return this.@(property.Name.ToCamelCase()); @: } if(!property.IsReadOnly) @@ -64,9 +51,11 @@ if(!property.IsReadOnly) @: * Sets @(property.Documentation.Period()) @: * @: * @@param @(property.Name.ToCamelCase()) the @(property.Name) value. +@: * @@return the service client itself @: */ -@: public void set@(property.Name.ToPascalCase())(@(property.Type) @(property.Name.ToCamelCase())) { +@: public @(Model.Name)Impl with@(property.Name.ToPascalCase())(@(property.Type) @(property.Name.ToCamelCase())) { @: this.@(property.Name.ToCamelCase()) = @(property.Name.ToCamelCase()); +@: return this; @: } } } @@ -75,11 +64,16 @@ if(!property.IsReadOnly) { @EmptyLine @: /** +@: * The @(operation.MethodGroupType) object to access its operations. +@: */ +@: private @(operation.MethodGroupType) @(operation.MethodGroupName); +@EmptyLine +@: /** @: * Gets the @(operation.MethodGroupType) object to access its operations. @: * @@return the @(operation.MethodGroupType) object. @: */ -@: public @(operation.MethodGroupType) get@(operation.MethodGroupType)() { -@: return new @(operation.MethodGroupType)Impl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); +@: public @(operation.MethodGroupType) @(operation.MethodGroupName)() { +@: return this.@(operation.MethodGroupName); @: } } @EmptyLine @@ -96,8 +90,7 @@ if(!property.IsReadOnly) * @@param baseUrl the base URL of the host */ @(Model.IsCustomBaseUri ? "private" : "public") @(Model.Name)Impl(String baseUrl) { - super(); - this.baseUrl = new AutoRestBaseUrl(baseUrl); + super(baseUrl); initialize(); } @@ -105,63 +98,49 @@ if(!property.IsReadOnly) /** * Initializes an instance of @(Model.Name) client. * - @(Model.IsCustomBaseUri ? "" : "* @param baseUrl the base URL of the host") - * @@param clientBuilder the builder for building up an {@@link OkHttpClient} - * @@param retrofitBuilder the builder for building up a {@@link Retrofit} + * @@param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @@param restBuilder the builder for building an Retrofit client, bundled with user configurations */ - public @(Model.Name)Impl(@(Model.IsCustomBaseUri ? "" : "String baseUrl, ")OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); - -@if (Model.IsCustomBaseUri) -{ - @:this.baseUrl = new AutoRestBaseUrl("@(Model.BaseUrl)"); -} -else -{ - @:this.baseUrl = new AutoRestBaseUrl(baseUrl); -} - + public @(Model.Name)Impl(OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + this("@Model.BaseUrl", clientBuilder, restBuilder); initialize(); } @EmptyLine - @@Override - protected void initialize() { - @if (Settings.AddCredentials) - { -@: if (this.credentials != null) -@: { -@: this.credentials.applyCredentialsFilter(clientBuilder); -@: } + /** + * Initializes an instance of @(Model.Name) client. + * + * @@param baseUrl the base URL of the host + * @@param clientBuilder the builder for building an OkHttp client, bundled with user configurations + * @@param restBuilder the builder for building an Retrofit client, bundled with user configurations + */ + @(Model.IsCustomBaseUri ? "private" : "public") @(Model.Name)Impl(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { + super(baseUrl, clientBuilder, restBuilder); + initialize(); } - super.initialize(); - this.retrofitBuilder.baseUrl(baseUrl); + +@EmptyLine + private void initialize() { +@foreach (var property in Model.Properties.Where(p => p.DefaultValue != null)) +{ +@: this.@(property.Name) = @(property.DefaultValue); +} +@foreach (var operation in Model.Operations) +{ +@: this.@(operation.MethodGroupName) = new @(operation.MethodGroupType)Impl(retrofit(), this); +} @if (Model.MethodTemplateModels.Any()) { @: initializeService(); } } + @if (Model.MethodTemplateModels.Any()) { @EmptyLine private void initializeService() { - service = this.retrofitBuilder.client(this.clientBuilder.build()) - .build() - .create(@(Model.ServiceClientServiceType).class); - } - -@EmptyLine - - /** - * Sets the logging level for OkHttp client. - * - * @@param logLevel the logging level enum - */ - @@Override - public void setLogLevel(Level logLevel) { - super.setLogLevel(logLevel); - initializeService(); + service = retrofit().create(@(Model.ServiceClientServiceType).class); } @EmptyLine diff --git a/AutoRest/Generators/Java/Java/TypeModels/EnumTypeModel.cs b/AutoRest/Generators/Java/Java/TypeModels/EnumTypeModel.cs index aec50e5773d40..be4f475ad8694 100644 --- a/AutoRest/Generators/Java/Java/TypeModels/EnumTypeModel.cs +++ b/AutoRest/Generators/Java/Java/TypeModels/EnumTypeModel.cs @@ -42,7 +42,7 @@ public string DefaultValue(Method method) return "null"; } - public IEnumerable Imports + public virtual IEnumerable Imports { get { diff --git a/AutoRest/Generators/Java/Java/TypeModels/ParameterModel.cs b/AutoRest/Generators/Java/Java/TypeModels/ParameterModel.cs index 9dbfeca84a50d..f13278273e54e 100644 --- a/AutoRest/Generators/Java/Java/TypeModels/ParameterModel.cs +++ b/AutoRest/Generators/Java/Java/TypeModels/ParameterModel.cs @@ -90,7 +90,7 @@ public string ConvertToWireType(string source, string clientReference) else if (sequence != null) { return string.Format(CultureInfo.InvariantCulture, - "{0} {1} = {2}.getMapperAdapter().serializeList({3}, CollectionFormat.{4});", + "{0} {1} = {2}.mapperAdapter().serializeList({3}, CollectionFormat.{4});", WireType.Name, _wireName, clientReference, @@ -204,12 +204,20 @@ public IEnumerable RetrofitImports } private List _implImports; + + public IEnumerable ClientImplImports + { + get + { + return ClientType.Imports; + } + } - public IEnumerable ImplImports + public IEnumerable WireImplImports { get { - var imports = new List(ClientType.Imports); + var imports = new List(WireType.Imports); if (Location != ParameterLocation.Body) { if (this.Type.IsPrimaryType(KnownPrimaryType.ByteArray)) diff --git a/AutoRest/Generators/Java/Java/TypeModels/PropertyModel.cs b/AutoRest/Generators/Java/Java/TypeModels/PropertyModel.cs index aaed0a6840996..222ae7b93749e 100644 --- a/AutoRest/Generators/Java/Java/TypeModels/PropertyModel.cs +++ b/AutoRest/Generators/Java/Java/TypeModels/PropertyModel.cs @@ -12,7 +12,7 @@ namespace Microsoft.Rest.Generator.Java { public class PropertyModel : Property { - private string _package; + protected string _package; public PropertyModel(Property property, string package) : base() @@ -21,7 +21,7 @@ public PropertyModel(Property property, string package) this._package = package.ToLower(CultureInfo.InvariantCulture); } - public IEnumerable Imports + public virtual IEnumerable Imports { get { diff --git a/ClientRuntimes/Java/.gitignore b/ClientRuntimes/Java/.gitignore new file mode 100644 index 0000000000000..f1c8123eca4b5 --- /dev/null +++ b/ClientRuntimes/Java/.gitignore @@ -0,0 +1,23 @@ +build +*.class +target +gen + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ +tmp + +# Package Files # +*.jar +*.war +*.ear +*.MF +.gitrevision +.gradle + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# ide +.idea +*.iml diff --git a/ClientRuntimes/Java/.travis.yml b/ClientRuntimes/Java/.travis.yml new file mode 100644 index 0000000000000..05c26fa53735e --- /dev/null +++ b/ClientRuntimes/Java/.travis.yml @@ -0,0 +1,14 @@ +language: android +android: + components: + - build-tools-23.0.1 + - android-23 + - platform-tools + - extra-android-support + - extra-google-m2repository + - extra-android-m2repository +sudo: false +script: + - mvn clean install + - mvn checkstyle:check + - cd ./azure-android-client-authentication && ./gradlew check diff --git a/ClientRuntimes/Java/LICENSE b/ClientRuntimes/Java/LICENSE new file mode 100644 index 0000000000000..4918d653ba68b --- /dev/null +++ b/ClientRuntimes/Java/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Microsoft Azure + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ClientRuntimes/Java/README.md b/ClientRuntimes/Java/README.md new file mode 100644 index 0000000000000..dfa96fbf28cbf --- /dev/null +++ b/ClientRuntimes/Java/README.md @@ -0,0 +1,22 @@ +[![Build Status](https://travis-ci.org/Azure/autorest-clientruntime-for-java.svg?branch=javavnext)](https://travis-ci.org/Azure/autorest-clientruntime-for-java) + +# AutoRest Client Runtimes for Java +The runtime libraries for AutoRest generated Java clients. + +## Repository structure + +### client-runtime +This is the generic runtime. You will need this for AutoRest generated library using Java code generator. + +### azure-client-runtime +This is the runtime with Azure specific customizations. You will need this for AutoRest generated library using Azure.Java code generator. + +### azure-client-authentication +This package provides access to Active Directory authentication on JDK using OrgId or application ID / secret combinations. Multi-factor-auth is currently not supported. + +### azure-android-client-authentication +This package provides access to Active Directory authentication on Android. You can login with Microsoft accounts, OrgId, with or without multi-factor-auth. + +## Build +To build this repository, you will need maven 2.0+ and gradle 1.6+. +Maven is used for [Java SDK](https://github.com/Azure/azure-sdk-for-java) when it's used as a submodule in there. Gradle is used for [AutoRest](https://github.com/Azure/autorest) when it's used as a submodule in there. diff --git a/ClientRuntimes/Java/azure-android-client-authentication/build.gradle b/ClientRuntimes/Java/azure-android-client-authentication/build.gradle index 82a0cc5107a08..2651d8389383e 100644 --- a/ClientRuntimes/Java/azure-android-client-authentication/build.gradle +++ b/ClientRuntimes/Java/azure-android-client-authentication/build.gradle @@ -1,15 +1,15 @@ buildscript { - android { - lintOptions { - abortOnError false - } + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.3.0' } } + apply plugin: 'com.android.library' apply plugin: 'maven' -version = '1.0.0-SNAPSHOT' - android { compileSdkVersion 23 buildToolsVersion "23.0.1" @@ -32,17 +32,26 @@ android { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } + + lintOptions { + abortOnError false + } } configurations { deployerJars } +repositories { + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } +} + dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.microsoft.aad:adal:1.1.11' - compile 'com.microsoft.rest:client-runtime:1.0.0-SNAPSHOT' + compile 'com.microsoft.azure:azure-client-runtime:1.0.0-SNAPSHOT' testCompile 'junit:junit:4.12' testCompile 'junit:junit-dep:4.11' deployerJars "org.apache.maven.wagon:wagon-ftp:2.10" @@ -86,16 +95,6 @@ uploadArchives { } } -task versionInfo(type:Exec){ - commandLine 'git rev-parse HEAD'.split() - ext.versionfile = new File("${projectDir}/.gitrevision") - standardOutput = new ByteArrayOutputStream() - - doLast { - versionfile.text = "Azure/autorest#" + standardOutput.toString() - } -} - task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs classifier = 'sources' @@ -107,7 +106,7 @@ task javadoc(type: Javadoc) { options.encoding = 'UTF-8' } -task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) { +task javadocJar(type: Jar, dependsOn: [javadoc]) { classifier = 'javadoc' from javadoc.destinationDir } @@ -115,5 +114,4 @@ task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) { artifacts { archives sourcesJar archives javadocJar - archives file: file("${projectDir}/.gitrevision") } diff --git a/ClientRuntimes/Java/azure-android-client-authentication/gradle.properties b/ClientRuntimes/Java/azure-android-client-authentication/gradle.properties new file mode 100644 index 0000000000000..7311d1b56e3bb --- /dev/null +++ b/ClientRuntimes/Java/azure-android-client-authentication/gradle.properties @@ -0,0 +1,2 @@ +username = fake +password = fake \ No newline at end of file diff --git a/ClientRuntimes/Java/azure-android-client-authentication/gradle/wrapper/gradle-wrapper.jar b/ClientRuntimes/Java/azure-android-client-authentication/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000..05ef575b0cd01 Binary files /dev/null and b/ClientRuntimes/Java/azure-android-client-authentication/gradle/wrapper/gradle-wrapper.jar differ diff --git a/ClientRuntimes/Java/azure-android-client-authentication/gradle/wrapper/gradle-wrapper.properties b/ClientRuntimes/Java/azure-android-client-authentication/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000..3ae0abbd2b66d --- /dev/null +++ b/ClientRuntimes/Java/azure-android-client-authentication/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Nov 11 13:21:00 PST 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip diff --git a/ClientRuntimes/Java/azure-android-client-authentication/gradlew b/ClientRuntimes/Java/azure-android-client-authentication/gradlew new file mode 100755 index 0000000000000..9d82f78915133 --- /dev/null +++ b/ClientRuntimes/Java/azure-android-client-authentication/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/ClientRuntimes/Java/azure-android-client-authentication/gradlew.bat b/ClientRuntimes/Java/azure-android-client-authentication/gradlew.bat new file mode 100644 index 0000000000000..8a0b282aa6885 --- /dev/null +++ b/ClientRuntimes/Java/azure-android-client-authentication/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/ClientRuntimes/Java/azure-client-authentication/build.gradle b/ClientRuntimes/Java/azure-client-authentication/build.gradle index eaac35660cce9..2b40ada004e0e 100644 --- a/ClientRuntimes/Java/azure-client-authentication/build.gradle +++ b/ClientRuntimes/Java/azure-client-authentication/build.gradle @@ -13,14 +13,15 @@ apply plugin: 'checkstyle' version = '1.0.0-SNAPSHOT' checkstyle { - configFile = new File("$rootDir/Tools/checkstyle/checkstyle.xml") - configProperties = [samedir: "$rootDir/Tools/checkstyle"] - reportsDir = new File("$rootDir/Tools/checkstyle/reports") + toolVersion = "6.18" + configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml") + configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"] + reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports") } dependencies { compile 'com.microsoft.azure:adal4j:1.1.2' - compile 'com.microsoft.rest:client-runtime:1.0.0-SNAPSHOT' + compile 'com.microsoft.azure:azure-client-runtime:1.0.0-SNAPSHOT' testCompile 'junit:junit:4.12' testCompile 'junit:junit-dep:4.11' deployerJars "org.apache.maven.wagon:wagon-ftp:2.10" @@ -70,16 +71,6 @@ test { } } -task versionInfo(type:Exec){ - commandLine 'git rev-parse HEAD'.split() - ext.versionfile = new File("${projectDir}/.gitrevision") - standardOutput = new ByteArrayOutputStream() - - doLast { - versionfile.text = "Azure/autorest#" + standardOutput.toString() - } -} - javadoc { options.encoding = 'UTF-8' } @@ -89,7 +80,7 @@ task sourcesJar(type: Jar, dependsOn:classes) { from sourceSets.main.allSource } -task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) { +task javadocJar(type: Jar, dependsOn: [javadoc]) { classifier = 'javadoc' from javadoc.destinationDir } @@ -97,7 +88,6 @@ task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) { artifacts { archives sourcesJar archives javadocJar - archives file: file("${projectDir}/.gitrevision") } test { diff --git a/ClientRuntimes/Java/azure-client-authentication/pom.xml b/ClientRuntimes/Java/azure-client-authentication/pom.xml new file mode 100644 index 0000000000000..47582ca1eaa87 --- /dev/null +++ b/ClientRuntimes/Java/azure-client-authentication/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.microsoft.azure + autorest-clientruntime-for-java + 1.0.0-SNAPSHOT + ../pom.xml + + + azure-client-authentication + jar + + Azure Java Client Authentication Library for AutoRest + This package contains the authentication connectors to Active Directory for JDK. + https://github.com/Azure/autorest-clientruntime-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + scm:git:https://github.com/Azure/autorest-clientruntime-for-java + scm:git:git@github.com:Azure/autorest-clientruntime-for-java.git + HEAD + + + + UTF-8 + + + + + + microsoft + Microsoft + + + + + + com.microsoft.azure + azure-client-runtime + 1.0.0-SNAPSHOT + + + com.microsoft.azure + adal4j + + + junit + junit + test + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + org.codehaus.mojo + build-helper-maven-plugin + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/]]>
+
+
+ +
+
+
diff --git a/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/ApplicationTokenCredentials.java b/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/ApplicationTokenCredentials.java index 3e995fb06a087..384ab3f7671af 100644 --- a/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/ApplicationTokenCredentials.java +++ b/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/ApplicationTokenCredentials.java @@ -10,9 +10,13 @@ import com.microsoft.aad.adal4j.AuthenticationContext; import com.microsoft.aad.adal4j.AuthenticationResult; import com.microsoft.aad.adal4j.ClientCredential; +import com.microsoft.azure.AzureEnvironment; import com.microsoft.rest.credentials.TokenCredentials; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; +import java.util.Properties; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -30,6 +34,8 @@ public class ApplicationTokenCredentials extends TokenCredentials { private AzureEnvironment environment; /** The current authentication result. */ private AuthenticationResult authenticationResult; + /** The default subscription to use, if any. */ + private String defaultSubscription; /** * Initializes a new instance of the UserTokenCredentials. @@ -52,6 +58,104 @@ public ApplicationTokenCredentials(String clientId, String domain, String secret } } + /** + * Contains the keys of the settings in a Properties file to read credentials from. + */ + private enum CredentialSettings { + /** The subscription GUID. */ + SUBSCRIPTION_ID("subscription"), + /** The tenant GUID or domain. */ + TENANT_ID("tenant"), + /** The client id for the client application. */ + CLIENT_ID("client"), + /** The client secret for the service principal. */ + CLIENT_KEY("key"), + /** The management endpoint. */ + MANAGEMENT_URI("managementURI"), + /** The base URL to the current Azure environment. */ + BASE_URL("baseURL"), + /** The URL to Active Directory authentication. */ + AUTH_URL("authURL"); + + /** The name of the key in the properties file. */ + private final String name; + + CredentialSettings(String name) { + this.name = name; + } + + @Override + public String toString() { + return this.name; + } + } + + /** + * @return The default subscription ID, if any + */ + public String defaultSubscriptionId() { + return defaultSubscription; + } + + /** + * Set default subscription ID. + * + * @param subscriptionId the default subscription ID. + * @return the credentials object itself. + */ + public ApplicationTokenCredentials withDefaultSubscriptionId(String subscriptionId) { + this.defaultSubscription = subscriptionId; + return this; + } + + /** + * Initializes the credentials based on the provided credentials file. + * + * @param credentialsFile A file with credentials, using the standard Java properties format. + * and the following keys: + * subscription=<subscription-id> + * tenant=<tenant-id> + * client=<client-id> + * key=<client-key> + * managementURI=<management-URI> + * baseURL=<base-URL> + * authURL=<authentication-URL> + * + * @return The credentials based on the file. + * @throws IOException exception thrown from file access errors. + */ + public static ApplicationTokenCredentials fromFile(File credentialsFile) throws IOException { + // Set defaults + Properties authSettings = new Properties(); + authSettings.put(CredentialSettings.AUTH_URL.toString(), AzureEnvironment.AZURE.getAuthenticationEndpoint()); + authSettings.put(CredentialSettings.BASE_URL.toString(), AzureEnvironment.AZURE.getBaseUrl()); + authSettings.put(CredentialSettings.MANAGEMENT_URI.toString(), AzureEnvironment.AZURE.getTokenAudience()); + + // Load the credentials from the file + FileInputStream credentialsFileStream = new FileInputStream(credentialsFile); + authSettings.load(credentialsFileStream); + credentialsFileStream.close(); + + final String clientId = authSettings.getProperty(CredentialSettings.CLIENT_ID.toString()); + final String tenantId = authSettings.getProperty(CredentialSettings.TENANT_ID.toString()); + final String clientKey = authSettings.getProperty(CredentialSettings.CLIENT_KEY.toString()); + final String mgmtUri = authSettings.getProperty(CredentialSettings.MANAGEMENT_URI.toString()); + final String authUrl = authSettings.getProperty(CredentialSettings.AUTH_URL.toString()); + final String baseUrl = authSettings.getProperty(CredentialSettings.BASE_URL.toString()); + final String defaultSubscriptionId = authSettings.getProperty(CredentialSettings.SUBSCRIPTION_ID.toString()); + + return new ApplicationTokenCredentials( + clientId, + tenantId, + clientKey, + new AzureEnvironment( + authUrl, + mgmtUri, + true, + baseUrl) + ).withDefaultSubscriptionId(defaultSubscriptionId); + } + /** * Gets the active directory application client id. * diff --git a/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/UserTokenCredentials.java b/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/UserTokenCredentials.java index af02c07507b74..60d6bdb3c0a58 100644 --- a/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/UserTokenCredentials.java +++ b/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/UserTokenCredentials.java @@ -9,6 +9,7 @@ import com.microsoft.aad.adal4j.AuthenticationContext; import com.microsoft.aad.adal4j.AuthenticationResult; +import com.microsoft.azure.AzureEnvironment; import com.microsoft.rest.credentials.TokenCredentials; import java.io.IOException; diff --git a/ClientRuntimes/Java/azure-client-authentication/src/test/java/com/microsoft/azure/credentials/UserTokenCredentialsTests.java b/ClientRuntimes/Java/azure-client-authentication/src/test/java/com/microsoft/azure/credentials/UserTokenCredentialsTests.java index afce04b56ecdf..7905ba7e7b21e 100644 --- a/ClientRuntimes/Java/azure-client-authentication/src/test/java/com/microsoft/azure/credentials/UserTokenCredentialsTests.java +++ b/ClientRuntimes/Java/azure-client-authentication/src/test/java/com/microsoft/azure/credentials/UserTokenCredentialsTests.java @@ -8,9 +8,8 @@ package com.microsoft.azure.credentials; import com.microsoft.aad.adal4j.AuthenticationResult; - +import com.microsoft.azure.AzureEnvironment; import org.junit.Assert; - import org.junit.Test; import java.io.IOException; diff --git a/ClientRuntimes/Java/azure-client-runtime/build.gradle b/ClientRuntimes/Java/azure-client-runtime/build.gradle index dcdaddcea285b..5c29359536abc 100644 --- a/ClientRuntimes/Java/azure-client-runtime/build.gradle +++ b/ClientRuntimes/Java/azure-client-runtime/build.gradle @@ -13,10 +13,10 @@ apply plugin: 'checkstyle' version = '1.0.0-SNAPSHOT' checkstyle { - toolVersion = "6.9" - configFile = new File("$rootDir/Tools/checkstyle/checkstyle.xml") - configProperties = [samedir: "$rootDir/Tools/checkstyle"] - reportsDir = new File("$rootDir/Tools/checkstyle/reports") + toolVersion = "6.18" + configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml") + configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"] + reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports") } dependencies { @@ -69,16 +69,6 @@ test { } } -task versionInfo(type:Exec){ - commandLine 'git rev-parse HEAD'.split() - ext.versionfile = new File("${projectDir}/.gitrevision") - standardOutput = new ByteArrayOutputStream() - - doLast { - versionfile.text = "Azure/autorest#" + standardOutput.toString() - } -} - javadoc { options.encoding = 'UTF-8' } @@ -88,7 +78,7 @@ task sourcesJar(type: Jar, dependsOn:classes) { from sourceSets.main.allSource } -task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) { +task javadocJar(type: Jar, dependsOn: [javadoc]) { classifier = 'javadoc' from javadoc.destinationDir } @@ -96,7 +86,6 @@ task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) { artifacts { archives sourcesJar archives javadocJar - archives file: file("${projectDir}/.gitrevision") } test { diff --git a/ClientRuntimes/Java/azure-client-runtime/pom.xml b/ClientRuntimes/Java/azure-client-runtime/pom.xml new file mode 100644 index 0000000000000..98d91b43e802e --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + + com.microsoft.azure + autorest-clientruntime-for-java + 1.0.0-SNAPSHOT + ../pom.xml + + + azure-client-runtime + jar + + Azure Java Client Runtime for AutoRest + This package contains the basic runtime for AutoRest generated Azure Java clients. + https://github.com/Azure/autorest-clientruntime-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + scm:git:https://github.com/Azure/autorest-clientruntime-for-java + scm:git:git@github.com:Azure/autorest-clientruntime-for-java.git + HEAD + + + + UTF-8 + + + + + + microsoft + Microsoft + + + + + + com.microsoft.rest + client-runtime + ${parent.version} + + + junit + junit + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + org.codehaus.mojo + build-helper-maven-plugin + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/]]>
+
+
+ +
+
+
diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java index 2f3569fc51c59..62a760acb4a0d 100644 --- a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java @@ -13,8 +13,12 @@ import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; import com.microsoft.rest.ServiceResponseWithHeaders; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.serializer.JacksonMapperAdapter; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.Response; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Url; import java.io.IOException; import java.lang.reflect.Type; @@ -24,14 +28,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import okhttp3.OkHttpClient; -import okhttp3.ResponseBody; -import retrofit2.Call; -import retrofit2.Response; -import retrofit2.Retrofit; -import retrofit2.http.GET; -import retrofit2.http.Url; - /** * An instance of this class defines a ServiceClient that handles polling and * retrying for long running operations when accessing Azure resources. @@ -42,32 +38,24 @@ public class AzureClient extends AzureServiceClient { * used if null. */ private Integer longRunningOperationRetryTimeout; - /** - * The credentials to use for authentication for long running operations. - */ - private ServiceClientCredentials credentials; /** * The executor for asynchronous requests. */ private ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); /** - * Initializes an instance of this class. + * The user agent from the service client that owns this Azure Client. */ - public AzureClient() { - super(); - } + private final String serviceClientUserAgent; /** * Initializes an instance of this class with customized client metadata. * - * @param clientBuilder customized http client. - * @param retrofitBuilder customized retrofit builder - * @param mapperAdapter the adapter for the Jackson object mapper + * @param serviceClient the caller client that initiates the asynchronous request. */ - public AzureClient(OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder, JacksonMapperAdapter mapperAdapter) { - super(clientBuilder, retrofitBuilder); - this.mapperAdapter = mapperAdapter; + public AzureClient(AzureServiceClient serviceClient) { + super(serviceClient.restClient()); + this.serviceClientUserAgent = serviceClient.userAgent(); } /** @@ -89,7 +77,7 @@ public ServiceResponse getPutOrPatchResult(Response respons int statusCode = response.code(); ResponseBody responseBody; - if (response.isSuccess()) { + if (response.isSuccessful()) { responseBody = response.body(); } else { responseBody = response.errorBody(); @@ -98,13 +86,13 @@ public ServiceResponse getPutOrPatchResult(Response respons CloudException exception = new CloudException(statusCode + " is not a valid polling status code"); exception.setResponse(response); if (responseBody != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(responseBody.string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(responseBody.string(), CloudError.class)); responseBody.close(); } throw exception; } - PollingState pollingState = new PollingState<>(response, this.getLongRunningOperationRetryTimeout(), resourceType, mapperAdapter); + PollingState pollingState = new PollingState<>(response, this.getLongRunningOperationRetryTimeout(), resourceType, restClient().mapperAdapter()); String url = response.raw().request().url().toString(); // Check provisioning state @@ -151,7 +139,7 @@ public ServiceResponseWithHeaders getPutOrPatchResultWi ServiceResponse bodyResponse = getPutOrPatchResult(response, resourceType); return new ServiceResponseWithHeaders<>( bodyResponse.getBody(), - mapperAdapter.deserialize(mapperAdapter.serialize(bodyResponse.getResponse().headers()), headerType), + restClient().mapperAdapter().deserialize(restClient().mapperAdapter().serialize(bodyResponse.getResponse().headers()), headerType), bodyResponse.getResponse() ); } @@ -176,7 +164,7 @@ public AsyncPollingTask getPutOrPatchResultAsync(Response r int statusCode = response.code(); ResponseBody responseBody; - if (response.isSuccess()) { + if (response.isSuccessful()) { responseBody = response.body(); } else { responseBody = response.errorBody(); @@ -186,7 +174,7 @@ public AsyncPollingTask getPutOrPatchResultAsync(Response r exception.setResponse(response); try { if (responseBody != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(responseBody.string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(responseBody.string(), CloudError.class)); responseBody.close(); } } catch (Exception e) { /* ignore serialization errors on top of service errors */ } @@ -196,7 +184,7 @@ public AsyncPollingTask getPutOrPatchResultAsync(Response r PollingState pollingState; try { - pollingState = new PollingState<>(response, this.getLongRunningOperationRetryTimeout(), resourceType, mapperAdapter); + pollingState = new PollingState<>(response, this.getLongRunningOperationRetryTimeout(), resourceType, restClient().mapperAdapter()); } catch (IOException e) { callback.failure(e); return null; @@ -235,7 +223,7 @@ public void success(ServiceResponse result) { try { callback.success(new ServiceResponseWithHeaders<>( result.getBody(), - mapperAdapter.deserialize(mapperAdapter.serialize(result.getResponse().headers()), headerType), + restClient().mapperAdapter().deserialize(restClient().mapperAdapter().serialize(result.getResponse().headers()), headerType), result.getResponse() )); } catch (IOException e) { @@ -264,7 +252,7 @@ public ServiceResponse getPostOrDeleteResult(Response respo int statusCode = response.code(); ResponseBody responseBody; - if (response.isSuccess()) { + if (response.isSuccessful()) { responseBody = response.body(); } else { responseBody = response.errorBody(); @@ -273,13 +261,13 @@ public ServiceResponse getPostOrDeleteResult(Response respo CloudException exception = new CloudException(statusCode + " is not a valid polling status code"); exception.setResponse(response); if (responseBody != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(responseBody.string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(responseBody.string(), CloudError.class)); responseBody.close(); } throw exception; } - PollingState pollingState = new PollingState<>(response, this.getLongRunningOperationRetryTimeout(), resourceType, mapperAdapter); + PollingState pollingState = new PollingState<>(response, this.getLongRunningOperationRetryTimeout(), resourceType, restClient().mapperAdapter()); // Check provisioning state while (!AzureAsyncOperation.getTerminalStatuses().contains(pollingState.getStatus())) { @@ -299,8 +287,7 @@ public ServiceResponse getPostOrDeleteResult(Response respo } // Check if operation failed - if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) - { + if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) { throw new CloudException("Async operation failed"); } @@ -325,7 +312,7 @@ public ServiceResponseWithHeaders getPostOrDeleteResult ServiceResponse bodyResponse = getPostOrDeleteResult(response, resourceType); return new ServiceResponseWithHeaders<>( bodyResponse.getBody(), - mapperAdapter.deserialize(mapperAdapter.serialize(bodyResponse.getResponse().headers()), headerType), + restClient().mapperAdapter().deserialize(restClient().mapperAdapter().serialize(bodyResponse.getResponse().headers()), headerType), bodyResponse.getResponse() ); } @@ -350,7 +337,7 @@ public AsyncPollingTask getPostOrDeleteResultAsync(Response int statusCode = response.code(); ResponseBody responseBody; - if (response.isSuccess()) { + if (response.isSuccessful()) { responseBody = response.body(); } else { responseBody = response.errorBody(); @@ -360,7 +347,7 @@ public AsyncPollingTask getPostOrDeleteResultAsync(Response exception.setResponse(response); try { if (responseBody != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(responseBody.string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(responseBody.string(), CloudError.class)); responseBody.close(); } } catch (Exception e) { /* ignore serialization errors on top of service errors */ } @@ -370,7 +357,7 @@ public AsyncPollingTask getPostOrDeleteResultAsync(Response PollingState pollingState; try { - pollingState = new PollingState<>(response, this.getLongRunningOperationRetryTimeout(), resourceType, mapperAdapter); + pollingState = new PollingState<>(response, this.getLongRunningOperationRetryTimeout(), resourceType, restClient().mapperAdapter()); } catch (IOException e) { callback.failure(e); return null; @@ -408,7 +395,7 @@ public void success(ServiceResponse result) { try { callback.success(new ServiceResponseWithHeaders<>( result.getBody(), - mapperAdapter.deserialize(mapperAdapter.serialize(result.getResponse().headers()), headerType), + restClient().mapperAdapter().deserialize(restClient().mapperAdapter().serialize(result.getResponse().headers()), headerType), result.getResponse() )); } catch (IOException e) { @@ -584,7 +571,7 @@ private void updateStateFromAzureAsyncOperationHeader(PollingState pollin AzureAsyncOperation body = null; if (response.body() != null) { - body = mapperAdapter.deserialize(response.body().string(), AzureAsyncOperation.class); + body = restClient().mapperAdapter().deserialize(response.body().string(), AzureAsyncOperation.class); response.body().close(); } @@ -592,7 +579,7 @@ private void updateStateFromAzureAsyncOperationHeader(PollingState pollin CloudException exception = new CloudException("no body"); exception.setResponse(response); if (response.errorBody() != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(response.errorBody().string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(response.errorBody().string(), CloudError.class)); response.errorBody().close(); } throw exception; @@ -624,14 +611,14 @@ public void success(ServiceResponse result) { try { AzureAsyncOperation body = null; if (result.getBody() != null) { - body = mapperAdapter.deserialize(result.getBody().string(), AzureAsyncOperation.class); + body = restClient().mapperAdapter().deserialize(result.getBody().string(), AzureAsyncOperation.class); result.getBody().close(); } if (body == null || body.getStatus() == null) { CloudException exception = new CloudException("no body"); exception.setResponse(result.getResponse()); if (result.getResponse().errorBody() != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(result.getResponse().errorBody().string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(result.getResponse().errorBody().string(), CloudError.class)); result.getResponse().errorBody().close(); } failure(exception); @@ -663,18 +650,17 @@ private Response poll(String url) throws CloudException, IOExcepti if (port == -1) { port = endpoint.getDefaultPort(); } - AsyncService service = this.retrofitBuilder - .baseUrl(endpoint.getProtocol() + "://" + endpoint.getHost() + ":" + port).build().create(AsyncService.class); - Response response = service.get(endpoint.getFile()).execute(); + AsyncService service = restClient().retrofit().create(AsyncService.class); + Response response = service.get(endpoint.getFile(), serviceClientUserAgent).execute(); int statusCode = response.code(); if (statusCode != 200 && statusCode != 201 && statusCode != 202 && statusCode != 204) { CloudException exception = new CloudException(statusCode + " is not a valid polling status code"); exception.setResponse(response); if (response.body() != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(response.body().string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(response.body().string(), CloudError.class)); response.body().close(); } else if (response.errorBody() != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(response.errorBody().string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(response.errorBody().string(), CloudError.class)); response.errorBody().close(); } throw exception; @@ -701,9 +687,8 @@ private Call pollAsync(String url, final ServiceCallback call = service.get(endpoint.getFile()); + AsyncService service = restClient().retrofit().create(AsyncService.class); + Call call = service.get(endpoint.getFile(), serviceClientUserAgent); call.enqueue(new ServiceResponseCallback(callback) { @Override public void onResponse(Call call, Response response) { @@ -713,10 +698,10 @@ public void onResponse(Call call, Response response) CloudException exception = new CloudException(statusCode + " is not a valid polling status code"); exception.setResponse(response); if (response.body() != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(response.body().string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(response.body().string(), CloudError.class)); response.body().close(); } else if (response.errorBody() != null) { - exception.setBody((CloudError) mapperAdapter.deserialize(response.errorBody().string(), CloudError.class)); + exception.setBody((CloudError) restClient().mapperAdapter().deserialize(response.errorBody().string(), CloudError.class)); response.errorBody().close(); } callback.failure(exception); @@ -745,34 +730,16 @@ public Integer getLongRunningOperationRetryTimeout() { * * @param longRunningOperationRetryTimeout the time in milliseconds. */ - public void setLongRunningOperationRetryTimeout(Integer longRunningOperationRetryTimeout) { + public void withLongRunningOperationRetryTimeout(Integer longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; } - /** - * Gets the credentials used for authentication. - * - * @return the credentials. - */ - public ServiceClientCredentials getCredentials() { - return credentials; - } - - /** - * Sets the credentials used for authentication. - * - * @param credentials the credentials. - */ - public void setCredentials(ServiceClientCredentials credentials) { - this.credentials = credentials; - } - /** * The Retrofit service used for polling. */ private interface AsyncService { @GET - Call get(@Url String url); + Call get(@Url String url, @Header("User-Agent") String userAgent); } /** @@ -809,7 +776,7 @@ class PutPatchPollingTask extends AsyncPollingTask { * @param serviceCall the ServiceCall object tracking Retrofit calls. * @param clientCallback the client callback to call when a terminal status is hit. */ - public PutPatchPollingTask(final PollingState pollingState, final String url, final ServiceCall serviceCall, final ServiceCallback clientCallback) { + PutPatchPollingTask(final PollingState pollingState, final String url, final ServiceCall serviceCall, final ServiceCallback clientCallback) { this.serviceCall = serviceCall; this.pollingState = pollingState; this.url = url; @@ -866,7 +833,7 @@ class PostDeletePollingTask extends AsyncPollingTask { * @param serviceCall the ServiceCall object tracking Retrofit calls. * @param clientCallback the client callback to call when a terminal status is hit. */ - public PostDeletePollingTask(final PollingState pollingState, final ServiceCall serviceCall, final ServiceCallback clientCallback) { + PostDeletePollingTask(final PollingState pollingState, final ServiceCall serviceCall, final ServiceCallback clientCallback) { this.serviceCall = serviceCall; this.pollingState = pollingState; this.clientCallback = clientCallback; @@ -898,8 +865,7 @@ public void run() { } } else { // Check if operation failed - if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) - { + if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) { clientCallback.failure(new ServiceException("Async operation failed")); } else { clientCallback.success(new ServiceResponse<>(pollingState.getResource(), pollingState.getResponse())); diff --git a/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/AzureEnvironment.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureEnvironment.java similarity index 58% rename from ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/AzureEnvironment.java rename to ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureEnvironment.java index dd8a1a2dc9de9..04a6af99d93db 100644 --- a/ClientRuntimes/Java/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/AzureEnvironment.java +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureEnvironment.java @@ -5,20 +5,27 @@ * */ -package com.microsoft.azure.credentials; +package com.microsoft.azure; /** * An instance of this class describes an environment in Azure. */ public final class AzureEnvironment { + /** + * Base URL for calls to Azure management API. + */ + private final String baseURL; + /** * ActiveDirectory Endpoint for the Azure Environment. */ private String authenticationEndpoint; + /** * Token audience for an endpoint. */ private String tokenAudience; + /** * Determines whether the authentication endpoint should * be validated with Azure AD. Default value is true. @@ -32,11 +39,17 @@ public final class AzureEnvironment { * @param tokenAudience token audience for an endpoint. * @param validateAuthority whether the authentication endpoint should * be validated with Azure AD. + * @param baseUrl the base URL for the current environment. */ - public AzureEnvironment(String authenticationEndpoint, String tokenAudience, boolean validateAuthority) { + public AzureEnvironment( + String authenticationEndpoint, + String tokenAudience, + boolean validateAuthority, + String baseUrl) { this.authenticationEndpoint = authenticationEndpoint; this.tokenAudience = tokenAudience; this.validateAuthority = validateAuthority; + this.baseURL = baseUrl; } /** @@ -45,7 +58,8 @@ public AzureEnvironment(String authenticationEndpoint, String tokenAudience, boo public static final AzureEnvironment AZURE = new AzureEnvironment( "https://login.windows.net/", "https://management.core.windows.net/", - true); + true, + "https://management.azure.com/"); /** * Provides the settings for authentication with Azure China. @@ -53,7 +67,46 @@ public AzureEnvironment(String authenticationEndpoint, String tokenAudience, boo public static final AzureEnvironment AZURE_CHINA = new AzureEnvironment( "https://login.chinacloudapi.cn/", "https://management.core.chinacloudapi.cn/", - true); + true, + "https://management.chinacloudapi.cn/"); + + /** + * Provides the settings for authentication with Azure US Government. + */ + public static final AzureEnvironment AZURE_US_GOVERNMENT = new AzureEnvironment( + "https://login.microsoftonline.com/", + "https://management.core.usgovcloudapi.net/", + true, + "https://management.usgovcloudapi.net/"); + + /** + * Provides the settings for authentication with Azure Germany. + */ + public static final AzureEnvironment AZURE_GERMANY = new AzureEnvironment( + "https://login.microsoftonline.de/", + "https://management.core.cloudapi.de/", + true, + "https://management.microsoftazure.de/"); + + /** + * Gets the base URL of the management service. + * + * @return the Base URL for the management service. + */ + public String getBaseUrl() { + return this.baseURL; + } + + /** + * Gets a builder for {@link RestClient}. + * + * @return a builder for the rest client. + */ + public RestClient.Builder.Buildable newRestClientBuilder() { + return new RestClient.Builder() + .withDefaultBaseUrl(this) + .withInterceptor(new RequestIdHeaderInterceptor()); + } /** * Gets the ActiveDirectory Endpoint for the Azure Environment. diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java index 5feea13fa74d8..09c8c28fbd536 100644 --- a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java @@ -7,58 +7,68 @@ package com.microsoft.azure; -import com.microsoft.azure.serializer.AzureJacksonMapperAdapter; -import com.microsoft.rest.ServiceClient; -import com.microsoft.rest.UserAgentInterceptor; -import com.microsoft.rest.retry.RetryHandler; +import com.microsoft.rest.serializer.JacksonMapperAdapter; -import java.net.CookieManager; -import java.net.CookiePolicy; - -import okhttp3.JavaNetCookieJar; import okhttp3.OkHttpClient; import retrofit2.Retrofit; /** * ServiceClient is the abstraction for accessing REST operations and their payload data types. */ -public abstract class AzureServiceClient extends ServiceClient { +public abstract class AzureServiceClient { /** - * Initializes a new instance of the ServiceClient class. + * The RestClient instance storing all information needed for making REST calls. */ - protected AzureServiceClient() { - super(); + private RestClient restClient; + + protected AzureServiceClient(String baseUrl) { + this(new RestClient.Builder().withBaseUrl(baseUrl) + .withInterceptor(new RequestIdHeaderInterceptor()).build()); } /** * Initializes a new instance of the ServiceClient class. * - * @param clientBuilder the builder to build up an OkHttp client - * @param retrofitBuilder the builder to build up a rest adapter + * @param restClient the REST client + */ + protected AzureServiceClient(RestClient restClient) { + this.restClient = restClient; + } + + /** + * The default User-Agent header. Override this method to override the user agent. + * + * @return the user agent string. */ - protected AzureServiceClient(OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { - super(clientBuilder, retrofitBuilder); + public String userAgent() { + return "Azure-SDK-For-Java/" + getClass().getPackage().getImplementationVersion(); } /** - * This method initializes the builders for Http client and Retrofit with common - * behaviors for all service clients. + * @return the {@link RestClient} instance. */ - @Override - protected void initialize() { - // Add retry handler - CookieManager cookieManager = new CookieManager(); - cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL); + public RestClient restClient() { + return restClient; + } - // Set up OkHttp client - this.clientBuilder = clientBuilder - .cookieJar(new JavaNetCookieJar(cookieManager)) - .addInterceptor(new RetryHandler()) - .addInterceptor(new UserAgentInterceptor()); - // Set up rest adapter - this.mapperAdapter = new AzureJacksonMapperAdapter(); - this.retrofitBuilder = retrofitBuilder - .client(clientBuilder.build()) - .addConverterFactory(mapperAdapter.getConverterFactory()); + /** + * @return the Retrofit instance. + */ + public Retrofit retrofit() { + return restClient().retrofit(); + } + + /** + * @return the HTTP client. + */ + public OkHttpClient httpClient() { + return restClient().httpClient(); + } + + /** + * @return the adapter to a Jackson {@link com.fasterxml.jackson.databind.ObjectMapper}. + */ + public JacksonMapperAdapter mapperAdapter() { + return restClient().mapperAdapter(); } } diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceResponseBuilder.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceResponseBuilder.java index f553fd575cc03..7ad369ecc5686 100644 --- a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceResponseBuilder.java +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceResponseBuilder.java @@ -8,7 +8,7 @@ package com.microsoft.azure; import com.google.common.reflect.TypeToken; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseBuilder; import com.microsoft.rest.serializer.JacksonMapperAdapter; @@ -27,7 +27,7 @@ * @param the return type from caller. * @param the exception to throw in case of error. */ -public class AzureServiceResponseBuilder extends ServiceResponseBuilder { +public class AzureServiceResponseBuilder extends ServiceResponseBuilder { /** * Create a ServiceResponseBuilder instance. * diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/CloudException.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/CloudException.java index 00969b08e656f..2e0a9db747838 100644 --- a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/CloudException.java +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/CloudException.java @@ -7,13 +7,13 @@ package com.microsoft.azure; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; import retrofit2.Response; /** * Exception thrown for an invalid response with custom error information. */ -public class CloudException extends AutoRestException { +public class CloudException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/DAGNode.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/DAGNode.java new file mode 100644 index 0000000000000..112130413fd87 --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/DAGNode.java @@ -0,0 +1,116 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * The type representing node in a {@link DAGraph}. + * + * @param the type of the data stored in the node + */ +public class DAGNode extends Node { + private List dependentKeys; + private int toBeResolved; + private boolean isPreparer; + + /** + * Creates a DAG node. + * + * @param key unique id of the node + * @param data data to be stored in the node + */ + public DAGNode(String key, T data) { + super(key, data); + dependentKeys = new ArrayList<>(); + } + + /** + * @return a list of keys of nodes in {@link DAGraph} those are dependents on this node + */ + List dependentKeys() { + return Collections.unmodifiableList(this.dependentKeys); + } + + /** + * Mark the node identified by the given key as dependent of this node. + * + * @param key the id of the dependent node + */ + public void addDependent(String key) { + this.dependentKeys.add(key); + } + + /** + * @return a list of keys of nodes in {@link DAGraph} that this node depends on + */ + public List dependencyKeys() { + return this.children(); + } + + /** + * Mark the node identified by the given key as this node's dependency. + * + * @param dependencyKey the id of the dependency node + */ + public void addDependency(String dependencyKey) { + super.addChild(dependencyKey); + } + + /** + * @return true if this node has any dependency + */ + public boolean hasDependencies() { + return this.hasChildren(); + } + + /** + * Mark or un-mark this node as preparer. + * + * @param isPreparer true if this node needs to be marked as preparer, false otherwise. + */ + public void setPreparer(boolean isPreparer) { + this.isPreparer = isPreparer; + } + + /** + * @return true if this node is marked as preparer + */ + public boolean isPreparer() { + return isPreparer; + } + + /** + * Initialize the node so that traversal can be performed on the parent DAG. + */ + public void initialize() { + this.toBeResolved = this.dependencyKeys().size(); + this.dependentKeys.clear(); + } + + /** + * @return true if all dependencies of this node are ready to be consumed + */ + boolean hasAllResolved() { + return toBeResolved == 0; + } + + /** + * Reports that one of this node's dependency has been resolved and ready to be consumed. + * + * @param dependencyKey the id of the dependency node + */ + void reportResolved(String dependencyKey) { + if (toBeResolved == 0) { + throw new RuntimeException("invalid state - " + this.key() + ": The dependency '" + dependencyKey + "' is already reported or there is no such dependencyKey"); + } + toBeResolved--; + } +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/DAGraph.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/DAGraph.java new file mode 100644 index 0000000000000..58179e0152ed4 --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/DAGraph.java @@ -0,0 +1,179 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import java.util.ArrayDeque; +import java.util.Map; +import java.util.Queue; + +/** + * Type representing a DAG (directed acyclic graph). + *

+ * each node in a DAG is represented by {@link DAGNode} + * + * @param the type of the data stored in the graph nodes + * @param the type of the nodes in the graph + */ +public class DAGraph> extends Graph { + private Queue queue; + private boolean hasParent; + private U rootNode; + + /** + * Creates a new DAG. + * + * @param rootNode the root node of this DAG + */ + public DAGraph(U rootNode) { + this.rootNode = rootNode; + this.queue = new ArrayDeque<>(); + this.rootNode.setPreparer(true); + this.addNode(rootNode); + } + + /** + * @return true if this DAG is merged with another DAG and hence has a parent + */ + public boolean hasParent() { + return hasParent; + } + + /** + * Checks whether the given node is root node of this DAG. + * + * @param node the node {@link DAGNode} to be checked + * @return true if the given node is root node + */ + public boolean isRootNode(U node) { + return this.rootNode == node; + } + + /** + * @return true if this dag is the preparer responsible for + * preparing the DAG for traversal. + */ + public boolean isPreparer() { + return this.rootNode.isPreparer(); + } + + /** + * Merge this DAG with another DAG. + *

+ * This will mark this DAG as a child DAG, the dependencies of nodes in this DAG will be merged + * with (copied to) the parent DAG + * + * @param parent the parent DAG + */ + public void merge(DAGraph parent) { + this.hasParent = true; + parent.rootNode.addDependency(this.rootNode.key()); + for (Map.Entry entry: graph.entrySet()) { + String key = entry.getKey(); + if (!parent.graph.containsKey(key)) { + parent.graph.put(key, entry.getValue()); + } + } + } + + /** + * Prepares this DAG for traversal using getNext method, each call to getNext returns next node + * in the DAG with no dependencies. + */ + public void prepare() { + if (isPreparer()) { + for (U node : graph.values()) { + // Prepare each node for traversal + node.initialize(); + if (!this.isRootNode(node)) { + // Mark other sub-DAGs as non-preparer + node.setPreparer(false); + } + } + initializeDependentKeys(); + initializeQueue(); + } + } + + /** + * Gets next node in the DAG which has no dependency or all of it's dependencies are resolved and + * ready to be consumed. + * + * @return next node or null if all the nodes have been explored + */ + public U getNext() { + return graph.get(queue.poll()); + } + + /** + * Gets the data stored in a graph node with a given key. + * + * @param key the key of the node + * @return the value stored in the node + */ + public T getNodeData(String key) { + return graph.get(key).data(); + } + + /** + * Reports that a node is resolved hence other nodes depends on it can consume it. + * + * @param completed the node ready to be consumed + */ + public void reportedCompleted(U completed) { + completed.setPreparer(true); + String dependency = completed.key(); + for (String dependentKey : graph.get(dependency).dependentKeys()) { + DAGNode dependent = graph.get(dependentKey); + dependent.reportResolved(dependency); + if (dependent.hasAllResolved()) { + queue.add(dependent.key()); + } + } + } + + /** + * Initializes dependents of all nodes. + *

+ * The DAG will be explored in DFS order and all node's dependents will be identified, + * this prepares the DAG for traversal using getNext method, each call to getNext returns next node + * in the DAG with no dependencies. + */ + private void initializeDependentKeys() { + visit(new Visitor() { + // This 'visit' will be called only once per each node. + @Override + public void visit(U node) { + if (node.dependencyKeys().isEmpty()) { + return; + } + + String dependentKey = node.key(); + for (String dependencyKey : node.dependencyKeys()) { + graph.get(dependencyKey) + .addDependent(dependentKey); + } + } + }); + } + + /** + * Initializes the queue that tracks the next set of nodes with no dependencies or + * whose dependencies are resolved. + */ + private void initializeQueue() { + this.queue.clear(); + for (Map.Entry entry: graph.entrySet()) { + if (!entry.getValue().hasDependencies()) { + this.queue.add(entry.getKey()); + } + } + if (queue.isEmpty()) { + throw new RuntimeException("Found circular dependency"); + } + } +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Graph.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Graph.java new file mode 100644 index 0000000000000..40ceebaa50b2b --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Graph.java @@ -0,0 +1,85 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Type representing a directed graph data structure. + *

+ * Each node in a graph is represented by {@link Node} + * + * @param the type of the data stored in the graph's nodes + * @param the type of the nodes in the graph + */ +public class Graph> { + protected Map graph; + private Set visited; + + /** + * Creates a directed graph. + */ + public Graph() { + this.graph = new HashMap<>(); + this.visited = new HashSet<>(); + } + + /** + * Adds a node to this graph. + * + * @param node the node + */ + public void addNode(U node) { + graph.put(node.key(), node); + } + + /** + * Represents a visitor to be implemented by the consumer who want to visit the + * graph's nodes in DFS order. + * + * @param the type of the node + */ + interface Visitor { + /** + * visit a node. + * + * @param node the node to visited + */ + void visit(U node); + } + + /** + * Perform DFS visit in this graph. + *

+ * The directed graph will be traversed in DFS order and the visitor will be notified as + * search explores each node + * + * @param visitor the graph visitor + */ + public void visit(Visitor visitor) { + for (Map.Entry> item : graph.entrySet()) { + if (!visited.contains(item.getKey())) { + this.dfs(visitor, item.getValue()); + } + } + visited.clear(); + } + + private void dfs(Visitor visitor, Node node) { + visitor.visit(node); + visited.add(node.key()); + for (String childKey : node.children()) { + if (!visited.contains(childKey)) { + this.dfs(visitor, this.graph.get(childKey)); + } + } + } +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Node.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Node.java new file mode 100644 index 0000000000000..cbb83f1d2a58f --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Node.java @@ -0,0 +1,70 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Type represents a node in a {@link Graph}. + * + * @param the type of the data stored in the node + */ +public class Node { + private String key; + private T data; + private List children; + + /** + * Creates a graph node. + * + * @param key unique id of the node + * @param data data to be stored in the node + */ + public Node(String key, T data) { + this.key = key; + this.data = data; + this.children = new ArrayList<>(); + } + + /** + * @return this node's unique id + */ + public String key() { + return this.key; + } + + /** + * @return data stored in this node + */ + public T data() { + return data; + } + + /** + * @return true if this node has any children + */ + public boolean hasChildren() { + return !this.children.isEmpty(); + } + + /** + * @return children (neighbours) of this node + */ + public List children() { + return Collections.unmodifiableList(this.children); + } + + /** + * @param childKey add a child (neighbour) of this node + */ + public void addChild(String childKey) { + this.children.add(childKey); + } +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java index e13926390c42f..a88a044f751e7 100644 --- a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java @@ -7,18 +7,18 @@ package com.microsoft.azure; -import com.microsoft.rest.AutoRestException; +import com.microsoft.rest.RestException; +import javax.xml.bind.DataBindingException; +import javax.xml.ws.WebServiceException; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.NoSuchElementException; -import javax.xml.bind.DataBindingException; -import javax.xml.ws.WebServiceException; - /** * Defines a list response from a paging operation. The pages are * lazy initialized when an instance of this class is iterated. @@ -30,6 +30,15 @@ public abstract class PagedList implements List { private List items; /** Stores the link to get the next page of items. */ private String nextPageLink; + /** Stores the latest page fetched. */ + private Page currentPage; + + /** + * Creates an instance of Pagedlist. + */ + public PagedList() { + items = new ArrayList<>(); + } /** * Creates an instance of PagedList from a {@link Page} response. @@ -37,8 +46,10 @@ public abstract class PagedList implements List { * @param page the {@link Page} object. */ public PagedList(Page page) { - items = page.getItems(); + this(); + items.addAll(page.getItems()); nextPageLink = page.getNextPageLink(); + currentPage = page; } /** @@ -46,10 +57,10 @@ public PagedList(Page page) { * * @param nextPageLink the link to get the next page of items. * @return the {@link Page} object storing a page of items and a link to the next page. - * @throws AutoRestException thrown if an error is raised from Azure. + * @throws RestException thrown if an error is raised from Azure. * @throws IOException thrown if there's any failure in deserialization. */ - public abstract Page nextPage(String nextPageLink) throws AutoRestException, IOException; + public abstract Page nextPage(String nextPageLink) throws RestException, IOException; /** * If there are more pages available. @@ -69,12 +80,12 @@ public void loadNextPage() { Page nextPage = nextPage(this.nextPageLink); this.nextPageLink = nextPage.getNextPageLink(); this.items.addAll(nextPage.getItems()); - } catch (AutoRestException e) { + this.currentPage = nextPage; + } catch (RestException e) { throw new WebServiceException(e.toString(), e); } catch (IOException e) { throw new DataBindingException(e.getMessage(), e); } - } /** @@ -86,6 +97,24 @@ public void loadAll() { } } + /** + * Gets the latest page fetched. + * + * @return the latest page. + */ + public Page currentPage() { + return currentPage; + } + + /** + * Gets the next page's link. + * + * @return the next page link. + */ + public String nextPageLink() { + return nextPageLink; + } + /** * The implementation of {@link ListIterator} for PagedList. */ @@ -98,13 +127,13 @@ private class ListItr implements ListIterator { * * @param index the position in the list to start. */ - public ListItr(int index) { + ListItr(int index) { itemsListItr = items.listIterator(index); } @Override public boolean hasNext() { - return itemsListItr.hasNext() || nextPageLink != null; + return itemsListItr.hasNext() || hasNextPage(); } @Override @@ -165,7 +194,7 @@ public int size() { @Override public boolean isEmpty() { - return items.isEmpty() && nextPageLink == null; + return items.isEmpty() && !hasNextPage(); } @Override diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RequestIdHeaderInterceptor.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RequestIdHeaderInterceptor.java new file mode 100644 index 0000000000000..ddbe0db30ec0b --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RequestIdHeaderInterceptor.java @@ -0,0 +1,29 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +import java.io.IOException; +import java.util.UUID; + +/** + * An instance of this class puts an UUID in the request header. Azure uses + * the request id as the unique identifier for + */ +public class RequestIdHeaderInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request().newBuilder() + .header("x-ms-client-request-id", UUID.randomUUID().toString()) + .build(); + return chain.proceed(request); + } +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Resource.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Resource.java index 732035538ef6e..2f98e586a960d 100644 --- a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Resource.java +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Resource.java @@ -49,7 +49,7 @@ public class Resource { * * @return the id value */ - public String getId() { + public String id() { return this.id; } @@ -58,7 +58,7 @@ public String getId() { * * @return the name value */ - public String getName() { + public String name() { return this.name; } @@ -67,7 +67,7 @@ public String getName() { * * @return the type value */ - public String getType() { + public String type() { return this.type; } @@ -76,7 +76,7 @@ public String getType() { * * @return the location value */ - public String getLocation() { + public String location() { return this.location; } @@ -84,9 +84,11 @@ public String getLocation() { * Set the location value. * * @param location the location value to set + * @return the resource itself */ - public void setLocation(String location) { + public Resource withLocation(String location) { this.location = location; + return this; } /** @@ -102,8 +104,10 @@ public Map getTags() { * Set the tags value. * * @param tags the tags value to set + * @return the resource itself */ - public void setTags(Map tags) { + public Resource withTags(Map tags) { this.tags = tags; + return this; } } \ No newline at end of file diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/ResourceGetExponentialBackoffRetryStrategy.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/ResourceGetExponentialBackoffRetryStrategy.java new file mode 100644 index 0000000000000..a145fecc6795b --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/ResourceGetExponentialBackoffRetryStrategy.java @@ -0,0 +1,48 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import com.microsoft.rest.retry.RetryStrategy; +import okhttp3.Response; + +/** + * A retry strategy with backoff parameters for calculating the exponential + * delay between retries for 404s from GET calls. + */ +public class ResourceGetExponentialBackoffRetryStrategy extends RetryStrategy { + /** + * Represents the default number of retries. + */ + private static final int DEFAULT_NUMBER_OF_ATTEMPTS = 3; + + /** + * Creates an instance of the retry strategy. + */ + public ResourceGetExponentialBackoffRetryStrategy() { + this(null, DEFAULT_FIRST_FAST_RETRY); + } + + /** + * Initializes a new instance of the {@link RetryStrategy} class. + * + * @param name The name of the retry strategy. + * @param firstFastRetry true to immediately retry in the first attempt; otherwise, false. + */ + private ResourceGetExponentialBackoffRetryStrategy(String name, boolean firstFastRetry) { + super(name, firstFastRetry); + } + + @Override + public boolean shouldRetry(int retryCount, Response response) { + int code = response.code(); + //CHECKSTYLE IGNORE MagicNumber FOR NEXT 2 LINES + return retryCount < DEFAULT_NUMBER_OF_ATTEMPTS + && code == 404 + && response.request().method().equalsIgnoreCase("GET"); + } +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RestClient.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RestClient.java new file mode 100644 index 0000000000000..2cd137953fe7b --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RestClient.java @@ -0,0 +1,352 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import com.microsoft.azure.serializer.AzureJacksonMapperAdapter; +import com.microsoft.rest.BaseUrlHandler; +import com.microsoft.rest.CustomHeadersInterceptor; +import com.microsoft.rest.UserAgentInterceptor; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.retry.RetryHandler; +import com.microsoft.rest.serializer.JacksonMapperAdapter; + +import java.lang.reflect.Field; +import java.net.CookieManager; +import java.net.CookiePolicy; +import java.net.Proxy; +import java.util.concurrent.Executor; +import java.util.concurrent.TimeUnit; + +import okhttp3.ConnectionPool; +import okhttp3.Interceptor; +import okhttp3.JavaNetCookieJar; +import okhttp3.OkHttpClient; +import okhttp3.logging.HttpLoggingInterceptor; +import retrofit2.Retrofit; + +/** + * An instance of this class stores the client information for making REST calls. + */ +public class RestClient { + /** The {@link okhttp3.OkHttpClient} object. */ + private OkHttpClient httpClient; + /** The {@link retrofit2.Retrofit} object. */ + private Retrofit retrofit; + /** The credentials to authenticate. */ + private ServiceClientCredentials credentials; + /** The interceptor to handle custom headers. */ + private CustomHeadersInterceptor customHeadersInterceptor; + /** The interceptor to handle base URL. */ + private BaseUrlHandler baseUrlHandler; + /** The adapter to a Jackson {@link com.fasterxml.jackson.databind.ObjectMapper}. */ + private JacksonMapperAdapter mapperAdapter; + /** The interceptor to set 'User-Agent' header. */ + private UserAgentInterceptor userAgentInterceptor; + + protected RestClient(OkHttpClient httpClient, + Retrofit retrofit, + ServiceClientCredentials credentials, + CustomHeadersInterceptor customHeadersInterceptor, + UserAgentInterceptor userAgentInterceptor, + BaseUrlHandler baseUrlHandler, + JacksonMapperAdapter mapperAdapter) { + this.httpClient = httpClient; + this.retrofit = retrofit; + this.credentials = credentials; + this.customHeadersInterceptor = customHeadersInterceptor; + this.userAgentInterceptor = userAgentInterceptor; + this.baseUrlHandler = baseUrlHandler; + this.mapperAdapter = mapperAdapter; + } + + /** + * Get the headers interceptor. + * + * @return the headers interceptor. + */ + public CustomHeadersInterceptor headers() { + return customHeadersInterceptor; + } + + /** + * Get the adapter to {@link com.fasterxml.jackson.databind.ObjectMapper}. + * + * @return the Jackson mapper adapter. + */ + public JacksonMapperAdapter mapperAdapter() { + return mapperAdapter; + } + + /** + * Sets the mapper adapter. + * + * @param mapperAdapter an adapter to a Jackson mapper. + * @return the builder itself for chaining. + */ + public RestClient withMapperAdapater(JacksonMapperAdapter mapperAdapter) { + this.mapperAdapter = mapperAdapter; + return this; + } + + /** + * Get the http client. + * + * @return the {@link OkHttpClient} object. + */ + public OkHttpClient httpClient() { + return httpClient; + } + + /** + * Get the retrofit instance. + * + * @return the {@link Retrofit} object. + */ + public Retrofit retrofit() { + return retrofit; + } + + /** + * Get the credentials attached to this REST client. + * + * @return the credentials. + */ + public ServiceClientCredentials credentials() { + return this.credentials; + } + + /** + * The builder class for building a REST client. + */ + public static class Builder { + /** The dynamic base URL with variables wrapped in "{" and "}". */ + protected String baseUrl; + /** The builder to build an {@link OkHttpClient}. */ + protected OkHttpClient.Builder httpClientBuilder; + /** The builder to build a {@link Retrofit}. */ + protected Retrofit.Builder retrofitBuilder; + /** The credentials to authenticate. */ + protected ServiceClientCredentials credentials; + /** The interceptor to handle custom headers. */ + protected CustomHeadersInterceptor customHeadersInterceptor; + /** The interceptor to handle base URL. */ + protected BaseUrlHandler baseUrlHandler; + /** The interceptor to set 'User-Agent' header. */ + protected UserAgentInterceptor userAgentInterceptor; + /** The inner Builder instance. */ + protected Buildable buildable; + + /** + * Creates an instance of the builder with a base URL to the service. + */ + public Builder() { + this(new OkHttpClient.Builder(), new Retrofit.Builder()); + } + + /** + * Creates an instance of the builder with a base URL and 2 custom builders. + * + * @param httpClientBuilder the builder to build an {@link OkHttpClient}. + * @param retrofitBuilder the builder to build a {@link Retrofit}. + */ + public Builder(OkHttpClient.Builder httpClientBuilder, Retrofit.Builder retrofitBuilder) { + if (httpClientBuilder == null) { + throw new IllegalArgumentException("httpClientBuilder == null"); + } + if (retrofitBuilder == null) { + throw new IllegalArgumentException("retrofitBuilder == null"); + } + CookieManager cookieManager = new CookieManager(); + cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL); + customHeadersInterceptor = new CustomHeadersInterceptor(); + baseUrlHandler = new BaseUrlHandler(); + userAgentInterceptor = new UserAgentInterceptor(); + // Set up OkHttp client + this.httpClientBuilder = httpClientBuilder + .cookieJar(new JavaNetCookieJar(cookieManager)) + .addInterceptor(userAgentInterceptor); + this.retrofitBuilder = retrofitBuilder; + this.buildable = new Buildable(); + } + + /** + * Sets the dynamic base URL. + * + * @param baseUrl the base URL to use. + * @return the builder itself for chaining. + */ + public Buildable withBaseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return buildable; + } + + /** + * Sets the base URL with the default from the service client. + * + * @param serviceClientClass the service client class containing a default base URL. + * @return the builder itself for chaining. + */ + public Buildable withDefaultBaseUrl(Class serviceClientClass) { + try { + Field field = serviceClientClass.getDeclaredField("DEFAULT_BASE_URL"); + field.setAccessible(true); + baseUrl = (String) field.get(null); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new UnsupportedOperationException("Cannot read static field DEFAULT_BASE_URL", e); + } + return buildable; + } + + /** + * Sets the base URL with the default from the Azure Environment. + * + * @param environment the environment the application is running in + * @return the builder itself for chaining + */ + public RestClient.Builder.Buildable withDefaultBaseUrl(AzureEnvironment environment) { + withBaseUrl(environment.getBaseUrl()); + return buildable; + } + + /** + * The inner class from which a Rest Client can be built. + */ + public class Buildable { + /** + * Sets the user agent header. + * + * @param userAgent the user agent header. + * @return the builder itself for chaining. + */ + public Buildable withUserAgent(String userAgent) { + userAgentInterceptor.withUserAgent(userAgent); + return this; + } + + /** + * Sets the credentials. + * + * @param credentials the credentials object. + * @return the builder itself for chaining. + */ + public Buildable withCredentials(ServiceClientCredentials credentials) { + Builder.this.credentials = credentials; + if (credentials != null) { + credentials.applyCredentialsFilter(httpClientBuilder); + } + return this; + } + + /** + * Sets the log level. + * + * @param logLevel the {@link okhttp3.logging.HttpLoggingInterceptor.Level} enum. + * @return the builder itself for chaining. + */ + public Buildable withLogLevel(HttpLoggingInterceptor.Level logLevel) { + httpClientBuilder.addInterceptor(new HttpLoggingInterceptor().setLevel(logLevel)); + return this; + } + + /** + * Add an interceptor the Http client pipeline. + * + * @param interceptor the interceptor to add. + * @return the builder itself for chaining. + */ + public Buildable withInterceptor(Interceptor interceptor) { + httpClientBuilder.addInterceptor(interceptor); + return this; + } + + /** + * Set the read timeout on the HTTP client. Default is 10 seconds. + * + * @param timeout the timeout numeric value + * @param unit the time unit for the numeric value + * @return the builder itself for chaining + */ + public Buildable withReadTimeout(long timeout, TimeUnit unit) { + httpClientBuilder.readTimeout(timeout, unit); + return this; + } + + /** + * Set the connection timeout on the HTTP client. Default is 10 seconds. + * + * @param timeout the timeout numeric value + * @param unit the time unit for the numeric value + * @return the builder itself for chaining + */ + public Buildable withConnectionTimeout(long timeout, TimeUnit unit) { + httpClientBuilder.connectTimeout(timeout, unit); + return this; + } + + /** + * Set the maximum idle connections for the HTTP client. Default is 5. + * + * @param maxIdleConnections the maximum idle connections + * @return the builder itself for chaining + */ + public Buildable withMaxIdleConnections(int maxIdleConnections) { + httpClientBuilder.connectionPool(new ConnectionPool(maxIdleConnections, 5, TimeUnit.MINUTES)); + return this; + } + + /** + * Sets the executor for async callbacks to run on. + * + * @param executor the executor to execute the callbacks. + * @return the builder itself for chaining + */ + public Buildable withCallbackExecutor(Executor executor) { + retrofitBuilder.callbackExecutor(executor); + return this; + } + + /** + * Sets the proxy for the HTTP client. + * + * @param proxy the proxy to use + * @return the builder itself for chaining + */ + public Buildable withProxy(Proxy proxy) { + httpClientBuilder.proxy(proxy); + return this; + } + + /** + * Build a RestClient with all the current configurations. + * + * @return a {@link RestClient}. + */ + public RestClient build() { + AzureJacksonMapperAdapter mapperAdapter = new AzureJacksonMapperAdapter(); + OkHttpClient httpClient = httpClientBuilder + .addInterceptor(baseUrlHandler) + .addInterceptor(customHeadersInterceptor) + .addInterceptor(new RetryHandler(new ResourceGetExponentialBackoffRetryStrategy())) + .addInterceptor(new RetryHandler()) + .build(); + return new RestClient(httpClient, + retrofitBuilder + .baseUrl(baseUrl) + .client(httpClient) + .addConverterFactory(mapperAdapter.getConverterFactory()) + .build(), + credentials, + customHeadersInterceptor, + userAgentInterceptor, + baseUrlHandler, + mapperAdapter); + } + + } + } +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/SubResource.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/SubResource.java index 36ca18ae3665b..12bedc30c57fc 100644 --- a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/SubResource.java +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/SubResource.java @@ -21,7 +21,7 @@ public class SubResource { * * @return the id value */ - public String getId() { + public String id() { return this.id; } @@ -29,8 +29,10 @@ public String getId() { * Set the id value. * * @param id the id value to set + * @return the sub resource itself */ - public void setId(String id) { + public SubResource withId(String id) { this.id = id; + return this; } } \ No newline at end of file diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroup.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroup.java new file mode 100644 index 0000000000000..26bbbece2606b --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroup.java @@ -0,0 +1,77 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; + +/** + * Represents a group of related tasks. + *

+ * each task in a group is represented by {@link TaskItem} + * + * @param the type of result of tasks in the group + * @param the task type + */ +public interface TaskGroup> { + /** + * Gets underlying directed acyclic graph structure that stores tasks in the group and + * dependency information between them. + * + * @return the dag + */ + DAGraph> dag(); + + /** + * Merges this task group with parent task group. + *

+ * once merged, calling execute in the parent group will executes the task in this + * group as well. + * + * @param parentTaskGroup task group + */ + void merge(TaskGroup parentTaskGroup); + + /** + * @return true if the group is responsible for preparing execution of original task in + * this group and all tasks belong other task group it composes. + */ + boolean isPreparer(); + + /** + * Prepare the graph for execution. + */ + void prepare(); + + /** + * Executes the tasks in the group. + *

+ * the order of execution of tasks ensure that a task gets selected for execution only after + * the execution of all the tasks it depends on + * @throws Exception the exception + */ + void execute() throws Exception; + + /** + * Executes the tasks in the group asynchronously. + * + * @param callback the callback to call on failure or success + * @return the handle to the REST call + */ + ServiceCall executeAsync(ServiceCallback callback); + + /** + * Gets the result of execution of a task in the group. + *

+ * this method can null if the task has not yet been executed + * + * @param taskId the task id + * @return the task result + */ + T taskResult(String taskId); +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java new file mode 100644 index 0000000000000..efc8d30e491bc --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java @@ -0,0 +1,111 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; + +/** + * The base implementation of TaskGroup interface. + * + * @param the result type of the tasks in the group + */ +public abstract class TaskGroupBase + implements TaskGroup> { + private DAGraph, DAGNode>> dag; + + /** + * Creates TaskGroupBase. + * + * @param rootTaskItemId the id of the root task in this task group + * @param rootTaskItem the root task + */ + public TaskGroupBase(String rootTaskItemId, TaskItem rootTaskItem) { + this.dag = new DAGraph<>(new DAGNode<>(rootTaskItemId, rootTaskItem)); + } + + @Override + public DAGraph, DAGNode>> dag() { + return dag; + } + + @Override + public boolean isPreparer() { + return dag.isPreparer(); + } + + @Override + public void merge(TaskGroup> parentTaskGroup) { + dag.merge(parentTaskGroup.dag()); + } + + @Override + public void prepare() { + if (isPreparer()) { + dag.prepare(); + } + } + + @Override + public void execute() throws Exception { + DAGNode> nextNode = dag.getNext(); + if (nextNode == null) { + return; + } + + if (dag.isRootNode(nextNode)) { + executeRootTask(nextNode.data()); + } else { + nextNode.data().execute(this, nextNode); + } + } + + @Override + public ServiceCall executeAsync(final ServiceCallback callback) { + final DAGNode> nextNode = dag.getNext(); + if (nextNode == null) { + return null; + } + + if (dag.isRootNode(nextNode)) { + return executeRootTaskAsync(nextNode.data(), callback); + } else { + return nextNode.data().executeAsync(this, nextNode, callback); + } + } + + @Override + public T taskResult(String taskId) { + return dag.getNodeData(taskId).result(); + } + + /** + * Executes the root task in this group. + *

+ * This method will be invoked when all the task dependencies of the root task are finished + * executing, at this point root task can be executed by consuming the result of tasks it + * depends on. + * + * @param task the root task in this group + * @throws Exception the exception + */ + public abstract void executeRootTask(TaskItem task) throws Exception; + + /** + * Executes the root task in this group asynchronously. + *

+ * This method will be invoked when all the task dependencies of the root task are finished + * executing, at this point root task can be executed by consuming the result of tasks it + * depends on. + * + * @param task the root task in this group + * @param callback the callback when the task fails or succeeds + * @return the handle to the REST call + */ + public abstract ServiceCall executeRootTaskAsync(TaskItem task, ServiceCallback callback); +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskItem.java b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskItem.java new file mode 100644 index 0000000000000..fb74c23845c3b --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskItem.java @@ -0,0 +1,46 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; + +/** + * Type representing a task in a task group {@link TaskGroup}. + * + * @param the task result type + */ +public interface TaskItem { + /** + * @return the result of the task execution + */ + U result(); + + /** + * Executes the task. + *

+ * once executed the result will be available through result getter + * + * @param taskGroup the task group dispatching tasks + * @param node the node the task item is associated with + * @throws Exception exception + */ + void execute(TaskGroup> taskGroup, DAGNode> node) throws Exception; + + /** + * Executes the task asynchronously. + *

+ * once executed the result will be available through result getter + + * @param taskGroup the task group dispatching tasks + * @param node the node the task item is associated with + * @param callback callback to call on success or failure + * @return the handle of the REST call + */ + ServiceCall executeAsync(TaskGroup> taskGroup, DAGNode> node, ServiceCallback callback); +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/test/java/com/microsoft/azure/DAGraphTest.java b/ClientRuntimes/Java/azure-client-runtime/src/test/java/com/microsoft/azure/DAGraphTest.java new file mode 100644 index 0000000000000..f3b278797e2dd --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/test/java/com/microsoft/azure/DAGraphTest.java @@ -0,0 +1,145 @@ +package com.microsoft.azure; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class DAGraphTest { + @Test + public void testDAGraphGetNext() { + /** + * |-------->[D]------>[B]-----------[A] + * | ^ ^ + * | | | + * [F]------->[E]-------| | + * | | | + * | |------->[G]----->[C]---- + * | + * |-------->[H]-------------------->[I] + */ + List expectedOrder = new ArrayList<>(); + expectedOrder.add("A"); expectedOrder.add("I"); + expectedOrder.add("B"); expectedOrder.add("C"); expectedOrder.add("H"); + expectedOrder.add("D"); expectedOrder.add("G"); + expectedOrder.add("E"); + expectedOrder.add("F"); + + DAGNode nodeA = new DAGNode<>("A", "dataA"); + DAGNode nodeI = new DAGNode<>("I", "dataI"); + + DAGNode nodeB = new DAGNode<>("B", "dataB"); + nodeB.addDependency(nodeA.key()); + + DAGNode nodeC = new DAGNode<>("C", "dataC"); + nodeC.addDependency(nodeA.key()); + + DAGNode nodeH = new DAGNode<>("H", "dataH"); + nodeH.addDependency(nodeI.key()); + + DAGNode nodeG = new DAGNode<>("G", "dataG"); + nodeG.addDependency(nodeC.key()); + + DAGNode nodeE = new DAGNode<>("E", "dataE"); + nodeE.addDependency(nodeB.key()); + nodeE.addDependency(nodeG.key()); + + DAGNode nodeD = new DAGNode<>("D", "dataD"); + nodeD.addDependency(nodeB.key()); + + + DAGNode nodeF = new DAGNode<>("F", "dataF"); + nodeF.addDependency(nodeD.key()); + nodeF.addDependency(nodeE.key()); + nodeF.addDependency(nodeH.key()); + + DAGraph> dag = new DAGraph<>(nodeF); + dag.addNode(nodeA); + dag.addNode(nodeB); + dag.addNode(nodeC); + dag.addNode(nodeD); + dag.addNode(nodeE); + dag.addNode(nodeG); + dag.addNode(nodeH); + dag.addNode(nodeI); + + dag.prepare(); + DAGNode nextNode = dag.getNext(); + int i = 0; + while (nextNode != null) { + Assert.assertEquals(nextNode.key(), expectedOrder.get(i)); + dag.reportedCompleted(nextNode); + nextNode = dag.getNext(); + i++; + } + + System.out.println("done"); + } + + @Test + public void testGraphMerge() { + /** + * |-------->[D]------>[B]-----------[A] + * | ^ ^ + * | | | + * [F]------->[E]-------| | + * | | | + * | |------->[G]----->[C]---- + * | + * |-------->[H]-------------------->[I] + */ + List expectedOrder = new ArrayList<>(); + expectedOrder.add("A"); expectedOrder.add("I"); + expectedOrder.add("B"); expectedOrder.add("C"); expectedOrder.add("H"); + expectedOrder.add("D"); expectedOrder.add("G"); + expectedOrder.add("E"); + expectedOrder.add("F"); + + DAGraph> graphA = createGraph("A"); + DAGraph> graphI = createGraph("I"); + + DAGraph> graphB = createGraph("B"); + graphA.merge(graphB); + + DAGraph> graphC = createGraph("C"); + graphA.merge(graphC); + + DAGraph> graphH = createGraph("H"); + graphI.merge(graphH); + + DAGraph> graphG = createGraph("G"); + graphC.merge(graphG); + + DAGraph> graphE = createGraph("E"); + graphB.merge(graphE); + graphG.merge(graphE); + + DAGraph> graphD = createGraph("D"); + graphB.merge(graphD); + + DAGraph> graphF = createGraph("F"); + graphD.merge(graphF); + graphE.merge(graphF); + graphH.merge(graphF); + + DAGraph> dag = graphF; + dag.prepare(); + + DAGNode nextNode = dag.getNext(); + int i = 0; + while (nextNode != null) { + Assert.assertEquals(expectedOrder.get(i), nextNode.key()); + // Process the node + dag.reportedCompleted(nextNode); + nextNode = dag.getNext(); + i++; + } + } + + private DAGraph> createGraph(String resourceName) { + DAGNode node = new DAGNode<>(resourceName, "data" + resourceName); + DAGraph> graph = new DAGraph<>(node); + return graph; + } +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/test/java/com/microsoft/azure/DAGraphTests.java b/ClientRuntimes/Java/azure-client-runtime/src/test/java/com/microsoft/azure/DAGraphTests.java new file mode 100644 index 0000000000000..985fe306f0f52 --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/test/java/com/microsoft/azure/DAGraphTests.java @@ -0,0 +1,152 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class DAGraphTests { + @Test + public void testDAGraphGetNext() { + /** + * |-------->[D]------>[B]-----------[A] + * | ^ ^ + * | | | + * [F]------->[E]-------| | + * | | | + * | |------->[G]----->[C]---- + * | + * |-------->[H]-------------------->[I] + */ + List expectedOrder = new ArrayList<>(); + expectedOrder.add("A"); expectedOrder.add("I"); + expectedOrder.add("B"); expectedOrder.add("C"); expectedOrder.add("H"); + expectedOrder.add("D"); expectedOrder.add("G"); + expectedOrder.add("E"); + expectedOrder.add("F"); + + DAGNode nodeA = new DAGNode<>("A", "dataA"); + DAGNode nodeI = new DAGNode<>("I", "dataI"); + + DAGNode nodeB = new DAGNode<>("B", "dataB"); + nodeB.addDependency(nodeA.key()); + + DAGNode nodeC = new DAGNode<>("C", "dataC"); + nodeC.addDependency(nodeA.key()); + + DAGNode nodeH = new DAGNode<>("H", "dataH"); + nodeH.addDependency(nodeI.key()); + + DAGNode nodeG = new DAGNode<>("G", "dataG"); + nodeG.addDependency(nodeC.key()); + + DAGNode nodeE = new DAGNode<>("E", "dataE"); + nodeE.addDependency(nodeB.key()); + nodeE.addDependency(nodeG.key()); + + DAGNode nodeD = new DAGNode<>("D", "dataD"); + nodeD.addDependency(nodeB.key()); + + + DAGNode nodeF = new DAGNode<>("F", "dataF"); + nodeF.addDependency(nodeD.key()); + nodeF.addDependency(nodeE.key()); + nodeF.addDependency(nodeH.key()); + + DAGraph> dag = new DAGraph<>(nodeF); + dag.addNode(nodeA); + dag.addNode(nodeB); + dag.addNode(nodeC); + dag.addNode(nodeD); + dag.addNode(nodeE); + dag.addNode(nodeG); + dag.addNode(nodeH); + dag.addNode(nodeI); + + dag.prepare(); + DAGNode nextNode = dag.getNext(); + int i = 0; + while (nextNode != null) { + Assert.assertEquals(nextNode.key(), expectedOrder.get(i)); + dag.reportedCompleted(nextNode); + nextNode = dag.getNext(); + i++; + } + + System.out.println("done"); + } + + @Test + public void testGraphMerge() { + /** + * |-------->[D]------>[B]-----------[A] + * | ^ ^ + * | | | + * [F]------->[E]-------| | + * | | | + * | |------->[G]----->[C]---- + * | + * |-------->[H]-------------------->[I] + */ + List expectedOrder = new ArrayList<>(); + expectedOrder.add("A"); expectedOrder.add("I"); + expectedOrder.add("B"); expectedOrder.add("C"); expectedOrder.add("H"); + expectedOrder.add("D"); expectedOrder.add("G"); + expectedOrder.add("E"); + expectedOrder.add("F"); + + DAGraph> graphA = createGraph("A"); + DAGraph> graphI = createGraph("I"); + + DAGraph> graphB = createGraph("B"); + graphA.merge(graphB); + + DAGraph> graphC = createGraph("C"); + graphA.merge(graphC); + + DAGraph> graphH = createGraph("H"); + graphI.merge(graphH); + + DAGraph> graphG = createGraph("G"); + graphC.merge(graphG); + + DAGraph> graphE = createGraph("E"); + graphB.merge(graphE); + graphG.merge(graphE); + + DAGraph> graphD = createGraph("D"); + graphB.merge(graphD); + + DAGraph> graphF = createGraph("F"); + graphD.merge(graphF); + graphE.merge(graphF); + graphH.merge(graphF); + + DAGraph> dag = graphF; + dag.prepare(); + + DAGNode nextNode = dag.getNext(); + int i = 0; + while (nextNode != null) { + Assert.assertEquals(expectedOrder.get(i), nextNode.key()); + // Process the node + dag.reportedCompleted(nextNode); + nextNode = dag.getNext(); + i++; + } + } + + private DAGraph> createGraph(String resourceName) { + DAGNode node = new DAGNode<>(resourceName, "data" + resourceName); + DAGraph> graph = new DAGraph<>(node); + return graph; + } +} diff --git a/ClientRuntimes/Java/azure-client-runtime/src/test/java/com/microsoft/azure/RequestIdHeaderInterceptorTests.java b/ClientRuntimes/Java/azure-client-runtime/src/test/java/com/microsoft/azure/RequestIdHeaderInterceptorTests.java new file mode 100644 index 0000000000000..060336cd23d29 --- /dev/null +++ b/ClientRuntimes/Java/azure-client-runtime/src/test/java/com/microsoft/azure/RequestIdHeaderInterceptorTests.java @@ -0,0 +1,91 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.azure; + +import com.microsoft.rest.retry.RetryHandler; + +import org.junit.Assert; +import org.junit.Test; + +import java.io.IOException; + +import okhttp3.Interceptor; +import okhttp3.Protocol; +import okhttp3.Request; +import okhttp3.Response; + +public class RequestIdHeaderInterceptorTests { + private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; + + @Test + public void newRequestIdForEachCall() throws Exception { + RestClient restClient = new RestClient.Builder() + .withBaseUrl("http://localhost") + .withInterceptor(new RequestIdHeaderInterceptor()) + .withInterceptor(new Interceptor() { + private String firstRequestId = null; + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + if (request.header(REQUEST_ID_HEADER) != null) { + if (firstRequestId == null) { + firstRequestId = request.header(REQUEST_ID_HEADER); + return new Response.Builder().code(200).request(request) + .protocol(Protocol.HTTP_1_1).build(); + } else if (!request.header(REQUEST_ID_HEADER).equals(firstRequestId)) { + return new Response.Builder().code(200).request(request) + .protocol(Protocol.HTTP_1_1).build(); + } + } + return new Response.Builder().code(400).request(request) + .protocol(Protocol.HTTP_1_1).build(); + } + }) + .build(); + AzureServiceClient serviceClient = new AzureServiceClient(restClient) { }; + Response response = serviceClient.restClient().httpClient() + .newCall(new Request.Builder().get().url("http://localhost").build()).execute(); + Assert.assertEquals(200, response.code()); + response = serviceClient.restClient().httpClient() + .newCall(new Request.Builder().get().url("http://localhost").build()).execute(); + Assert.assertEquals(200, response.code()); + } + + @Test + public void sameRequestIdForRetry() throws Exception { + RestClient restClient = new RestClient.Builder() + .withBaseUrl("http://localhost") + .withInterceptor(new RequestIdHeaderInterceptor()) + .withInterceptor(new RetryHandler()) + .withInterceptor(new Interceptor() { + private String firstRequestId = null; + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + if (request.header(REQUEST_ID_HEADER) != null) { + if (firstRequestId == null) { + firstRequestId = request.header(REQUEST_ID_HEADER); + return new Response.Builder().code(500).request(request) + .protocol(Protocol.HTTP_1_1).build(); + } else if (request.header(REQUEST_ID_HEADER).equals(firstRequestId)) { + return new Response.Builder().code(200).request(request) + .protocol(Protocol.HTTP_1_1).build(); + } + } + return new Response.Builder().code(400).request(request) + .protocol(Protocol.HTTP_1_1).build(); + } + }) + .build(); + AzureServiceClient serviceClient = new AzureServiceClient(restClient) { }; + Response response = serviceClient.restClient().httpClient() + .newCall(new Request.Builder().get().url("http://localhost").build()).execute(); + Assert.assertEquals(200, response.code()); + } +} diff --git a/ClientRuntimes/Java/build-tools/pom.xml b/ClientRuntimes/Java/build-tools/pom.xml new file mode 100644 index 0000000000000..d540f8f5e6980 --- /dev/null +++ b/ClientRuntimes/Java/build-tools/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + com.microsoft.azure + autorest-clientruntime-for-java + 1.0.0-SNAPSHOT + ../pom.xml + + + autorest-build-tools + jar + + Build tools for AutoRest client runtime for Java + This package contains the build tools for AutoRest generated Java clients. + https://github.com/Azure/autorest-clientruntime-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + scm:git:https://github.com/Azure/autorest-clientruntime-for-java + scm:git:git@github.com:Azure/autorest-clientruntime-for-java.git + HEAD + + + + UTF-8 + + + + + + microsoft + Microsoft + + + diff --git a/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml b/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml new file mode 100644 index 0000000000000..1875d6f100cab --- /dev/null +++ b/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ClientRuntimes/Java/build-tools/src/main/resources/suppressions.xml b/ClientRuntimes/Java/build-tools/src/main/resources/suppressions.xml new file mode 100644 index 0000000000000..29e5bd66eefb5 --- /dev/null +++ b/ClientRuntimes/Java/build-tools/src/main/resources/suppressions.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClientRuntimes/Java/client-runtime/build.gradle b/ClientRuntimes/Java/client-runtime/build.gradle index b734d33608eaf..73750c0d3d935 100644 --- a/ClientRuntimes/Java/client-runtime/build.gradle +++ b/ClientRuntimes/Java/client-runtime/build.gradle @@ -15,22 +15,20 @@ group = 'com.microsoft.rest' version = '1.0.0-SNAPSHOT' checkstyle { - toolVersion = "6.9" - configFile = new File("$rootDir/Tools/checkstyle/checkstyle.xml") - configProperties = [samedir: "$rootDir/Tools/checkstyle"] - reportsDir = new File("$rootDir/Tools/checkstyle/reports") + toolVersion = "6.18" + configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml") + configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"] + reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports") } dependencies { compile 'com.google.guava:guava:18.0' - compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4' - compile 'com.squareup.okhttp3:okhttp:3.2.0' - compile 'com.squareup.okio:okio:1.7.0' - compile 'com.squareup.okhttp3:logging-interceptor:3.1.1' - compile 'com.squareup.okhttp3:okhttp-urlconnection:3.1.1' - compile 'com.squareup.retrofit2:converter-jackson:2.0.0-beta4' - compile 'com.fasterxml.jackson.core:jackson-databind:2.7.1' - compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.7.1' + compile 'com.squareup.retrofit2:retrofit:2.0.2' + compile 'com.squareup.okhttp3:okhttp:3.3.1' + compile 'com.squareup.okhttp3:logging-interceptor:3.3.1' + compile 'com.squareup.okhttp3:okhttp-urlconnection:3.3.1' + compile 'com.squareup.retrofit2:converter-jackson:2.0.2' + compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.7.2' compile 'org.apache.commons:commons-lang3:3.4' testCompile 'junit:junit:4.12' testCompile 'junit:junit-dep:4.11' @@ -80,16 +78,6 @@ test { } } -task versionInfo(type:Exec){ - commandLine 'git rev-parse HEAD'.split() - ext.versionfile = new File("${projectDir}/.gitrevision") - standardOutput = new ByteArrayOutputStream() - - doLast { - versionfile.text = "Azure/autorest#" + standardOutput.toString() - } -} - javadoc { options.encoding = 'UTF-8' } @@ -99,7 +87,7 @@ task sourcesJar(type: Jar, dependsOn:classes) { from sourceSets.main.allSource } -task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) { +task javadocJar(type: Jar, dependsOn: [javadoc]) { classifier = 'javadoc' from javadoc.destinationDir } @@ -107,7 +95,6 @@ task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) { artifacts { archives sourcesJar archives javadocJar - archives file: file("${projectDir}/.gitrevision") } test { diff --git a/ClientRuntimes/Java/client-runtime/pom.xml b/ClientRuntimes/Java/client-runtime/pom.xml new file mode 100644 index 0000000000000..e63a421434b38 --- /dev/null +++ b/ClientRuntimes/Java/client-runtime/pom.xml @@ -0,0 +1,121 @@ + + + 4.0.0 + + com.microsoft.azure + autorest-clientruntime-for-java + 1.0.0-SNAPSHOT + ../pom.xml + + + com.microsoft.rest + client-runtime + jar + + Java Client Runtime for AutoRest + This package contains the basic runtime for AutoRest generated Java clients. + https://github.com/Azure/autorest-clientruntime-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + scm:git:https://github.com/Azure/autorest-clientruntime-for-java + scm:git:git@github.com:Azure/autorest-clientruntime-for-java.git + HEAD + + + + UTF-8 + + + + + + microsoft + Microsoft + + + + + + com.google.guava + guava + + + com.squareup.retrofit2 + retrofit + + + com.squareup.okhttp3 + okhttp + + + com.squareup.okhttp3 + logging-interceptor + + + com.squareup.okhttp3 + okhttp-urlconnection + + + com.squareup.retrofit2 + converter-jackson + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + + + org.apache.commons + commons-lang3 + + + junit + junit + test + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/]]>
+
+
+ +
+
+
diff --git a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/AutoRestBaseUrl.java b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/AutoRestBaseUrl.java deleted file mode 100644 index d89aa6852f4fd..0000000000000 --- a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/AutoRestBaseUrl.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - */ - -package com.microsoft.rest; - -import java.util.HashMap; -import java.util.Map; - -import okhttp3.HttpUrl; -import retrofit2.BaseUrl; - -/** - * An instance of this class stores information of the host of a service. - */ -public class AutoRestBaseUrl implements BaseUrl { - /** A template based URL with variables wrapped in {}s. */ - private String template; - /** a mapping from {} wrapped variables in the template and their actual values. */ - private Map mappings; - - @Override - public HttpUrl url() { - String url = template; - for (Map.Entry entry : mappings.entrySet()) { - url = url.replace(entry.getKey(), entry.getValue()); - } - mappings.clear(); - return HttpUrl.parse(url); - } - - /** - * Creates an instance of a template based URL. - * - * @param url the template based URL to use. - */ - public AutoRestBaseUrl(String url) { - this.template = url; - this.mappings = new HashMap<>(); - } - - /** - * Sets the value for the {} wrapped variables in the template URL. - * @param matcher the {} wrapped variable to replace. - * @param value the value to set for the variable. - */ - public void set(CharSequence matcher, String value) { - this.mappings.put(matcher, value); - } -} diff --git a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/BaseUrlHandler.java b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/BaseUrlHandler.java new file mode 100644 index 0000000000000..46eacbd472e23 --- /dev/null +++ b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/BaseUrlHandler.java @@ -0,0 +1,45 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.rest; + +import java.io.IOException; + +import okhttp3.HttpUrl; +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +/** + * Handles dynamic replacements on base URL. The arguments must be in pairs + * with the string in raw URL to replace as replacements[i] and the dynamic + * part as replacements[i+1]. E.g. {subdomain}.microsoft.com can be set + * dynamically by setting header x-ms-parameterized-host: "{subdomain}, azure" + */ +public class BaseUrlHandler implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + String parameters = request.header("x-ms-parameterized-host"); + if (parameters != null && !parameters.isEmpty()) { + String[] replacements = parameters.split(", "); + if (replacements.length % 2 != 0) { + throw new IllegalArgumentException("Must provide a replacement value for each pattern"); + } + String baseUrl = request.url().toString(); + for (int i = 0; i < replacements.length; i += 2) { + baseUrl = baseUrl.replaceAll("(?i)\\Q" + replacements[i] + "\\E", replacements[i + 1]); + } + HttpUrl baseHttpUrl = HttpUrl.parse(baseUrl); + request = request.newBuilder() + .url(baseHttpUrl) + .removeHeader("x-ms-parameterized-host") + .build(); + } + return chain.proceed(request); + } +} diff --git a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/CustomHeadersInterceptor.java b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/CustomHeadersInterceptor.java new file mode 100644 index 0000000000000..00903b93a9e01 --- /dev/null +++ b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/CustomHeadersInterceptor.java @@ -0,0 +1,136 @@ +/** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + */ + +package com.microsoft.rest; + +import okhttp3.Headers; +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * An instance of this class enables adding custom headers in client requests + * when added to the {@link okhttp3.OkHttpClient} interceptors. + */ +public class CustomHeadersInterceptor implements Interceptor { + /** + * A mapping of custom headers. + */ + private Map> headers; + + /** + * Initialize an instance of {@link CustomHeadersInterceptor} class. + */ + public CustomHeadersInterceptor() { + headers = new HashMap>(); + } + + /** + * Initialize an instance of {@link CustomHeadersInterceptor} class. + * + * @param key the key for the header + * @param value the value of the header + */ + public CustomHeadersInterceptor(String key, String value) { + this(); + addHeader(key, value); + } + + /** + * Add a single header key-value pair. If one with the name already exists, + * it gets replaced. + * + * @param name the name of the header. + * @param value the value of the header. + * @return the interceptor instance itself. + */ + public CustomHeadersInterceptor replaceHeader(String name, String value) { + this.headers.put(name, new ArrayList()); + this.headers.get(name).add(value); + return this; + } + + /** + * Add a single header key-value pair. If one with the name already exists, + * both stay in the header map. + * + * @param name the name of the header. + * @param value the value of the header. + * @return the interceptor instance itself. + */ + public CustomHeadersInterceptor addHeader(String name, String value) { + if (!this.headers.containsKey(name)) { + this.headers.put(name, new ArrayList()); + } + this.headers.get(name).add(value); + return this; + } + + /** + * Add all headers in a {@link Headers} object. + * + * @param headers an OkHttp {@link Headers} object. + * @return the interceptor instance itself. + */ + public CustomHeadersInterceptor addHeaders(Headers headers) { + this.headers.putAll(headers.toMultimap()); + return this; + } + + /** + * Add all headers in a header map. + * + * @param headers a map of headers. + * @return the interceptor instance itself. + */ + public CustomHeadersInterceptor addHeaderMap(Map headers) { + for (Map.Entry header : headers.entrySet()) { + this.headers.put(header.getKey(), Collections.singletonList(header.getValue())); + } + return this; + } + + /** + * Add all headers in a header multimap. + * + * @param headers a multimap of headers. + * @return the interceptor instance itself. + */ + public CustomHeadersInterceptor addHeaderMultimap(Map> headers) { + this.headers.putAll(headers); + return this; + } + + /** + * Remove a header. + * + * @param name the name of the header to remove. + * @return the interceptor instance itself. + */ + public CustomHeadersInterceptor removeHeader(String name) { + this.headers.remove(name); + return this; + } + + @Override + public Response intercept(Chain chain) throws IOException { + Request.Builder builder = chain.request().newBuilder(); + for (Map.Entry> header : headers.entrySet()) { + for (String value : header.getValue()) { + builder = builder.header(header.getKey(), value); + } + } + return chain.proceed(builder.build()); + } +} diff --git a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/AutoRestException.java b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/RestException.java similarity index 79% rename from ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/AutoRestException.java rename to ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/RestException.java index 72db4288ab3a4..cf5dff556aea0 100644 --- a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/AutoRestException.java +++ b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/RestException.java @@ -10,18 +10,18 @@ /** * Exception thrown for an invalid response with custom error information. */ -public abstract class AutoRestException extends Exception { +public abstract class RestException extends Exception { /** * Initializes a new instance of the AutoRestException class. */ - public AutoRestException() { } + public RestException() { } /** * Initializes a new instance of the AutoRestException class. * * @param message The exception message. */ - public AutoRestException(String message) { + public RestException(String message) { super(message); } @@ -30,7 +30,7 @@ public AutoRestException(String message) { * * @param cause exception that caused this exception to occur */ - public AutoRestException(Throwable cause) { + public RestException(Throwable cause) { super(cause); } @@ -40,7 +40,7 @@ public AutoRestException(Throwable cause) { * @param message the exception message * @param cause exception that caused this exception to occur */ - public AutoRestException(String message, Throwable cause) { + public RestException(String message, Throwable cause) { super(message, cause); } } diff --git a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceClient.java b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceClient.java index a0655bc3ab792..8311a243de139 100644 --- a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceClient.java +++ b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceClient.java @@ -12,106 +12,77 @@ import java.net.CookieManager; import java.net.CookiePolicy; -import java.util.List; -import okhttp3.Interceptor; import okhttp3.JavaNetCookieJar; import okhttp3.OkHttpClient; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; import retrofit2.Retrofit; /** * ServiceClient is the abstraction for accessing REST operations and their payload data types. */ public abstract class ServiceClient { - /** - * The builder for building the OkHttp client. - */ - protected OkHttpClient.Builder clientBuilder; - - /** - * The builder for building Retrofit services. - */ - protected Retrofit.Builder retrofitBuilder; - - /** - * The adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations. - */ - protected JacksonMapperAdapter mapperAdapter; + /** The HTTP client. */ + private OkHttpClient httpClient; + /** The Retrofit instance. */ + private Retrofit retrofit; + /** The adapter to a Jackson {@link com.fasterxml.jackson.databind.ObjectMapper}. */ + private JacksonMapperAdapter mapperAdapter; /** * Initializes a new instance of the ServiceClient class. + * + * @param baseUrl the service endpoint */ - protected ServiceClient() { - this(new OkHttpClient.Builder(), new Retrofit.Builder()); + protected ServiceClient(String baseUrl) { + this(baseUrl, new OkHttpClient.Builder(), new Retrofit.Builder()); } /** * Initializes a new instance of the ServiceClient class. * - * @param clientBuilder the builder to build up an OkHttp client - * @param retrofitBuilder the builder to build up a rest adapter */ - protected ServiceClient(OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) { + protected ServiceClient(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder) { if (clientBuilder == null) { throw new IllegalArgumentException("clientBuilder == null"); } - if (retrofitBuilder == null) { - throw new IllegalArgumentException("retrofitBuilder == null"); + if (restBuilder == null) { + throw new IllegalArgumentException("restBuilder == null"); } - - this.clientBuilder = clientBuilder; - this.retrofitBuilder = retrofitBuilder; + this.mapperAdapter = new JacksonMapperAdapter(); + CookieManager cookieManager = new CookieManager(); + cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL); + this.httpClient = clientBuilder + .cookieJar(new JavaNetCookieJar(cookieManager)) + .addInterceptor(new UserAgentInterceptor()) + .addInterceptor(new BaseUrlHandler()) + .addInterceptor(new CustomHeadersInterceptor()) + .addInterceptor(new RetryHandler()) + .build(); + this.retrofit = restBuilder + .baseUrl(baseUrl) + .client(httpClient) + .addConverterFactory(mapperAdapter.getConverterFactory()) + .build(); } /** - * Get the list of interceptors the OkHttp client will execute. - * @return the list of interceptors + * @return the Retrofit instance. */ - public List getClientInterceptors() { - return this.clientBuilder.interceptors(); + public Retrofit retrofit() { + return this.retrofit; } /** - * Sets the logging level for OkHttp client. - * - * @param logLevel the logging level enum + * @return the HTTP client. */ - public void setLogLevel(Level logLevel) { - HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(logLevel); - this.getClientInterceptors().add(loggingInterceptor); + public OkHttpClient httpClient() { + return this.httpClient; } /** - * Gets the adapter for {@link com.fasterxml.jackson.databind.ObjectMapper} for serialization - * and deserialization operations.. - * - * @return the adapter. + * @return the adapter to a Jackson {@link com.fasterxml.jackson.databind.ObjectMapper}. */ - public JacksonMapperAdapter getMapperAdapter() { + public JacksonMapperAdapter mapperAdapter() { return this.mapperAdapter; } - - /** - * This method initializes the builders for Http client and Retrofit with common - * behaviors for all service clients. - */ - protected void initialize() { - // Add retry handler - CookieManager cookieManager = new CookieManager(); - cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL); - - // Set up OkHttp client - this.clientBuilder = clientBuilder - .cookieJar(new JavaNetCookieJar(cookieManager)) - .addInterceptor(new RetryHandler()) - .addInterceptor(new UserAgentInterceptor()); - // Set up rest adapter - this.mapperAdapter = new JacksonMapperAdapter(); - this.retrofitBuilder = retrofitBuilder - .addConverterFactory(mapperAdapter.getConverterFactory()); - } } diff --git a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceException.java b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceException.java index bf187c9d043a0..c041ae3bda3ab 100644 --- a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceException.java +++ b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceException.java @@ -12,7 +12,7 @@ /** * Exception thrown for an invalid response with custom error information. */ -public class ServiceException extends AutoRestException { +public class ServiceException extends RestException { /** * Information about the associated HTTP response. */ diff --git a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceResponseBuilder.java b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceResponseBuilder.java index 1fae7e4e9fe51..3ad57cb938f40 100644 --- a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceResponseBuilder.java +++ b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/ServiceResponseBuilder.java @@ -27,7 +27,7 @@ * @param The return type the caller expects from the REST response. * @param the exception to throw in case of error. */ -public class ServiceResponseBuilder { +public class ServiceResponseBuilder { /** * A mapping of HTTP status codes and their corresponding return types. */ @@ -36,7 +36,7 @@ public class ServiceResponseBuilder { /** * The exception type to thrown in case of error. */ - protected Class exceptionType; + protected Class exceptionType; /** * The mapperAdapter used for deserializing the response. @@ -83,7 +83,7 @@ public ServiceResponseBuilder register(int statusCode, final Type type) { * @param type the type to deserialize. * @return the same builder instance. */ - public ServiceResponseBuilder registerError(final Class type) { + public ServiceResponseBuilder registerError(final Class type) { this.exceptionType = type; try { Field f = type.getDeclaredField("body"); @@ -132,7 +132,7 @@ public ServiceResponse build(Response response) throws E, IOExc int statusCode = response.code(); ResponseBody responseBody; - if (response.isSuccess()) { + if (response.isSuccessful()) { responseBody = response.body(); } else { responseBody = response.errorBody(); @@ -140,7 +140,7 @@ public ServiceResponse build(Response response) throws E, IOExc if (responseTypes.containsKey(statusCode)) { return new ServiceResponse<>((T) buildBody(statusCode, responseBody), response); - } else if (response.isSuccess() && responseTypes.size() == 1) { + } else if (response.isSuccessful() && responseTypes.size() == 1) { return new ServiceResponse<>((T) buildBody(statusCode, responseBody), response); } else { try { @@ -175,7 +175,7 @@ public ServiceResponse buildEmpty(Response response) throws E, IOExcept int statusCode = response.code(); if (responseTypes.containsKey(statusCode)) { return new ServiceResponse<>(response); - } else if (response.isSuccess() && responseTypes.size() == 1) { + } else if (response.isSuccessful() && responseTypes.size() == 1) { return new ServiceResponse<>(response); } else { try { diff --git a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/UserAgentInterceptor.java b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/UserAgentInterceptor.java index 4c6c4f6ca5dff..7b822078d79ab 100644 --- a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/UserAgentInterceptor.java +++ b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/UserAgentInterceptor.java @@ -10,7 +10,6 @@ import okhttp3.Interceptor; import okhttp3.Request; import okhttp3.Response; -import okhttp3.internal.Version; import java.io.IOException; @@ -33,28 +32,48 @@ public class UserAgentInterceptor implements Interceptor { * 'User-Agent' header. */ public UserAgentInterceptor() { - this(DEFAULT_USER_AGENT_HEADER); + this.userAgent = DEFAULT_USER_AGENT_HEADER; } /** - * Initialize an instance of {@link UserAgentInterceptor} class with the specified - * 'User-Agent' header. + * Overwrite the User-Agent header. * - * @param userAgent the 'User-Agent' header value. + * @param userAgent the new user agent value. + * @return the user agent interceptor itself */ - public UserAgentInterceptor(String userAgent) { + public UserAgentInterceptor withUserAgent(String userAgent) { this.userAgent = userAgent; + return this; + } + + /** + * Append a text to the User-Agent header. + * + * @param userAgent the user agent value to append. + * @return the user agent interceptor itself + */ + public UserAgentInterceptor appendUserAgent(String userAgent) { + this.userAgent += " " + userAgent; + return this; } @Override public Response intercept(Chain chain) throws IOException { Request request = chain.request(); String header = request.header("User-Agent"); - if (header == null || header.equals(Version.userAgent()) || header.equals(DEFAULT_USER_AGENT_HEADER)) { - request = chain.request().newBuilder() - .header("User-Agent", userAgent) - .build(); + if (header == null) { + header = DEFAULT_USER_AGENT_HEADER; + } + if (!userAgent.equals(DEFAULT_USER_AGENT_HEADER)) { + if (header.equals(DEFAULT_USER_AGENT_HEADER)) { + header = userAgent; + } else { + header = userAgent + " " + header; + } } + request = chain.request().newBuilder() + .header("User-Agent", header) + .build(); return chain.proceed(request); } } diff --git a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/serializer/JacksonMapperAdapter.java b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/serializer/JacksonMapperAdapter.java index ae2af3c5f6ace..a59247207502b 100644 --- a/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/serializer/JacksonMapperAdapter.java +++ b/ClientRuntimes/Java/client-runtime/src/main/java/com/microsoft/rest/serializer/JacksonMapperAdapter.java @@ -62,7 +62,8 @@ protected void initializeObjectMapper(ObjectMapper mapper) { mapper.setVisibility(mapper.getSerializationConfig().getDefaultVisibilityChecker() .withFieldVisibility(JsonAutoDetect.Visibility.ANY) .withSetterVisibility(JsonAutoDetect.Visibility.NONE) - .withGetterVisibility(JsonAutoDetect.Visibility.NONE)); + .withGetterVisibility(JsonAutoDetect.Visibility.NONE) + .withIsGetterVisibility(JsonAutoDetect.Visibility.NONE)); } /** diff --git a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/CredentialsTests.java b/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/CredentialsTests.java index 296c7c9100956..d21de3ef9bd1e 100644 --- a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/CredentialsTests.java +++ b/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/CredentialsTests.java @@ -9,50 +9,63 @@ import com.microsoft.rest.credentials.BasicAuthenticationCredentials; import com.microsoft.rest.credentials.TokenCredentials; -import okhttp3.Interceptor; -import okhttp3.Protocol; -import okhttp3.Response; + import org.junit.Assert; import org.junit.Test; import java.io.IOException; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Protocol; +import okhttp3.Request; +import okhttp3.Response; +import retrofit2.Retrofit; + public class CredentialsTests { @Test public void basicCredentialsTest() throws Exception { - ServiceClient serviceClient = new ServiceClient() { }; BasicAuthenticationCredentials credentials = new BasicAuthenticationCredentials("user", "pass"); - credentials.applyCredentialsFilter(serviceClient.clientBuilder); - serviceClient.getClientInterceptors().add(new Interceptor() { - @Override - public Response intercept(Chain chain) throws IOException { - String header = chain.request().header("Authorization"); - Assert.assertEquals("Basic dXNlcjpwYXNz", header); - return new Response.Builder() - .request(chain.request()) - .code(200) - .protocol(Protocol.HTTP_1_1) - .build(); - } - }); + OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); + credentials.applyCredentialsFilter(clientBuilder); + clientBuilder.addInterceptor( + new Interceptor() { + @Override + public Response intercept(Chain chain) throws IOException { + String header = chain.request().header("Authorization"); + Assert.assertEquals("Basic dXNlcjpwYXNz", header); + return new Response.Builder() + .request(chain.request()) + .code(200) + .protocol(Protocol.HTTP_1_1) + .build(); + } + }); + ServiceClient serviceClient = new ServiceClient("http://localhost", clientBuilder, new Retrofit.Builder()) { }; + Response response = serviceClient.httpClient().newCall(new Request.Builder().url("http://localhost").build()).execute(); + Assert.assertEquals(200, response.code()); } @Test public void tokenCredentialsTest() throws Exception { - ServiceClient serviceClient = new ServiceClient() { }; TokenCredentials credentials = new TokenCredentials(null, "this_is_a_token"); - credentials.applyCredentialsFilter(serviceClient.clientBuilder); - serviceClient.getClientInterceptors().add(new Interceptor() { - @Override - public Response intercept(Chain chain) throws IOException { - String header = chain.request().header("Authorization"); - Assert.assertEquals("Bearer this_is_a_token", header); - return new Response.Builder() - .request(chain.request()) - .code(200) - .protocol(Protocol.HTTP_1_1) - .build(); - } - }); + OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); + credentials.applyCredentialsFilter(clientBuilder); + clientBuilder.addInterceptor( + new Interceptor() { + @Override + public Response intercept(Chain chain) throws IOException { + String header = chain.request().header("Authorization"); + Assert.assertEquals("Bearer this_is_a_token", header); + return new Response.Builder() + .request(chain.request()) + .code(200) + .protocol(Protocol.HTTP_1_1) + .build(); + } + }); + ServiceClient serviceClient = new ServiceClient("http://localhost", clientBuilder, new Retrofit.Builder()) { }; + Response response = serviceClient.httpClient().newCall(new Request.Builder().url("http://localhost").build()).execute(); + Assert.assertEquals(200, response.code()); } } diff --git a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/RetryHandlerTests.java b/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/RetryHandlerTests.java index 4291450c27d19..068e57b214323 100644 --- a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/RetryHandlerTests.java +++ b/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/RetryHandlerTests.java @@ -9,21 +9,25 @@ import com.microsoft.rest.retry.RetryHandler; -import okhttp3.Interceptor; -import okhttp3.Protocol; -import okhttp3.Request; -import okhttp3.Response; import org.junit.Assert; import org.junit.Test; import java.io.IOException; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Protocol; +import okhttp3.Request; +import okhttp3.Response; +import retrofit2.Retrofit; + public class RetryHandlerTests { @Test public void exponentialRetryEndOn501() throws Exception { - ServiceClient serviceClient = new ServiceClient() { }; - serviceClient.getClientInterceptors().add(new RetryHandler()); - serviceClient.getClientInterceptors().add(new Interceptor() { + OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); + Retrofit.Builder retrofitBuilder = new Retrofit.Builder(); + clientBuilder.addInterceptor(new RetryHandler()); + clientBuilder.addInterceptor(new Interceptor() { // Send 408, 500, 502, all retried, with a 501 ending private int[] codes = new int[]{408, 500, 502, 501}; private int count = 0; @@ -37,18 +41,21 @@ public Response intercept(Chain chain) throws IOException { .build(); } }); - Response response = serviceClient.clientBuilder.build().newCall( + ServiceClient serviceClient = new ServiceClient("http://localhost", clientBuilder, retrofitBuilder) { }; + Response response = serviceClient.httpClient().newCall( new Request.Builder().url("http://localhost").get().build()).execute(); Assert.assertEquals(501, response.code()); } @Test public void exponentialRetryMax() throws Exception { - ServiceClient serviceClient = new ServiceClient() { }; - serviceClient.getClientInterceptors().add(new RetryHandler()); - serviceClient.getClientInterceptors().add(new Interceptor() { + OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); + Retrofit.Builder retrofitBuilder = new Retrofit.Builder(); + clientBuilder.addInterceptor(new RetryHandler()); + clientBuilder.addInterceptor(new Interceptor() { // Send 500 until max retry is hit private int count = 0; + @Override public Response intercept(Chain chain) throws IOException { Assert.assertTrue(count++ < 5); @@ -59,7 +66,8 @@ public Response intercept(Chain chain) throws IOException { .build(); } }); - Response response = serviceClient.clientBuilder.build().newCall( + ServiceClient serviceClient = new ServiceClient("http://localhost", clientBuilder, retrofitBuilder) { }; + Response response = serviceClient.httpClient().newCall( new Request.Builder().url("http://localhost").get().build()).execute(); Assert.assertEquals(500, response.code()); } diff --git a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/ServiceClientTests.java b/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/ServiceClientTests.java index f30127974005e..9d76292d20a03 100644 --- a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/ServiceClientTests.java +++ b/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/ServiceClientTests.java @@ -7,27 +7,40 @@ package com.microsoft.rest; -import okhttp3.Interceptor; -import okhttp3.Response; import org.junit.Assert; import org.junit.Test; import java.io.IOException; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Protocol; +import okhttp3.Request; +import okhttp3.Response; +import retrofit2.Retrofit; + public class ServiceClientTests { @Test public void filterTests() throws Exception { - ServiceClient serviceClient = new ServiceClient() { }; - serviceClient.getClientInterceptors().add(0, new FirstFilter()); - serviceClient.getClientInterceptors().add(1, new SecondFilter()); - serviceClient.getClientInterceptors().add(new Interceptor() { + OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); + Retrofit.Builder retrofitBuilder = new Retrofit.Builder(); + clientBuilder.interceptors().add(0, new FirstFilter()); + clientBuilder.interceptors().add(1, new SecondFilter()); + clientBuilder.interceptors().add(new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Assert.assertEquals("1", chain.request().header("filter1")); Assert.assertEquals("2", chain.request().header("filter2")); - return chain.proceed(chain.request()); + return new Response.Builder() + .request(chain.request()) + .code(200) + .protocol(Protocol.HTTP_1_1) + .build(); } }); + ServiceClient serviceClient = new ServiceClient("http://localhost", clientBuilder, retrofitBuilder) { }; + Response response = serviceClient.httpClient().newCall(new Request.Builder().url("http://localhost").build()).execute(); + Assert.assertEquals(200, response.code()); } public class FirstFilter implements Interceptor { diff --git a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/UserAgentTests.java b/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/UserAgentTests.java index ce06a25b88698..9aa60e5b26313 100644 --- a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/UserAgentTests.java +++ b/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/UserAgentTests.java @@ -7,47 +7,60 @@ package com.microsoft.rest; -import okhttp3.Interceptor; -import okhttp3.Protocol; -import okhttp3.Response; import org.junit.Assert; import org.junit.Test; import java.io.IOException; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Protocol; +import okhttp3.Request; +import okhttp3.Response; +import retrofit2.Retrofit; + public class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { - ServiceClient serviceClient = new ServiceClient() { }; - serviceClient.getClientInterceptors().add(new Interceptor() { - @Override - public Response intercept(Chain chain) throws IOException { - String header = chain.request().header("User-Agent"); - Assert.assertEquals("AutoRest-Java", header); - return new Response.Builder() - .request(chain.request()) - .code(200) - .protocol(Protocol.HTTP_1_1) - .build(); - } - }); + OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder() + .addInterceptor(new UserAgentInterceptor()) + .addInterceptor(new Interceptor() { + @Override + public Response intercept(Chain chain) throws IOException { + String header = chain.request().header("User-Agent"); + Assert.assertEquals("AutoRest-Java", header); + return new Response.Builder() + .request(chain.request()) + .code(200) + .protocol(Protocol.HTTP_1_1) + .build(); + } + }); + ServiceClient serviceClient = new ServiceClient("http://localhost", clientBuilder, new Retrofit.Builder()) { }; + Response response = serviceClient.httpClient() + .newCall(new Request.Builder().get().url("http://localhost").build()).execute(); + Assert.assertEquals(200, response.code()); } @Test public void customUserAgentTests() throws Exception { - ServiceClient serviceClient = new ServiceClient() { }; - serviceClient.getClientInterceptors().add(new UserAgentInterceptor("Awesome")); - serviceClient.getClientInterceptors().add(new Interceptor() { - @Override - public Response intercept(Chain chain) throws IOException { - String header = chain.request().header("User-Agent"); - Assert.assertEquals("Awesome", header); - return new Response.Builder() - .request(chain.request()) - .code(200) - .protocol(Protocol.HTTP_1_1) - .build(); - } - }); + OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder() + .addInterceptor(new UserAgentInterceptor().withUserAgent("Awesome")) + .addInterceptor(new Interceptor() { + @Override + public Response intercept(Chain chain) throws IOException { + String header = chain.request().header("User-Agent"); + Assert.assertEquals("Awesome", header); + return new Response.Builder() + .request(chain.request()) + .code(200) + .protocol(Protocol.HTTP_1_1) + .build(); + } + }); + ServiceClient serviceClient = new ServiceClient("http://localhost", clientBuilder, new Retrofit.Builder()) { }; + Response response = serviceClient.httpClient() + .newCall(new Request.Builder().get().url("http://localhost").build()).execute(); + Assert.assertEquals(200, response.code()); } } diff --git a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/package-info.java b/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/package-info.java deleted file mode 100644 index 137d82e99154e..0000000000000 --- a/ClientRuntimes/Java/client-runtime/src/test/java/com/microsoft/rest/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * The package contains the tests for the client runtime. - */ -package com.microsoft.rest; \ No newline at end of file diff --git a/ClientRuntimes/Java/pom.xml b/ClientRuntimes/Java/pom.xml new file mode 100644 index 0000000000000..aa77260c5893f --- /dev/null +++ b/ClientRuntimes/Java/pom.xml @@ -0,0 +1,220 @@ + + + 4.0.0 + + com.microsoft.azure + autorest-clientruntime-for-java + 1.0.0-SNAPSHOT + pom + + AutoRest Client Runtimes for Java + This package contains the runtimes for AutoRest generated Java clients. + https://github.com/Azure/autorest-clientruntime-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + scm:git:https://github.com/Azure/autorest-clientruntime-for-java + scm:git:git@github.com:Azure/autorest-clientruntime-for-java.git + HEAD + + + + UTF-8 + + + + + + microsoft + Microsoft + + + + + + ossrh + Sonatype Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + default + + true + always + + + + + + + ossrh + Maven Central Snapshots + https://oss.sonatype.org/content/repositories/snapshots + true + default + + + ossrh + Maven Central + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + + com.google.guava + guava + 18.0 + + + com.squareup.retrofit2 + retrofit + 2.0.2 + + + com.squareup.okhttp3 + okhttp + 3.3.1 + + + com.squareup.okhttp3 + logging-interceptor + 3.3.1 + + + com.squareup.okhttp3 + okhttp-urlconnection + 3.3.1 + + + com.squareup.retrofit2 + converter-jackson + 2.0.2 + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + 2.7.2 + + + org.apache.commons + commons-lang3 + 3.4 + + + com.microsoft.azure + adal4j + 1.1.2 + + + com.microsoft.aad + adal + 1.1.11 + + + junit + junit + 4.12 + test + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.17 + + + com.microsoft.azure + autorest-build-tools + 1.0.0-SNAPSHOT + + + com.puppycrawl.tools + checkstyle + 6.18 + + + + checkstyle.xml + samedir=build-tools/src/main/resources + suppressions.xml + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + true + true + -Xlint:unchecked + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/]]>
+
+
+
+ + + + org.apache.maven.plugins + maven-resources-plugin + 2.4.3 + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.18.1 + + + **/Test*.java + **/*Test.java + **/*Tests.java + **/*TestCase.java + + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.2 + + + +
+ + build-tools + client-runtime + azure-client-runtime + azure-client-authentication + +
diff --git a/CodeGenerator.sln b/CodeGenerator.sln index 2e1b839e94d3f..9606830c88ca9 100644 --- a/CodeGenerator.sln +++ b/CodeGenerator.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Core", "AutoRest\AutoRest.Core\AutoRest.Core.csproj", "{C876085F-9DC3-41F0-B7B4-17022CD84684}" EndProject @@ -109,6 +109,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.AzureRes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.AzureResourceSchema.Tests", "AutoRest\Generators\AzureResourceSchema\AzureResourceSchema.Tests\AutoRest.Generator.AzureResourceSchema.Tests.csproj", "{1C3B4A33-E045-4C8F-9202-1B651A686567}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRest.Generator.Azure.Java.Fluent", "AutoRest\Generators\Java\Azure.Java.Fluent\AutoRest.Generator.Azure.Java.Fluent.csproj", "{D35E97FD-E360-4DAA-96D0-DA45F32150B9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Net45-Debug|Any CPU = Net45-Debug|Any CPU @@ -333,6 +335,14 @@ Global {1C3B4A33-E045-4C8F-9202-1B651A686567}.Portable-Debug|Any CPU.Build.0 = Debug|Any CPU {1C3B4A33-E045-4C8F-9202-1B651A686567}.Portable-Release|Any CPU.ActiveCfg = Release|Any CPU {1C3B4A33-E045-4C8F-9202-1B651A686567}.Portable-Release|Any CPU.Build.0 = Release|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Portable-Debug|Any CPU.Build.0 = Portable-Debug|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU + {D35E97FD-E360-4DAA-96D0-DA45F32150B9}.Portable-Release|Any CPU.Build.0 = Portable-Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -371,5 +381,6 @@ Global {B6A1FC1E-0779-4900-84EE-262DD0E53FF4} = {EF9E346D-70C6-45F5-8FF9-9B734F4A1298} {654344A5-0556-49C7-BFB3-59676D7440D3} = {B6A1FC1E-0779-4900-84EE-262DD0E53FF4} {1C3B4A33-E045-4C8F-9202-1B651A686567} = {B6A1FC1E-0779-4900-84EE-262DD0E53FF4} + {D35E97FD-E360-4DAA-96D0-DA45F32150B9} = {A9C01442-1E93-4C2D-9182-B61C9F53C3FF} EndGlobalSection EndGlobal diff --git a/Samples/azure-storage/Azure.Java/StorageAccounts.java b/Samples/azure-storage/Azure.Java/StorageAccounts.java new file mode 100644 index 0000000000000..69c8312d15de4 --- /dev/null +++ b/Samples/azure-storage/Azure.Java/StorageAccounts.java @@ -0,0 +1,256 @@ +/** + */ + +package petstore; + +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import petstore.models.CheckNameAvailabilityResult; +import petstore.models.StorageAccount; +import petstore.models.StorageAccountCheckNameAvailabilityParameters; +import petstore.models.StorageAccountCreateParameters; +import petstore.models.StorageAccountKeys; +import petstore.models.StorageAccountRegenerateKeyParameters; +import petstore.models.StorageAccountUpdateParameters; + +/** + * An instance of this class provides access to all the operations defined + * in StorageAccounts. + */ +public interface StorageAccounts { + /** + * Checks that account name is valid and is not in use. + * + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the CheckNameAvailabilityResult object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse checkNameAvailability(StorageAccountCheckNameAvailabilityParameters accountName) throws CloudException, IOException, IllegalArgumentException; + + /** + * Checks that account name is valid and is not in use. + * + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall checkNameAvailabilityAsync(StorageAccountCheckNameAvailabilityParameters accountName, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide for the created account. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the StorageAccount object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse create(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) throws CloudException, IOException, IllegalArgumentException, InterruptedException; + + /** + * Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide for the created account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall createAsync(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide for the created account. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccount object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse beginCreate(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) throws CloudException, IOException, IllegalArgumentException; + + /** + * Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide for the created account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall beginCreateAsync(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Deletes a storage account in Microsoft Azure. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + ServiceResponse delete(String resourceGroupName, String accountName) throws CloudException, IOException, IllegalArgumentException; + + /** + * Deletes a storage account in Microsoft Azure. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall deleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccount object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse getProperties(String resourceGroupName, String accountName) throws CloudException, IOException, IllegalArgumentException; + + /** + * Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall getPropertiesAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. In order to replace a custom domain, the old value must be cleared before a new value may be set. To clear a custom domain, simply update the custom domain with empty string. Then call update again with the new cutsom domain name. The update API can only be used to update one of tags, accountType, or customDomain per call. To update multiple of these properties, call the API multiple times with one change per call. This call does not change the storage keys for the account. If you want to change storage account keys, use the RegenerateKey operation. The location and name of the storage account cannot be changed after creation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to update on the account. Note that only one property can be changed at a time using this API. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccount object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse update(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters) throws CloudException, IOException, IllegalArgumentException; + + /** + * Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. In order to replace a custom domain, the old value must be cleared before a new value may be set. To clear a custom domain, simply update the custom domain with empty string. Then call update again with the new cutsom domain name. The update API can only be used to update one of tags, accountType, or customDomain per call. To update multiple of these properties, call the API multiple times with one change per call. This call does not change the storage keys for the account. If you want to change storage account keys, use the RegenerateKey operation. The location and name of the storage account cannot be changed after creation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to update on the account. Note that only one property can be changed at a time using this API. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall updateAsync(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Lists the access keys for the specified storage account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the storage account. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccountKeys object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse listKeys(String resourceGroupName, String accountName) throws CloudException, IOException, IllegalArgumentException; + + /** + * Lists the access keys for the specified storage account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the storage account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall listKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) throws IllegalArgumentException; + + /** + * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<StorageAccount> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + + /** + * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall listAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<StorageAccount> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> listByResourceGroup(String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + + /** + * Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) throws IllegalArgumentException; + + /** + * Regenerates the access keys for the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param regenerateKey Specifies name of the key which should be regenerated. key1 or key2 for the default keys + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccountKeys object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse regenerateKey(String resourceGroupName, String accountName, StorageAccountRegenerateKeyParameters regenerateKey) throws CloudException, IOException, IllegalArgumentException; + + /** + * Regenerates the access keys for the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param regenerateKey Specifies name of the key which should be regenerated. key1 or key2 for the default keys + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall regenerateKeyAsync(String resourceGroupName, String accountName, StorageAccountRegenerateKeyParameters regenerateKey, final ServiceCallback serviceCallback) throws IllegalArgumentException; + +} diff --git a/Samples/azure-storage/Azure.Java/StorageAccountsImpl.java b/Samples/azure-storage/Azure.Java/StorageAccountsImpl.java new file mode 100644 index 0000000000000..64c3963573169 --- /dev/null +++ b/Samples/azure-storage/Azure.Java/StorageAccountsImpl.java @@ -0,0 +1,894 @@ +/** + */ + +package petstore; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import petstore.models.CheckNameAvailabilityResult; +import petstore.models.PageImpl; +import petstore.models.StorageAccount; +import petstore.models.StorageAccountCheckNameAvailabilityParameters; +import petstore.models.StorageAccountCreateParameters; +import petstore.models.StorageAccountKeys; +import petstore.models.StorageAccountRegenerateKeyParameters; +import petstore.models.StorageAccountUpdateParameters; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import retrofit2.Retrofit; + +/** + * An instance of this class provides access to all the operations defined + * in StorageAccounts. + */ +public final class StorageAccountsImpl implements StorageAccounts { + /** The Retrofit service to perform REST calls. */ + private StorageAccountsService service; + /** The service client containing this operation class. */ + private StorageManagementClient client; + + /** + * Initializes an instance of StorageAccounts. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public StorageAccountsImpl(Retrofit retrofit, StorageManagementClient client) { + this.service = retrofit.create(StorageAccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for StorageAccounts to be + * used by Retrofit to perform actually REST calls. + */ + interface StorageAccountsService { + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability") + Call checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Body StorageAccountCheckNameAvailabilityParameters accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}") + Call create(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body StorageAccountCreateParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}") + Call beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body StorageAccountCreateParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", method = "DELETE", hasBody = true) + Call delete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}") + Call getProperties(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + @Headers("Content-Type: application/json; charset=utf-8") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}") + Call update(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body StorageAccountUpdateParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys") + Call listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts") + Call list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts") + Call listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey") + Call regenerateKey(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body StorageAccountRegenerateKeyParameters regenerateKey, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + } + + /** + * Checks that account name is valid and is not in use. + * + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the CheckNameAvailabilityResult object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse checkNameAvailability(StorageAccountCheckNameAvailabilityParameters accountName) throws CloudException, IOException, IllegalArgumentException { + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Validator.validate(accountName); + Call call = service.checkNameAvailability(this.client.getSubscriptionId(), accountName, this.client.getApiVersion(), this.client.getAcceptLanguage()); + return checkNameAvailabilityDelegate(call.execute()); + } + + /** + * Checks that account name is valid and is not in use. + * + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall checkNameAvailabilityAsync(StorageAccountCheckNameAvailabilityParameters accountName, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (accountName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Validator.validate(accountName, serviceCallback); + Call call = service.checkNameAvailability(this.client.getSubscriptionId(), accountName, this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(checkNameAvailabilityDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide for the created account. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @throws InterruptedException exception thrown when long running operation is interrupted + * @return the StorageAccount object wrapped in ServiceResponse if successful. + */ + public ServiceResponse create(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) throws CloudException, IOException, IllegalArgumentException, InterruptedException { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Response result = service.create(resourceGroupName, accountName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); + return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() { }.getType()); + } + + /** + * Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide for the created account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + public ServiceCall createAsync(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (resourceGroupName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + } + Validator.validate(parameters, serviceCallback); + Call call = service.create(resourceGroupName, accountName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, Throwable t) { + serviceCallback.failure(t); + } + @Override + public void onResponse(Call call, Response response) { + client.getAzureClient().getPutOrPatchResultAsync(response, new TypeToken() { }.getType(), serviceCall, serviceCallback); + } + }); + return serviceCall; + } + + /** + * Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide for the created account. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccount object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse beginCreate(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) throws CloudException, IOException, IllegalArgumentException { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Call call = service.beginCreate(resourceGroupName, accountName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); + return beginCreateDelegate(call.execute()); + } + + /** + * Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to provide for the created account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall beginCreateAsync(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (resourceGroupName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + return null; + } + if (accountName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + return null; + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (parameters == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Validator.validate(parameters, serviceCallback); + Call call = service.beginCreate(resourceGroupName, accountName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(beginCreateDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a storage account in Microsoft Azure. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the {@link ServiceResponse} object if successful. + */ + public ServiceResponse delete(String resourceGroupName, String accountName) throws CloudException, IOException, IllegalArgumentException { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Call call = service.delete(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + return deleteDelegate(call.execute()); + } + + /** + * Deletes a storage account in Microsoft Azure. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall deleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (resourceGroupName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + return null; + } + if (accountName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + return null; + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Call call = service.delete(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(deleteDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .build(response); + } + + /** + * Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccount object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse getProperties(String resourceGroupName, String accountName) throws CloudException, IOException, IllegalArgumentException { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Call call = service.getProperties(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + return getPropertiesDelegate(call.execute()); + } + + /** + * Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall getPropertiesAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (resourceGroupName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + return null; + } + if (accountName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + return null; + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Call call = service.getProperties(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(getPropertiesDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse getPropertiesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. In order to replace a custom domain, the old value must be cleared before a new value may be set. To clear a custom domain, simply update the custom domain with empty string. Then call update again with the new cutsom domain name. The update API can only be used to update one of tags, accountType, or customDomain per call. To update multiple of these properties, call the API multiple times with one change per call. This call does not change the storage keys for the account. If you want to change storage account keys, use the RegenerateKey operation. The location and name of the storage account cannot be changed after creation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to update on the account. Note that only one property can be changed at a time using this API. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccount object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse update(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters) throws CloudException, IOException, IllegalArgumentException { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Call call = service.update(resourceGroupName, accountName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); + return updateDelegate(call.execute()); + } + + /** + * Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. In order to replace a custom domain, the old value must be cleared before a new value may be set. To clear a custom domain, simply update the custom domain with empty string. Then call update again with the new cutsom domain name. The update API can only be used to update one of tags, accountType, or customDomain per call. To update multiple of these properties, call the API multiple times with one change per call. This call does not change the storage keys for the account. If you want to change storage account keys, use the RegenerateKey operation. The location and name of the storage account cannot be changed after creation. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The parameters to update on the account. Note that only one property can be changed at a time using this API. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall updateAsync(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (resourceGroupName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + return null; + } + if (accountName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + return null; + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (parameters == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Validator.validate(parameters, serviceCallback); + Call call = service.update(resourceGroupName, accountName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(updateDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the access keys for the specified storage account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the storage account. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccountKeys object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse listKeys(String resourceGroupName, String accountName) throws CloudException, IOException, IllegalArgumentException { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Call call = service.listKeys(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + return listKeysDelegate(call.execute()); + } + + /** + * Lists the access keys for the specified storage account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the storage account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall listKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (resourceGroupName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + return null; + } + if (accountName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + return null; + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Call call = service.listKeys(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(listKeysDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse listKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<StorageAccount> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + ServiceResponse> response = listDelegate(call.execute()); + List result = response.getBody().getItems(); + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall listAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = listDelegate(response); + serviceCallback.success(new ServiceResponse<>(result.getBody().getItems(), result.getResponse())); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<StorageAccount> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> listByResourceGroup(String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Call call = service.listByResourceGroup(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + ServiceResponse> response = listByResourceGroupDelegate(call.execute()); + List result = response.getBody().getItems(); + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (resourceGroupName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + return null; + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Call call = service.listByResourceGroup(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + serviceCallback.success(new ServiceResponse<>(result.getBody().getItems(), result.getResponse())); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Regenerates the access keys for the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param regenerateKey Specifies name of the key which should be regenerated. key1 or key2 for the default keys + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the StorageAccountKeys object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse regenerateKey(String resourceGroupName, String accountName, StorageAccountRegenerateKeyParameters regenerateKey) throws CloudException, IOException, IllegalArgumentException { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (regenerateKey == null) { + throw new IllegalArgumentException("Parameter regenerateKey is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Validator.validate(regenerateKey); + Call call = service.regenerateKey(resourceGroupName, accountName, this.client.getSubscriptionId(), regenerateKey, this.client.getApiVersion(), this.client.getAcceptLanguage()); + return regenerateKeyDelegate(call.execute()); + } + + /** + * Regenerates the access keys for the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param regenerateKey Specifies name of the key which should be regenerated. key1 or key2 for the default keys + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall regenerateKeyAsync(String resourceGroupName, String accountName, StorageAccountRegenerateKeyParameters regenerateKey, final ServiceCallback serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (resourceGroupName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + return null; + } + if (accountName == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + return null; + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (regenerateKey == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter regenerateKey is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Validator.validate(regenerateKey, serviceCallback); + Call call = service.regenerateKey(resourceGroupName, accountName, this.client.getSubscriptionId(), regenerateKey, this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + serviceCallback.success(regenerateKeyDelegate(response)); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse regenerateKeyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.getMapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/Samples/azure-storage/Azure.Java/StorageManagementClient.java b/Samples/azure-storage/Azure.Java/StorageManagementClient.java index 91af414bd8174..7a7182c76e6c8 100644 --- a/Samples/azure-storage/Azure.Java/StorageManagementClient.java +++ b/Samples/azure-storage/Azure.Java/StorageManagementClient.java @@ -103,7 +103,7 @@ public interface StorageManagementClient { * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. */ - void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + void withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); /** * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. @@ -120,15 +120,15 @@ public interface StorageManagementClient { void setGenerateClientRequestId(boolean generateClientRequestId); /** - * Gets the StorageAccountsOperations object to access its operations. - * @return the StorageAccountsOperations object. + * Gets the StorageAccounts object to access its operations. + * @return the StorageAccounts object. */ - StorageAccountsOperations getStorageAccountsOperations(); + StorageAccounts storageAccounts(); /** - * Gets the UsageOperations object to access its operations. - * @return the UsageOperations object. + * Gets the Usages object to access its operations. + * @return the Usages object. */ - UsageOperations getUsageOperations(); + Usages usages(); } diff --git a/Samples/azure-storage/Azure.Java/StorageManagementClientImpl.java b/Samples/azure-storage/Azure.Java/StorageManagementClientImpl.java index 95e8d54883aa3..d5226fd76082e 100644 --- a/Samples/azure-storage/Azure.Java/StorageManagementClientImpl.java +++ b/Samples/azure-storage/Azure.Java/StorageManagementClientImpl.java @@ -121,7 +121,7 @@ public int getLongRunningOperationRetryTimeout() { * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. */ - public void setLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + public void withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; } @@ -147,19 +147,19 @@ public void setGenerateClientRequestId(boolean generateClientRequestId) { } /** - * Gets the StorageAccountsOperations object to access its operations. - * @return the StorageAccountsOperations object. + * Gets the StorageAccounts object to access its operations. + * @return the StorageAccounts object. */ - public StorageAccountsOperations getStorageAccountsOperations() { - return new StorageAccountsOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public StorageAccounts storageAccounts() { + return new StorageAccountsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); } /** - * Gets the UsageOperations object to access its operations. - * @return the UsageOperations object. + * Gets the Usages object to access its operations. + * @return the Usages object. */ - public UsageOperations getUsageOperations() { - return new UsageOperationsImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); + public Usages usages() { + return new UsagesImpl(this.retrofitBuilder.client(clientBuilder.build()).build(), this); } /** diff --git a/Samples/azure-storage/Azure.Java/Usage.java b/Samples/azure-storage/Azure.Java/Usage.java new file mode 100644 index 0000000000000..79297c1831eb9 --- /dev/null +++ b/Samples/azure-storage/Azure.Java/Usage.java @@ -0,0 +1,38 @@ +/** + */ + +package petstore; + +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import petstore.models.Usage; + +/** + * An instance of this class provides access to all the operations defined + * in Usage. + */ +public interface Usage { + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall listAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + +} diff --git a/Samples/azure-storage/Azure.Java/UsageImpl.java b/Samples/azure-storage/Azure.Java/UsageImpl.java new file mode 100644 index 0000000000000..45bc6cc198139 --- /dev/null +++ b/Samples/azure-storage/Azure.Java/UsageImpl.java @@ -0,0 +1,122 @@ +/** + */ + +package petstore; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import petstore.models.PageImpl; +import petstore.models.Usage; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import retrofit2.Retrofit; + +/** + * An instance of this class provides access to all the operations defined + * in Usage. + */ +public final class UsageImpl implements Usage { + /** The Retrofit service to perform REST calls. */ + private UsageService service; + /** The service client containing this operation class. */ + private StorageManagementClient client; + + /** + * Initializes an instance of Usage. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsageImpl(Retrofit retrofit, StorageManagementClient client) { + this.service = retrofit.create(UsageService.class); + this.client = client; + } + + /** + * The interface defining all the services for Usage to be + * used by Retrofit to perform actually REST calls. + */ + interface UsageService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages") + Call list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + } + + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + ServiceResponse> response = listDelegate(call.execute()); + List result = response.getBody().getItems(); + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall listAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = listDelegate(response); + serviceCallback.success(new ServiceResponse<>(result.getBody().getItems(), result.getResponse())); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/Samples/azure-storage/Azure.Java/Usages.java b/Samples/azure-storage/Azure.Java/Usages.java new file mode 100644 index 0000000000000..ba8b153950a4c --- /dev/null +++ b/Samples/azure-storage/Azure.Java/Usages.java @@ -0,0 +1,38 @@ +/** + */ + +package petstore; + +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import petstore.models.Usage; + +/** + * An instance of this class provides access to all the operations defined + * in Usages. + */ +public interface Usages { + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall listAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + +} diff --git a/Samples/azure-storage/Azure.Java/UsagesImpl.java b/Samples/azure-storage/Azure.Java/UsagesImpl.java new file mode 100644 index 0000000000000..60a32341ea426 --- /dev/null +++ b/Samples/azure-storage/Azure.Java/UsagesImpl.java @@ -0,0 +1,122 @@ +/** + */ + +package petstore; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import petstore.models.PageImpl; +import petstore.models.Usage; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import retrofit2.Retrofit; + +/** + * An instance of this class provides access to all the operations defined + * in Usages. + */ +public final class UsagesImpl implements Usages { + /** The Retrofit service to perform REST calls. */ + private UsagesService service; + /** The service client containing this operation class. */ + private StorageManagementClient client; + + /** + * Initializes an instance of Usages. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsagesImpl(Retrofit retrofit, StorageManagementClient client) { + this.service = retrofit.create(UsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Usages to be + * used by Retrofit to perform actually REST calls. + */ + interface UsagesService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages") + Call list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + } + + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + ServiceResponse> response = listDelegate(call.execute()); + List result = response.getBody().getItems(); + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall listAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = listDelegate(response); + serviceCallback.success(new ServiceResponse<>(result.getBody().getItems(), result.getResponse())); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/Samples/azure-storage/Azure.Java/UsagesOperations.java b/Samples/azure-storage/Azure.Java/UsagesOperations.java new file mode 100644 index 0000000000000..0469886ba09f4 --- /dev/null +++ b/Samples/azure-storage/Azure.Java/UsagesOperations.java @@ -0,0 +1,38 @@ +/** + */ + +package petstore; + +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import petstore.models.Usage; + +/** + * An instance of this class provides access to all the operations defined + * in UsagesOperations. + */ +public interface UsagesOperations { + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. + */ + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link ServiceCall} object + */ + ServiceCall listAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException; + +} diff --git a/Samples/azure-storage/Azure.Java/UsagesOperationsImpl.java b/Samples/azure-storage/Azure.Java/UsagesOperationsImpl.java new file mode 100644 index 0000000000000..a3087dd7be7e6 --- /dev/null +++ b/Samples/azure-storage/Azure.Java/UsagesOperationsImpl.java @@ -0,0 +1,122 @@ +/** + */ + +package petstore; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseCallback; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import petstore.models.PageImpl; +import petstore.models.Usage; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import retrofit2.Retrofit; + +/** + * An instance of this class provides access to all the operations defined + * in UsagesOperations. + */ +public final class UsagesOperationsImpl implements UsagesOperations { + /** The Retrofit service to perform REST calls. */ + private UsagesService service; + /** The service client containing this operation class. */ + private StorageManagementClient client; + + /** + * Initializes an instance of UsagesOperations. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsagesOperationsImpl(Retrofit retrofit, StorageManagementClient client) { + this.service = retrofit.create(UsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for UsagesOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface UsagesService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages") + Call list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage); + + } + + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @throws CloudException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters + * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. + */ + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + if (this.client.getSubscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); + } + if (this.client.getApiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); + } + Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + ServiceResponse> response = listDelegate(call.execute()); + List result = response.getBody().getItems(); + return new ServiceResponse<>(result, response.getResponse()); + } + + /** + * Gets the current usage count and the limit for the resources under the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if callback is null + * @return the {@link Call} object + */ + public ServiceCall listAsync(final ServiceCallback> serviceCallback) throws IllegalArgumentException { + if (serviceCallback == null) { + throw new IllegalArgumentException("ServiceCallback is required for async calls."); + } + if (this.client.getSubscriptionId() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return null; + } + if (this.client.getApiVersion() == null) { + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + return null; + } + Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); + final ServiceCall serviceCall = new ServiceCall(call); + call.enqueue(new ServiceResponseCallback>(serviceCallback) { + @Override + public void onResponse(Call call, Response response) { + try { + ServiceResponse> result = listDelegate(response); + serviceCallback.success(new ServiceResponse<>(result.getBody().getItems(), result.getResponse())); + } catch (CloudException | IOException exception) { + serviceCallback.failure(exception); + } + } + }); + return serviceCall; + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.getMapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/Samples/azure-storage/Azure.Java/models/Resource.java b/Samples/azure-storage/Azure.Java/models/Resource.java new file mode 100644 index 0000000000000..4db4bb9497e49 --- /dev/null +++ b/Samples/azure-storage/Azure.Java/models/Resource.java @@ -0,0 +1,105 @@ +/** + */ + +package petstore.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import com.microsoft.azure.BaseResource; + +/** + * The Resource model. + */ +public class Resource extends BaseResource { + /** + * Resource Id. + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Resource name. + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Resource type. + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Resource location. + */ + private String location; + + /** + * Resource tags. + */ + private Map tags; + + /** + * Get the id value. + * + * @return the id value + */ + public String getId() { + return this.id; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String getName() { + return this.name; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String getType() { + return this.type; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String getLocation() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + */ + public void withLocation(String location) { + this.location = location; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map getTags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + */ + public void withTags(Map tags) { + this.tags = tags; + } + +} diff --git a/Samples/azure-storage/Azure.Java/models/StorageAccountCreateParameters.java b/Samples/azure-storage/Azure.Java/models/StorageAccountCreateParameters.java index 975c17e4c375e..7f3cc5defc94e 100644 --- a/Samples/azure-storage/Azure.Java/models/StorageAccountCreateParameters.java +++ b/Samples/azure-storage/Azure.Java/models/StorageAccountCreateParameters.java @@ -40,7 +40,7 @@ public String getLocation() { * * @param location the location value to set */ - public void setLocation(String location) { + public void withLocation(String location) { this.location = location; } @@ -58,7 +58,7 @@ public Map getTags() { * * @param tags the tags value to set */ - public void setTags(Map tags) { + public void withTags(Map tags) { this.tags = tags; } diff --git a/Samples/azure-storage/Azure.Java/models/StorageAccountUpdateParameters.java b/Samples/azure-storage/Azure.Java/models/StorageAccountUpdateParameters.java index 5cb128ecf779a..af54df0c7fbd6 100644 --- a/Samples/azure-storage/Azure.Java/models/StorageAccountUpdateParameters.java +++ b/Samples/azure-storage/Azure.Java/models/StorageAccountUpdateParameters.java @@ -24,7 +24,7 @@ public class StorageAccountUpdateParameters { * * @return the tags value */ - public Map getTags() { + public Map withTags() { return this.tags; } @@ -33,7 +33,7 @@ public Map getTags() { * * @param tags the tags value to set */ - public void setTags(Map tags) { + public void withTags(Map tags) { this.tags = tags; } diff --git a/Tools/checkstyle/checkstyle.xml b/Tools/checkstyle/checkstyle.xml index 1e6457133995e..8c2777078c6b3 100644 --- a/Tools/checkstyle/checkstyle.xml +++ b/Tools/checkstyle/checkstyle.xml @@ -91,7 +91,9 @@
- + + + diff --git a/build.gradle b/build.gradle index 37c4d88df93c1..4aad7ed8dfd10 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ project(':azure-client-authentication') { sourceCompatibility = 1.7 targetCompatibility = 1.7 dependencies { - compile project(':client-runtime') + compile project(':azure-client-runtime') } } @@ -51,7 +51,7 @@ project(':azure-android-client-authentication') { apply plugin: 'com.android.library' group = 'com.microsoft.azure' dependencies { - compile project(':client-runtime') + compile project(':azure-client-runtime') } } @@ -72,4 +72,14 @@ project(':azure-codegen-tests') { compile project(':client-runtime') compile project(':azure-client-runtime') } +} + +project(':azure-fluent-codegen-tests') { + apply plugin: 'java' + sourceCompatibility = 1.7 + targetCompatibility = 1.7 + dependencies { + compile project(':client-runtime') + compile project(':azure-client-runtime') + } } \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 004603bf2dc52..bd525b9d98d12 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -144,6 +144,7 @@ gulp.task('regenerate:expected', function(cb){ 'regenerate:expected:rubyazure', 'regenerate:expected:java', 'regenerate:expected:javaazure', + 'regenerate:expected:javaazurefluent', 'regenerate:expected:python', 'regenerate:expected:pythonazure', 'regenerate:expected:samples' @@ -159,6 +160,7 @@ gulp.task('regenerate:delete', function(cb){ 'AutoRest/Generators/NodeJS/Azure.NodeJS.Tests/Expected', 'AutoRest/Generators/Java/Java.Tests/src/main/java', 'AutoRest/Generators/Java/Azure.Java.Tests/src/main/java', + 'AutoRest/Generators/Java/Azure.Java.Fluent.Tests/src/main/java', 'AutoRest/Generators/Python/Python.Tests/Expected', 'AutoRest/Generators/Python/Azure.Python.Tests/Expected' ], cb); @@ -283,6 +285,21 @@ gulp.task('regenerate:expected:javaazure', function(cb){ }, cb); }) +gulp.task('regenerate:expected:javaazurefluent', function(cb){ + mappings = {}; + for (var key in defaultAzureMappings) { + mappings[key.substring(16).toLowerCase()] = defaultAzureMappings[key]; + } + regenExpected({ + 'outputBaseDir': 'AutoRest/Generators/Java/Azure.Java.Fluent.Tests', + 'inputBaseDir': 'AutoRest/Generators/CSharp/Azure.CSharp.Tests', + 'mappings': mappings, + 'outputDir': 'src/main/java/fixtures', + 'codeGenerator': 'Azure.Java.Fluent', + 'nsPrefix': 'Fixtures' + }, cb); +}) + gulp.task('regenerate:expected:java', function(cb){ mappings = {}; for (var key in defaultMappings) { diff --git a/settings.gradle b/settings.gradle index 40edd14b4b383..ec6684355323b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,10 +8,12 @@ include \ 'azure-client-authentication', 'azure-android-client-authentication', 'codegen-tests', - 'azure-codegen-tests' + 'azure-codegen-tests', + 'azure-fluent-codegen-tests' project(':client-runtime').projectDir = new File("$RUNTIME_ROOT/client-runtime") project(':azure-client-runtime').projectDir = new File("$RUNTIME_ROOT/azure-client-runtime") project(':azure-client-authentication').projectDir = new File("$RUNTIME_ROOT/azure-client-authentication") project(':azure-android-client-authentication').projectDir = new File("$RUNTIME_ROOT/azure-android-client-authentication") project(':codegen-tests').projectDir = new File("$TEST_ROOT/Java.Tests") project(':azure-codegen-tests').projectDir = new File("$TEST_ROOT/Azure.Java.Tests") +project(':azure-fluent-codegen-tests').projectDir = new File("$TEST_ROOT/Azure.Java.Fluent.Tests")