diff --git a/api-specs.json b/api-specs.json index edc09c15e1f7..2a8bf9a376c9 100644 --- a/api-specs.json +++ b/api-specs.json @@ -160,6 +160,10 @@ "source": "specification/machinelearningservices/resource-manager/readme.md", "args": "--multiapi --fluent" }, + "maintenance/resource-manager": { + "source": "specification/maintenance/resource-manager/readme.md", + "args": "--multiapi --fluent" + }, "mariadb/resource-manager": { "source": "specification/mariadb/resource-manager/readme.md", "args": "--multiapi --fluent" diff --git a/sdk/maintenance/ci.mgmt.yml b/sdk/maintenance/ci.mgmt.yml new file mode 100644 index 000000000000..a50c0e578b16 --- /dev/null +++ b/sdk/maintenance/ci.mgmt.yml @@ -0,0 +1,74 @@ +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + +trigger: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maintenance/ + exclude: + - sdk/maintenance/microsoft-azure + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maintenance/ + exclude: + - sdk/maintenance/microsoft-azure + + +variables: + BuildOptions: '--batch-mode -Dgpg.skip -Dmaven.wagon.http.pool=false' + ServiceDirectory: maintenance + ProfileFlag: '' + +jobs: + - job: 'Build' + + variables: + - template: ../../eng/pipelines/templates/variables/globals.yml + + strategy: + matrix: + Java 8: + ArtifactName: 'packages' + JavaVersion: '1.8' + Java 7: + ArtifactName: 'packages' + JavaVersion: '1.7' + + pool: + vmImage: 'ubuntu-16.04' + + steps: + - task: Maven@3 + displayName: 'Build' + inputs: + mavenPomFile: sdk/$(ServiceDirectory)/pom.mgmt.xml + goals: 'compile' + options: '$(BuildOptions) $(ProfileFlag) "-DpackageOutputDirectory=$(Build.ArtifactStagingDirectory)" -DskipTests' + mavenOptions: '$(MemoryOptions) $(LoggingOptions)' + javaHomeOption: 'JDKVersion' + jdkVersionOption: $(JavaVersion) + jdkArchitectureOption: 'x64' + publishJUnitResults: false + + - task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + mergeTestResults: true + testRunTitle: 'On Java $(JavaVersion)' diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/pom.xml b/sdk/maintenance/mgmt-v2018_06_01_preview/pom.xml new file mode 100644 index 000000000000..6b2230fbe7f1 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.maintenance.v2018_06_01_preview + + com.microsoft.azure + azure-arm-parent + 1.2.0 + ../../../pom.management.xml + + azure-mgmt-maintenance + 1.0.0-beta + jar + Microsoft Azure SDK for Maintenance Management + This package contains Microsoft Maintenance Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* 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/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ApplyUpdate.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ApplyUpdate.java new file mode 100644 index 000000000000..d41cfb7de0d0 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ApplyUpdate.java @@ -0,0 +1,51 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.MaintenanceManager; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.ApplyUpdateInner; +import org.joda.time.DateTime; + +/** + * Type representing ApplyUpdate. + */ +public interface ApplyUpdate extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastUpdateTime value. + */ + DateTime lastUpdateTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the status value. + */ + UpdateStatus status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ApplyUpdates.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ApplyUpdates.java new file mode 100644 index 000000000000..99b855d62353 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ApplyUpdates.java @@ -0,0 +1,75 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import rx.Observable; + +/** + * Type representing ApplyUpdates. + */ +public interface ApplyUpdates { + /** + * Track Updates to resource with parent. + * Track maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getParentAsync(String resourceGroupName, String resourceParentType, String resourceParentName, String providerName, String resourceType, String resourceName, String applyUpdateName); + + /** + * Track Updates to resource. + * Track maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String applyUpdateName); + + /** + * Apply Updates to resource with parent. + * Apply maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName); + + /** + * Apply Updates to resource. + * Apply maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String providerName, String resourceType, String resourceName); + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ConfigurationAssignment.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ConfigurationAssignment.java new file mode 100644 index 000000000000..f5651aeeaee3 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ConfigurationAssignment.java @@ -0,0 +1,222 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.ConfigurationAssignmentInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.MaintenanceManager; + +/** + * Type representing ConfigurationAssignment. + */ +public interface ConfigurationAssignment extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maintenanceConfigurationId value. + */ + String maintenanceConfigurationId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ConfigurationAssignment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithProvider, DefinitionStages.WithResourceParentType, DefinitionStages.WithResourceParentName, DefinitionStages.WithResourceType, DefinitionStages.WithResourceName, DefinitionStages.WithCreate { + } + + /** + * Grouping of ConfigurationAssignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ConfigurationAssignment definition. + */ + interface Blank extends WithProvider { + } + + /** + * The stage of the configurationassignment definition allowing to specify Provider. + */ + interface WithProvider { + /** + * Specifies resourceGroupName, providerName. + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @return the next definition stage + */ + WithResourceParentType withExistingProvider(String resourceGroupName, String providerName); + } + + /** + * The stage of the configurationassignment definition allowing to specify ResourceParentType. + */ + interface WithResourceParentType { + /** + * Specifies resourceParentType. + * @param resourceParentType Resource parent type + * @return the next definition stage + */ + WithResourceParentName withResourceParentType(String resourceParentType); + } + + /** + * The stage of the configurationassignment definition allowing to specify ResourceParentName. + */ + interface WithResourceParentName { + /** + * Specifies resourceParentName. + * @param resourceParentName Resource parent identifier + * @return the next definition stage + */ + WithResourceType withResourceParentName(String resourceParentName); + } + + /** + * The stage of the configurationassignment definition allowing to specify ResourceType. + */ + interface WithResourceType { + /** + * Specifies resourceType. + * @param resourceType Resource type + * @return the next definition stage + */ + WithResourceName withResourceType(String resourceType); + } + + /** + * The stage of the configurationassignment definition allowing to specify ResourceName. + */ + interface WithResourceName { + /** + * Specifies resourceName. + * @param resourceName Resource identifier + * @return the next definition stage + */ + WithCreate withResourceName(String resourceName); + } + + /** + * The stage of the configurationassignment definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the configurationassignment definition allowing to specify MaintenanceConfigurationId. + */ + interface WithMaintenanceConfigurationId { + /** + * Specifies maintenanceConfigurationId. + * @param maintenanceConfigurationId The maintenance configuration Id + * @return the next definition stage + */ + WithCreate withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + + /** + * The stage of the configurationassignment definition allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId The unique resourceId + * @return the next definition stage + */ + WithCreate withResourceId(String resourceId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithLocation, DefinitionStages.WithMaintenanceConfigurationId, DefinitionStages.WithResourceId { + } + } + /** + * The template for a ConfigurationAssignment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation, UpdateStages.WithMaintenanceConfigurationId, UpdateStages.WithResourceId { + } + + /** + * Grouping of ConfigurationAssignment update stages. + */ + interface UpdateStages { + /** + * The stage of the configurationassignment update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the configurationassignment update allowing to specify MaintenanceConfigurationId. + */ + interface WithMaintenanceConfigurationId { + /** + * Specifies maintenanceConfigurationId. + * @param maintenanceConfigurationId The maintenance configuration Id + * @return the next update stage + */ + Update withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + + /** + * The stage of the configurationassignment update allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId The unique resourceId + * @return the next update stage + */ + Update withResourceId(String resourceId); + } + + } +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ConfigurationAssignments.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ConfigurationAssignments.java new file mode 100644 index 000000000000..653fadd9c271 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ConfigurationAssignments.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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.ConfigurationAssignmentInner; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.ConfigurationAssignmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ConfigurationAssignments. + */ +public interface ConfigurationAssignments extends SupportsCreating, HasInner { + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName); + + /** + * Create configuration assignment. + * Register configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment); + + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName); + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName); + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String providerName, String resourceType, String resourceName); + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ErrorDetails.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ErrorDetails.java new file mode 100644 index 000000000000..9aa7d019c0ac --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ErrorDetails.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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error response details received from the Azure Maintenance service. + */ +public class ErrorDetails { + /** + * Service-defined error code. This code serves as a sub-status for the + * HTTP error code specified in the response. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Human-readable representation of the error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + * + * @param code the code value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withCode(String code) { + this.code = code; + return this; + } + + /** + * Get human-readable representation of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set human-readable representation of the error. + * + * @param message the message value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ImpactType.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ImpactType.java new file mode 100644 index 000000000000..eca44d4bcb65 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/ImpactType.java @@ -0,0 +1,47 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ImpactType. + */ +public final class ImpactType extends ExpandableStringEnum { + /** Static value None for ImpactType. */ + public static final ImpactType NONE = fromString("None"); + + /** Static value Freeze for ImpactType. */ + public static final ImpactType FREEZE = fromString("Freeze"); + + /** Static value Restart for ImpactType. */ + public static final ImpactType RESTART = fromString("Restart"); + + /** Static value Redeploy for ImpactType. */ + public static final ImpactType REDEPLOY = fromString("Redeploy"); + + /** + * Creates or finds a ImpactType from its string representation. + * @param name a name to look for + * @return the corresponding ImpactType + */ + @JsonCreator + public static ImpactType fromString(String name) { + return fromString(name, ImpactType.class); + } + + /** + * @return known ImpactType values + */ + public static Collection values() { + return values(ImpactType.class); + } +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceConfiguration.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceConfiguration.java new file mode 100644 index 000000000000..168d5ae9e718 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceConfiguration.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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.MaintenanceManager; +import java.util.Map; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.MaintenanceConfigurationInner; + +/** + * Type representing MaintenanceConfiguration. + */ +public interface MaintenanceConfiguration extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the extensionProperties value. + */ + Map extensionProperties(); + + /** + * @return the maintenanceScope value. + */ + MaintenanceScope maintenanceScope(); + + /** + * @return the namespace value. + */ + String namespace(); + + /** + * The entirety of the MaintenanceConfiguration definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of MaintenanceConfiguration definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a MaintenanceConfiguration definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the MaintenanceConfiguration definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the maintenanceconfiguration definition allowing to specify ExtensionProperties. + */ + interface WithExtensionProperties { + /** + * Specifies extensionProperties. + * @param extensionProperties Gets or sets extensionProperties of the maintenanceConfiguration + * @return the next definition stage + */ + WithCreate withExtensionProperties(Map extensionProperties); + } + + /** + * The stage of the maintenanceconfiguration definition allowing to specify MaintenanceScope. + */ + interface WithMaintenanceScope { + /** + * Specifies maintenanceScope. + * @param maintenanceScope Gets or sets maintenanceScope of the configuration. Possible values include: 'All', 'Host', 'Resource', 'InResource' + * @return the next definition stage + */ + WithCreate withMaintenanceScope(MaintenanceScope maintenanceScope); + } + + /** + * The stage of the maintenanceconfiguration definition allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies namespace. + * @param namespace Gets or sets namespace of the resource + * @return the next definition stage + */ + WithCreate withNamespace(String namespace); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithExtensionProperties, DefinitionStages.WithMaintenanceScope, DefinitionStages.WithNamespace { + } + } + /** + * The template for a MaintenanceConfiguration update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithExtensionProperties, UpdateStages.WithMaintenanceScope, UpdateStages.WithNamespace { + } + + /** + * Grouping of MaintenanceConfiguration update stages. + */ + interface UpdateStages { + /** + * The stage of the maintenanceconfiguration update allowing to specify ExtensionProperties. + */ + interface WithExtensionProperties { + /** + * Specifies extensionProperties. + * @param extensionProperties Gets or sets extensionProperties of the maintenanceConfiguration + * @return the next update stage + */ + Update withExtensionProperties(Map extensionProperties); + } + + /** + * The stage of the maintenanceconfiguration update allowing to specify MaintenanceScope. + */ + interface WithMaintenanceScope { + /** + * Specifies maintenanceScope. + * @param maintenanceScope Gets or sets maintenanceScope of the configuration. Possible values include: 'All', 'Host', 'Resource', 'InResource' + * @return the next update stage + */ + Update withMaintenanceScope(MaintenanceScope maintenanceScope); + } + + /** + * The stage of the maintenanceconfiguration update allowing to specify Namespace. + */ + interface WithNamespace { + /** + * Specifies namespace. + * @param namespace Gets or sets namespace of the resource + * @return the next update stage + */ + Update withNamespace(String namespace); + } + + } +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceConfigurations.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceConfigurations.java new file mode 100644 index 000000000000..199238faf6c5 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceConfigurations.java @@ -0,0 +1,24 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.MaintenanceConfigurationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing MaintenanceConfigurations. + */ +public interface MaintenanceConfigurations extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceError.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceError.java new file mode 100644 index 000000000000..ac45958f393b --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceError.java @@ -0,0 +1,43 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error response received from the Azure Maintenance service. + */ +public class MaintenanceError { + /** + * Details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set details of the error. + * + * @param error the error value to set + * @return the MaintenanceError object itself. + */ + public MaintenanceError withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceErrorException.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceErrorException.java new file mode 100644 index 000000000000..dacd03cc1094 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceErrorException.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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with MaintenanceError information. + */ +public class MaintenanceErrorException extends RestException { + /** + * Initializes a new instance of the MaintenanceErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public MaintenanceErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the MaintenanceErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public MaintenanceErrorException(final String message, final Response response, final MaintenanceError body) { + super(message, response, body); + } + + @Override + public MaintenanceError body() { + return (MaintenanceError) super.body(); + } +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceScope.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceScope.java new file mode 100644 index 000000000000..03158518bd3c --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/MaintenanceScope.java @@ -0,0 +1,47 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MaintenanceScope. + */ +public final class MaintenanceScope extends ExpandableStringEnum { + /** Static value All for MaintenanceScope. */ + public static final MaintenanceScope ALL = fromString("All"); + + /** Static value Host for MaintenanceScope. */ + public static final MaintenanceScope HOST = fromString("Host"); + + /** Static value Resource for MaintenanceScope. */ + public static final MaintenanceScope RESOURCE = fromString("Resource"); + + /** Static value InResource for MaintenanceScope. */ + public static final MaintenanceScope IN_RESOURCE = fromString("InResource"); + + /** + * Creates or finds a MaintenanceScope from its string representation. + * @param name a name to look for + * @return the corresponding MaintenanceScope + */ + @JsonCreator + public static MaintenanceScope fromString(String name) { + return fromString(name, MaintenanceScope.class); + } + + /** + * @return known MaintenanceScope values + */ + public static Collection values() { + return values(MaintenanceScope.class); + } +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Operation.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Operation.java new file mode 100644 index 000000000000..26ebef713a2d --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Operation.java @@ -0,0 +1,40 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.MaintenanceManager; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationInfo display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + String origin(); + + /** + * @return the properties value. + */ + Object properties(); + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/OperationInfo.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/OperationInfo.java new file mode 100644 index 000000000000..04621fbd63f8 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/OperationInfo.java @@ -0,0 +1,121 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about an operation. + */ +public class OperationInfo { + /** + * Name of the provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Name of the resource type. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Name of the operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get name of the provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set name of the provider. + * + * @param provider the provider value to set + * @return the OperationInfo object itself. + */ + public OperationInfo withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get name of the resource type. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set name of the resource type. + * + * @param resource the resource value to set + * @return the OperationInfo object itself. + */ + public OperationInfo withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get name of the operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set name of the operation. + * + * @param operation the operation value to set + * @return the OperationInfo object itself. + */ + public OperationInfo withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the operation. + * + * @param description the description value to set + * @return the OperationInfo object itself. + */ + public OperationInfo withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Operations.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Operations.java new file mode 100644 index 000000000000..3454918e750b --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Operations.java @@ -0,0 +1,28 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * List available operations. + * List the available operations supported by the Microsoft.Maintenance resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Update.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Update.java new file mode 100644 index 000000000000..5e0705c254f0 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Update.java @@ -0,0 +1,51 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.MaintenanceManager; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation.UpdateInner; +import org.joda.time.DateTime; + +/** + * Type representing Update. + */ +public interface Update extends HasInner, HasManager { + /** + * @return the impactDurationInSec value. + */ + Integer impactDurationInSec(); + + /** + * @return the impactType value. + */ + ImpactType impactType(); + + /** + * @return the maintenanceScope value. + */ + MaintenanceScope maintenanceScope(); + + /** + * @return the notBefore value. + */ + DateTime notBefore(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the status value. + */ + UpdateStatus status(); + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/UpdateStatus.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/UpdateStatus.java new file mode 100644 index 000000000000..c177cf90e946 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/UpdateStatus.java @@ -0,0 +1,50 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UpdateStatus. + */ +public final class UpdateStatus extends ExpandableStringEnum { + /** Static value Pending for UpdateStatus. */ + public static final UpdateStatus PENDING = fromString("Pending"); + + /** Static value InProgress for UpdateStatus. */ + public static final UpdateStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Completed for UpdateStatus. */ + public static final UpdateStatus COMPLETED = fromString("Completed"); + + /** Static value RetryNow for UpdateStatus. */ + public static final UpdateStatus RETRY_NOW = fromString("RetryNow"); + + /** Static value RetryLater for UpdateStatus. */ + public static final UpdateStatus RETRY_LATER = fromString("RetryLater"); + + /** + * Creates or finds a UpdateStatus from its string representation. + * @param name a name to look for + * @return the corresponding UpdateStatus + */ + @JsonCreator + public static UpdateStatus fromString(String name) { + return fromString(name, UpdateStatus.class); + } + + /** + * @return known UpdateStatus values + */ + public static Collection values() { + return values(UpdateStatus.class); + } +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Updates.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Updates.java new file mode 100644 index 000000000000..d050b66ef1d1 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/Updates.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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; + +import rx.Observable; + +/** + * Type representing Updates. + */ +public interface Updates { + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName); + + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String providerName, String resourceType, String resourceName); + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdateImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdateImpl.java new file mode 100644 index 000000000000..79878545aa6a --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdateImpl.java @@ -0,0 +1,58 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdate; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.UpdateStatus; + +class ApplyUpdateImpl extends WrapperImpl implements ApplyUpdate { + private final MaintenanceManager manager; + ApplyUpdateImpl(ApplyUpdateInner inner, MaintenanceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public MaintenanceManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime lastUpdateTime() { + return this.inner().lastUpdateTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public UpdateStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdateInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdateInner.java new file mode 100644 index 000000000000..7f192e862260 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdateInner.java @@ -0,0 +1,101 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.UpdateStatus; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Apply Update request. + */ +@JsonFlatten +public class ApplyUpdateInner extends ProxyResource { + /** + * The status. Possible values include: 'Pending', 'InProgress', + * 'Completed', 'RetryNow', 'RetryLater'. + */ + @JsonProperty(value = "properties.status") + private UpdateStatus status; + + /** + * The resourceId. + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /** + * Last Update time. + */ + @JsonProperty(value = "properties.lastUpdateTime") + private DateTime lastUpdateTime; + + /** + * Get the status. Possible values include: 'Pending', 'InProgress', 'Completed', 'RetryNow', 'RetryLater'. + * + * @return the status value + */ + public UpdateStatus status() { + return this.status; + } + + /** + * Set the status. Possible values include: 'Pending', 'InProgress', 'Completed', 'RetryNow', 'RetryLater'. + * + * @param status the status value to set + * @return the ApplyUpdateInner object itself. + */ + public ApplyUpdateInner withStatus(UpdateStatus status) { + this.status = status; + return this; + } + + /** + * Get the resourceId. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId. + * + * @param resourceId the resourceId value to set + * @return the ApplyUpdateInner object itself. + */ + public ApplyUpdateInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get last Update time. + * + * @return the lastUpdateTime value + */ + public DateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set last Update time. + * + * @param lastUpdateTime the lastUpdateTime value to set + * @return the ApplyUpdateInner object itself. + */ + public ApplyUpdateInner withLastUpdateTime(DateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdatesImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdatesImpl.java new file mode 100644 index 000000000000..3adadefd7ff1 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdatesImpl.java @@ -0,0 +1,78 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdates; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdate; + +class ApplyUpdatesImpl extends WrapperImpl implements ApplyUpdates { + private final MaintenanceManager manager; + + ApplyUpdatesImpl(MaintenanceManager manager) { + super(manager.inner().applyUpdates()); + this.manager = manager; + } + + public MaintenanceManager manager() { + return this.manager; + } + + @Override + public Observable getParentAsync(String resourceGroupName, String resourceParentType, String resourceParentName, String providerName, String resourceType, String resourceName, String applyUpdateName) { + ApplyUpdatesInner client = this.inner(); + return client.getParentAsync(resourceGroupName, resourceParentType, resourceParentName, providerName, resourceType, resourceName, applyUpdateName) + .map(new Func1() { + @Override + public ApplyUpdate call(ApplyUpdateInner inner) { + return new ApplyUpdateImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String applyUpdateName) { + ApplyUpdatesInner client = this.inner(); + return client.getAsync(resourceGroupName, providerName, resourceType, resourceName, applyUpdateName) + .map(new Func1() { + @Override + public ApplyUpdate call(ApplyUpdateInner inner) { + return new ApplyUpdateImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + ApplyUpdatesInner client = this.inner(); + return client.createOrUpdateParentAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName) + .map(new Func1() { + @Override + public ApplyUpdate call(ApplyUpdateInner inner) { + return new ApplyUpdateImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) { + ApplyUpdatesInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, providerName, resourceType, resourceName) + .map(new Func1() { + @Override + public ApplyUpdate call(ApplyUpdateInner inner) { + return new ApplyUpdateImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdatesInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdatesInner.java new file mode 100644 index 000000000000..78de9592f2da --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ApplyUpdatesInner.java @@ -0,0 +1,531 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ApplyUpdates. + */ +public class ApplyUpdatesInner { + /** The Retrofit service to perform REST calls. */ + private ApplyUpdatesService service; + /** The service client containing this operation class. */ + private MaintenanceManagementClientImpl client; + + /** + * Initializes an instance of ApplyUpdatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApplyUpdatesInner(Retrofit retrofit, MaintenanceManagementClientImpl client) { + this.service = retrofit.create(ApplyUpdatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApplyUpdates to be + * used by Retrofit to perform actually REST calls. + */ + interface ApplyUpdatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdates getParent" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName}") + Observable> getParent(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceParentType") String resourceParentType, @Path("resourceParentName") String resourceParentName, @Path("providerName") String providerName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("applyUpdateName") String applyUpdateName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdates get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("applyUpdateName") String applyUpdateName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdates createOrUpdateParent" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default") + Observable> createOrUpdateParent(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceParentType") String resourceParentType, @Path("resourceParentName") String resourceParentName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdates createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Track Updates to resource with parent. + * Track maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplyUpdateInner object if successful. + */ + public ApplyUpdateInner getParent(String resourceGroupName, String resourceParentType, String resourceParentName, String providerName, String resourceType, String resourceName, String applyUpdateName) { + return getParentWithServiceResponseAsync(resourceGroupName, resourceParentType, resourceParentName, providerName, resourceType, resourceName, applyUpdateName).toBlocking().single().body(); + } + + /** + * Track Updates to resource with parent. + * Track maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getParentAsync(String resourceGroupName, String resourceParentType, String resourceParentName, String providerName, String resourceType, String resourceName, String applyUpdateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getParentWithServiceResponseAsync(resourceGroupName, resourceParentType, resourceParentName, providerName, resourceType, resourceName, applyUpdateName), serviceCallback); + } + + /** + * Track Updates to resource with parent. + * Track maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplyUpdateInner object + */ + public Observable getParentAsync(String resourceGroupName, String resourceParentType, String resourceParentName, String providerName, String resourceType, String resourceName, String applyUpdateName) { + return getParentWithServiceResponseAsync(resourceGroupName, resourceParentType, resourceParentName, providerName, resourceType, resourceName, applyUpdateName).map(new Func1, ApplyUpdateInner>() { + @Override + public ApplyUpdateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Track Updates to resource with parent. + * Track maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplyUpdateInner object + */ + public Observable> getParentWithServiceResponseAsync(String resourceGroupName, String resourceParentType, String resourceParentName, String providerName, String resourceType, String resourceName, String applyUpdateName) { + 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 (resourceParentType == null) { + throw new IllegalArgumentException("Parameter resourceParentType is required and cannot be null."); + } + if (resourceParentName == null) { + throw new IllegalArgumentException("Parameter resourceParentName is required and cannot be null."); + } + if (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (applyUpdateName == null) { + throw new IllegalArgumentException("Parameter applyUpdateName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getParent(this.client.subscriptionId(), resourceGroupName, resourceParentType, resourceParentName, providerName, resourceType, resourceName, applyUpdateName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getParentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getParentDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Track Updates to resource. + * Track maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplyUpdateInner object if successful. + */ + public ApplyUpdateInner get(String resourceGroupName, String providerName, String resourceType, String resourceName, String applyUpdateName) { + return getWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName, applyUpdateName).toBlocking().single().body(); + } + + /** + * Track Updates to resource. + * Track maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String applyUpdateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName, applyUpdateName), serviceCallback); + } + + /** + * Track Updates to resource. + * Track maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplyUpdateInner object + */ + public Observable getAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String applyUpdateName) { + return getWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName, applyUpdateName).map(new Func1, ApplyUpdateInner>() { + @Override + public ApplyUpdateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Track Updates to resource. + * Track maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param applyUpdateName applyUpdate Id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplyUpdateInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String applyUpdateName) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (applyUpdateName == null) { + throw new IllegalArgumentException("Parameter applyUpdateName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, providerName, resourceType, resourceName, applyUpdateName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Apply Updates to resource with parent. + * Apply maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplyUpdateInner object if successful. + */ + public ApplyUpdateInner createOrUpdateParent(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + return createOrUpdateParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * Apply Updates to resource with parent. + * Apply maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName), serviceCallback); + } + + /** + * Apply Updates to resource with parent. + * Apply maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplyUpdateInner object + */ + public Observable createOrUpdateParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + return createOrUpdateParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName).map(new Func1, ApplyUpdateInner>() { + @Override + public ApplyUpdateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Apply Updates to resource with parent. + * Apply maintenance updates to resource with parent. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplyUpdateInner object + */ + public Observable> createOrUpdateParentWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceParentType == null) { + throw new IllegalArgumentException("Parameter resourceParentType is required and cannot be null."); + } + if (resourceParentName == null) { + throw new IllegalArgumentException("Parameter resourceParentName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.createOrUpdateParent(this.client.subscriptionId(), resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateParentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateParentDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Apply Updates to resource. + * Apply maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplyUpdateInner object if successful. + */ + public ApplyUpdateInner createOrUpdate(String resourceGroupName, String providerName, String resourceType, String resourceName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * Apply Updates to resource. + * Apply maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName), serviceCallback); + } + + /** + * Apply Updates to resource. + * Apply maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplyUpdateInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName).map(new Func1, ApplyUpdateInner>() { + @Override + public ApplyUpdateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Apply Updates to resource. + * Apply maintenance updates to resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplyUpdateInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, providerName, resourceType, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentImpl.java new file mode 100644 index 000000000000..d00b3ac2ee85 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentImpl.java @@ -0,0 +1,159 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class ConfigurationAssignmentImpl extends CreatableUpdatableImpl implements ConfigurationAssignment, ConfigurationAssignment.Definition, ConfigurationAssignment.Update { + private final MaintenanceManager manager; + private String resourceGroupName; + private String providerName; + private String resourceParentType; + private String resourceParentName; + private String resourceType; + private String resourceName; + private String configurationAssignmentName; + + ConfigurationAssignmentImpl(String name, MaintenanceManager manager) { + super(name, new ConfigurationAssignmentInner()); + this.manager = manager; + // Set resource name + this.configurationAssignmentName = name; + // + } + + ConfigurationAssignmentImpl(ConfigurationAssignmentInner inner, MaintenanceManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.configurationAssignmentName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.providerName = IdParsingUtils.getValueFromIdByName(inner.id(), "providers"); + this.configurationAssignmentName = IdParsingUtils.getValueFromIdByName(inner.id(), "configurationAssignments"); + this.resourceParentType = IdParsingUtils.getValueFromIdByPosition(inner.id(), 6); + this.resourceParentName = IdParsingUtils.getValueFromIdByPosition(inner.id(), 7); + this.resourceType = IdParsingUtils.getValueFromIdByPosition(inner.id(), 8); + this.resourceName = IdParsingUtils.getValueFromIdByPosition(inner.id(), 9); + // + } + + @Override + public MaintenanceManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ConfigurationAssignmentsInner client = this.manager().inner().configurationAssignments(); + return client.createOrUpdateParentAsync(this.resourceGroupName, this.providerName, this.resourceParentType, this.resourceParentName, this.resourceType, this.resourceName, this.configurationAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ConfigurationAssignmentsInner client = this.manager().inner().configurationAssignments(); + return client.createOrUpdateParentAsync(this.resourceGroupName, this.providerName, this.resourceParentType, this.resourceParentName, this.resourceType, this.resourceName, this.configurationAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ConfigurationAssignmentsInner client = this.manager().inner().configurationAssignments(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String maintenanceConfigurationId() { + return this.inner().maintenanceConfigurationId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ConfigurationAssignmentImpl withExistingProvider(String resourceGroupName, String providerName) { + this.resourceGroupName = resourceGroupName; + this.providerName = providerName; + return this; + } + + @Override + public ConfigurationAssignmentImpl withResourceParentType(String resourceParentType) { + this.resourceParentType = resourceParentType; + return this; + } + + @Override + public ConfigurationAssignmentImpl withResourceParentName(String resourceParentName) { + this.resourceParentName = resourceParentName; + return this; + } + + @Override + public ConfigurationAssignmentImpl withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + @Override + public ConfigurationAssignmentImpl withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + @Override + public ConfigurationAssignmentImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ConfigurationAssignmentImpl withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.inner().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + @Override + public ConfigurationAssignmentImpl withResourceId(String resourceId) { + this.inner().withResourceId(resourceId); + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentInner.java new file mode 100644 index 000000000000..ee87202bfd2a --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentInner.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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Configuration Assignment. + */ +@JsonFlatten +public class ConfigurationAssignmentInner extends ProxyResource { + /** + * Location of the resource. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The maintenance configuration Id. + */ + @JsonProperty(value = "properties.maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /** + * The unique resourceId. + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /** + * Get location of the resource. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location of the resource. + * + * @param location the location value to set + * @return the ConfigurationAssignmentInner object itself. + */ + public ConfigurationAssignmentInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the maintenance configuration Id. + * + * @return the maintenanceConfigurationId value + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenance configuration Id. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set + * @return the ConfigurationAssignmentInner object itself. + */ + public ConfigurationAssignmentInner withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the unique resourceId. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the unique resourceId. + * + * @param resourceId the resourceId value to set + * @return the ConfigurationAssignmentInner object itself. + */ + public ConfigurationAssignmentInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentsImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentsImpl.java new file mode 100644 index 000000000000..ebc10f536dd0 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentsImpl.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. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignments; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignment; + +class ConfigurationAssignmentsImpl extends WrapperImpl implements ConfigurationAssignments { + private final MaintenanceManager manager; + + ConfigurationAssignmentsImpl(MaintenanceManager manager) { + super(manager.inner().configurationAssignments()); + this.manager = manager; + } + + public MaintenanceManager manager() { + return this.manager; + } + + @Override + public ConfigurationAssignmentImpl define(String name) { + return wrapModel(name); + } + + private ConfigurationAssignmentImpl wrapModel(ConfigurationAssignmentInner inner) { + return new ConfigurationAssignmentImpl(inner, manager()); + } + + private ConfigurationAssignmentImpl wrapModel(String name) { + return new ConfigurationAssignmentImpl(name, this.manager()); + } + + @Override + public Observable deleteParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName) { + ConfigurationAssignmentsInner client = this.inner(); + return client.deleteParentAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName) + .map(new Func1() { + @Override + public ConfigurationAssignment call(ConfigurationAssignmentInner inner) { + return new ConfigurationAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment) { + ConfigurationAssignmentsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, configurationAssignment) + .map(new Func1() { + @Override + public ConfigurationAssignment call(ConfigurationAssignmentInner inner) { + return new ConfigurationAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName) { + ConfigurationAssignmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName) + .map(new Func1() { + @Override + public ConfigurationAssignment call(ConfigurationAssignmentInner inner) { + return new ConfigurationAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + ConfigurationAssignmentsInner client = this.inner(); + return client.listParentAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ConfigurationAssignment call(ConfigurationAssignmentInner inner) { + return new ConfigurationAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) { + ConfigurationAssignmentsInner client = this.inner(); + return client.listAsync(resourceGroupName, providerName, resourceType, resourceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ConfigurationAssignment call(ConfigurationAssignmentInner inner) { + return new ConfigurationAssignmentImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentsInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentsInner.java new file mode 100644 index 000000000000..0635e4044ff8 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/ConfigurationAssignmentsInner.java @@ -0,0 +1,805 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ConfigurationAssignments. + */ +public class ConfigurationAssignmentsInner { + /** The Retrofit service to perform REST calls. */ + private ConfigurationAssignmentsService service; + /** The service client containing this operation class. */ + private MaintenanceManagementClientImpl client; + + /** + * Initializes an instance of ConfigurationAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ConfigurationAssignmentsInner(Retrofit retrofit, MaintenanceManagementClientImpl client) { + this.service = retrofit.create(ConfigurationAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ConfigurationAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface ConfigurationAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignments createOrUpdateParent" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}") + Observable> createOrUpdateParent(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceParentType") String resourceParentType, @Path("resourceParentName") String resourceParentName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("configurationAssignmentName") String configurationAssignmentName, @Body ConfigurationAssignmentInner configurationAssignment, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignments deleteParent" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteParent(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceParentType") String resourceParentType, @Path("resourceParentName") String resourceParentName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("configurationAssignmentName") String configurationAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("configurationAssignmentName") String configurationAssignmentName, @Body ConfigurationAssignmentInner configurationAssignment, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("configurationAssignmentName") String configurationAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignments listParent" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments") + Observable> listParent(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceParentType") String resourceParentType, @Path("resourceParentName") String resourceParentName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignments list" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create configuration assignment. + * Register configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConfigurationAssignmentInner object if successful. + */ + public ConfigurationAssignmentInner createOrUpdateParent(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment) { + return createOrUpdateParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, configurationAssignment).toBlocking().single().body(); + } + + /** + * Create configuration assignment. + * Register configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, configurationAssignment), serviceCallback); + } + + /** + * Create configuration assignment. + * Register configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationAssignmentInner object + */ + public Observable createOrUpdateParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment) { + return createOrUpdateParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, configurationAssignment).map(new Func1, ConfigurationAssignmentInner>() { + @Override + public ConfigurationAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create configuration assignment. + * Register configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationAssignmentInner object + */ + public Observable> createOrUpdateParentWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceParentType == null) { + throw new IllegalArgumentException("Parameter resourceParentType is required and cannot be null."); + } + if (resourceParentName == null) { + throw new IllegalArgumentException("Parameter resourceParentName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (configurationAssignmentName == null) { + throw new IllegalArgumentException("Parameter configurationAssignmentName is required and cannot be null."); + } + if (configurationAssignment == null) { + throw new IllegalArgumentException("Parameter configurationAssignment is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(configurationAssignment); + return service.createOrUpdateParent(this.client.subscriptionId(), resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, configurationAssignment, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateParentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateParentDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConfigurationAssignmentInner object if successful. + */ + public ConfigurationAssignmentInner deleteParent(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName) { + return deleteParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName).toBlocking().single().body(); + } + + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName), serviceCallback); + } + + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationAssignmentInner object + */ + public Observable deleteParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName) { + return deleteParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName).map(new Func1, ConfigurationAssignmentInner>() { + @Override + public ConfigurationAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationAssignmentInner object + */ + public Observable> deleteParentWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, String configurationAssignmentName) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceParentType == null) { + throw new IllegalArgumentException("Parameter resourceParentType is required and cannot be null."); + } + if (resourceParentName == null) { + throw new IllegalArgumentException("Parameter resourceParentName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (configurationAssignmentName == null) { + throw new IllegalArgumentException("Parameter configurationAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteParent(this.client.subscriptionId(), resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteParentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteParentDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create configuration assignment. + * Register configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConfigurationAssignmentInner object if successful. + */ + public ConfigurationAssignmentInner createOrUpdate(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, configurationAssignment).toBlocking().single().body(); + } + + /** + * Create configuration assignment. + * Register configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, configurationAssignment), serviceCallback); + } + + /** + * Create configuration assignment. + * Register configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationAssignmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, configurationAssignment).map(new Func1, ConfigurationAssignmentInner>() { + @Override + public ConfigurationAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create configuration assignment. + * Register configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Configuration assignment name + * @param configurationAssignment The configurationAssignment + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationAssignmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName, ConfigurationAssignmentInner configurationAssignment) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (configurationAssignmentName == null) { + throw new IllegalArgumentException("Parameter configurationAssignmentName is required and cannot be null."); + } + if (configurationAssignment == null) { + throw new IllegalArgumentException("Parameter configurationAssignment is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(configurationAssignment); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, configurationAssignment, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConfigurationAssignmentInner object if successful. + */ + public ConfigurationAssignmentInner delete(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName) { + return deleteWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName).toBlocking().single().body(); + } + + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName), serviceCallback); + } + + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationAssignmentInner object + */ + public Observable deleteAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName) { + return deleteWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName).map(new Func1, ConfigurationAssignmentInner>() { + @Override + public ConfigurationAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unregister configuration for resource. + * Unregister configuration for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param configurationAssignmentName Unique configuration assignment name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationAssignmentInner object + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, String configurationAssignmentName) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (configurationAssignmentName == null) { + throw new IllegalArgumentException("Parameter configurationAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ConfigurationAssignmentInner> object if successful. + */ + public List listParent(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + return listParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName), serviceCallback); + } + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ConfigurationAssignmentInner> object + */ + public Observable> listParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + return listParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ConfigurationAssignmentInner> object + */ + public Observable>> listParentWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceParentType == null) { + throw new IllegalArgumentException("Parameter resourceParentType is required and cannot be null."); + } + if (resourceParentName == null) { + throw new IllegalArgumentException("Parameter resourceParentName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listParent(this.client.subscriptionId(), resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listParentDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listParentDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ConfigurationAssignmentInner> object if successful. + */ + public List list(String resourceGroupName, String providerName, String resourceType, String resourceName) { + return listWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName), serviceCallback); + } + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ConfigurationAssignmentInner> object + */ + public Observable> listAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) { + return listWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List configurationAssignments for resource. + * List configurationAssignments for resource. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ConfigurationAssignmentInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, providerName, resourceType, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/IdParsingUtils.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..5ddb8804ce8d --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/IdParsingUtils.java @@ -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. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationImpl.java new file mode 100644 index 000000000000..e05f7aad82dc --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationImpl.java @@ -0,0 +1,81 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceConfiguration; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceScope; + +class MaintenanceConfigurationImpl extends GroupableResourceCoreImpl implements MaintenanceConfiguration, MaintenanceConfiguration.Definition, MaintenanceConfiguration.Update { + MaintenanceConfigurationImpl(String name, MaintenanceConfigurationInner inner, MaintenanceManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + MaintenanceConfigurationsInner client = this.manager().inner().maintenanceConfigurations(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + MaintenanceConfigurationsInner client = this.manager().inner().maintenanceConfigurations(); + return client.updateMethodAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + MaintenanceConfigurationsInner client = this.manager().inner().maintenanceConfigurations(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public Map extensionProperties() { + return this.inner().extensionProperties(); + } + + @Override + public MaintenanceScope maintenanceScope() { + return this.inner().maintenanceScope(); + } + + @Override + public String namespace() { + return this.inner().namespace(); + } + + @Override + public MaintenanceConfigurationImpl withExtensionProperties(Map extensionProperties) { + this.inner().withExtensionProperties(extensionProperties); + return this; + } + + @Override + public MaintenanceConfigurationImpl withMaintenanceScope(MaintenanceScope maintenanceScope) { + this.inner().withMaintenanceScope(maintenanceScope); + return this; + } + + @Override + public MaintenanceConfigurationImpl withNamespace(String namespace) { + this.inner().withNamespace(namespace); + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationInner.java new file mode 100644 index 000000000000..349151b613ed --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationInner.java @@ -0,0 +1,153 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import java.util.Map; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceScope; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Maintenance configuration record type. + */ +@JsonFlatten +public class MaintenanceConfigurationInner extends Resource { + /** + * Gets or sets location of the resource. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Gets or sets tags of the resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Gets or sets namespace of the resource. + */ + @JsonProperty(value = "properties.namespace") + private String namespace; + + /** + * Gets or sets extensionProperties of the maintenanceConfiguration. + */ + @JsonProperty(value = "properties.extensionProperties") + private Map extensionProperties; + + /** + * Gets or sets maintenanceScope of the configuration. Possible values + * include: 'All', 'Host', 'Resource', 'InResource'. + */ + @JsonProperty(value = "properties.maintenanceScope") + private MaintenanceScope maintenanceScope; + + /** + * Get gets or sets location of the resource. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gets or sets location of the resource. + * + * @param location the location value to set + * @return the MaintenanceConfigurationInner object itself. + */ + public MaintenanceConfigurationInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get gets or sets tags of the resource. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set gets or sets tags of the resource. + * + * @param tags the tags value to set + * @return the MaintenanceConfigurationInner object itself. + */ + public MaintenanceConfigurationInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get gets or sets namespace of the resource. + * + * @return the namespace value + */ + public String namespace() { + return this.namespace; + } + + /** + * Set gets or sets namespace of the resource. + * + * @param namespace the namespace value to set + * @return the MaintenanceConfigurationInner object itself. + */ + public MaintenanceConfigurationInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get gets or sets extensionProperties of the maintenanceConfiguration. + * + * @return the extensionProperties value + */ + public Map extensionProperties() { + return this.extensionProperties; + } + + /** + * Set gets or sets extensionProperties of the maintenanceConfiguration. + * + * @param extensionProperties the extensionProperties value to set + * @return the MaintenanceConfigurationInner object itself. + */ + public MaintenanceConfigurationInner withExtensionProperties(Map extensionProperties) { + this.extensionProperties = extensionProperties; + return this; + } + + /** + * Get gets or sets maintenanceScope of the configuration. Possible values include: 'All', 'Host', 'Resource', 'InResource'. + * + * @return the maintenanceScope value + */ + public MaintenanceScope maintenanceScope() { + return this.maintenanceScope; + } + + /** + * Set gets or sets maintenanceScope of the configuration. Possible values include: 'All', 'Host', 'Resource', 'InResource'. + * + * @param maintenanceScope the maintenanceScope value to set + * @return the MaintenanceConfigurationInner object itself. + */ + public MaintenanceConfigurationInner withMaintenanceScope(MaintenanceScope maintenanceScope) { + this.maintenanceScope = maintenanceScope; + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationsImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationsImpl.java new file mode 100644 index 000000000000..f5da8f539e2d --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationsImpl.java @@ -0,0 +1,114 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceConfigurations; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceConfiguration; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class MaintenanceConfigurationsImpl extends GroupableResourcesCoreImpl implements MaintenanceConfigurations { + protected MaintenanceConfigurationsImpl(MaintenanceManager manager) { + super(manager.inner().maintenanceConfigurations(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + MaintenanceConfigurationsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + MaintenanceConfigurationsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList list() { + MaintenanceConfigurationsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + MaintenanceConfigurationsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public MaintenanceConfiguration call(MaintenanceConfigurationInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public MaintenanceConfigurationImpl define(String name) { + return wrapModel(name); + } + + @Override + protected MaintenanceConfigurationImpl wrapModel(MaintenanceConfigurationInner inner) { + return new MaintenanceConfigurationImpl(inner.name(), inner, manager()); + } + + @Override + protected MaintenanceConfigurationImpl wrapModel(String name) { + return new MaintenanceConfigurationImpl(name, new MaintenanceConfigurationInner(), this.manager()); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationsInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationsInner.java new file mode 100644 index 000000000000..dde8709e99fa --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceConfigurationsInner.java @@ -0,0 +1,527 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceErrorException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +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.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MaintenanceConfigurations. + */ +public class MaintenanceConfigurationsInner implements InnerSupportsGet, InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private MaintenanceConfigurationsService service; + /** The service client containing this operation class. */ + private MaintenanceManagementClientImpl client; + + /** + * Initializes an instance of MaintenanceConfigurationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MaintenanceConfigurationsInner(Retrofit retrofit, MaintenanceManagementClientImpl client) { + this.service = retrofit.create(MaintenanceConfigurationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for MaintenanceConfigurations to be + * used by Retrofit to perform actually REST calls. + */ + interface MaintenanceConfigurationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceConfigurations getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceConfigurations createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Body MaintenanceConfigurationInner configuration, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceConfigurations delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceConfigurations updateMethod" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}") + Observable> updateMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Body MaintenanceConfigurationInner configuration, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceConfigurations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/maintenanceConfigurations") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get Configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws MaintenanceErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MaintenanceConfigurationInner object if successful. + */ + public MaintenanceConfigurationInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Get Configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Get Configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MaintenanceConfigurationInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, MaintenanceConfigurationInner>() { + @Override + public MaintenanceConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get Configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MaintenanceConfigurationInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws MaintenanceErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(MaintenanceErrorException.class) + .build(response); + } + + /** + * Create or Update configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param configuration The configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws MaintenanceErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MaintenanceConfigurationInner object if successful. + */ + public MaintenanceConfigurationInner createOrUpdate(String resourceGroupName, String resourceName, MaintenanceConfigurationInner configuration) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, configuration).toBlocking().single().body(); + } + + /** + * Create or Update configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param configuration The configuration + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String resourceName, MaintenanceConfigurationInner configuration, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, configuration), serviceCallback); + } + + /** + * Create or Update configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param configuration The configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MaintenanceConfigurationInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, MaintenanceConfigurationInner configuration) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, configuration).map(new Func1, MaintenanceConfigurationInner>() { + @Override + public MaintenanceConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param configuration The configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MaintenanceConfigurationInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, MaintenanceConfigurationInner configuration) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (configuration == null) { + throw new IllegalArgumentException("Parameter configuration is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(configuration); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, configuration, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws MaintenanceErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(MaintenanceErrorException.class) + .build(response); + } + + /** + * Delete Configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws MaintenanceErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MaintenanceConfigurationInner object if successful. + */ + public MaintenanceConfigurationInner delete(String resourceGroupName, String resourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Delete Configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Delete Configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MaintenanceConfigurationInner object + */ + public Observable deleteAsync(String resourceGroupName, String resourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, MaintenanceConfigurationInner>() { + @Override + public MaintenanceConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete Configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MaintenanceConfigurationInner object + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws MaintenanceErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(MaintenanceErrorException.class) + .build(response); + } + + /** + * Patch configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param configuration The configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws MaintenanceErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MaintenanceConfigurationInner object if successful. + */ + public MaintenanceConfigurationInner updateMethod(String resourceGroupName, String resourceName, MaintenanceConfigurationInner configuration) { + return updateMethodWithServiceResponseAsync(resourceGroupName, resourceName, configuration).toBlocking().single().body(); + } + + /** + * Patch configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param configuration The configuration + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateMethodAsync(String resourceGroupName, String resourceName, MaintenanceConfigurationInner configuration, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateMethodWithServiceResponseAsync(resourceGroupName, resourceName, configuration), serviceCallback); + } + + /** + * Patch configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param configuration The configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MaintenanceConfigurationInner object + */ + public Observable updateMethodAsync(String resourceGroupName, String resourceName, MaintenanceConfigurationInner configuration) { + return updateMethodWithServiceResponseAsync(resourceGroupName, resourceName, configuration).map(new Func1, MaintenanceConfigurationInner>() { + @Override + public MaintenanceConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Patch configuration record. + * + * @param resourceGroupName Resource Group Name + * @param resourceName Resource Identifier + * @param configuration The configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MaintenanceConfigurationInner object + */ + public Observable> updateMethodWithServiceResponseAsync(String resourceGroupName, String resourceName, MaintenanceConfigurationInner configuration) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (configuration == null) { + throw new IllegalArgumentException("Parameter configuration is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(configuration); + return service.updateMethod(this.client.subscriptionId(), resourceGroupName, resourceName, configuration, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateMethodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateMethodDelegate(Response response) throws MaintenanceErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(MaintenanceErrorException.class) + .build(response); + } + + /** + * Get Configuration records within a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get Configuration records within a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get Configuration records within a subscription. + * + * @return the observable to the List<MaintenanceConfigurationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get Configuration records within a subscription. + * + * @return the observable to the List<MaintenanceConfigurationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + 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."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws MaintenanceErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., MaintenanceErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(MaintenanceErrorException.class) + .build(response); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceManagementClientImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceManagementClientImpl.java new file mode 100644 index 000000000000..90417a372d06 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceManagementClientImpl.java @@ -0,0 +1,252 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the MaintenanceManagementClientImpl class. + */ +public class MaintenanceManagementClientImpl 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 credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public MaintenanceManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Version of the API to be used with the client request. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MaintenanceManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * 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 MaintenanceManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. 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 Whether a unique x-ms-client-request-id should be generated. 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 Whether a unique x-ms-client-request-id should be generated. 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 MaintenanceManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ApplyUpdatesInner object to access its operations. + */ + private ApplyUpdatesInner applyUpdates; + + /** + * Gets the ApplyUpdatesInner object to access its operations. + * @return the ApplyUpdatesInner object. + */ + public ApplyUpdatesInner applyUpdates() { + return this.applyUpdates; + } + + /** + * The ConfigurationAssignmentsInner object to access its operations. + */ + private ConfigurationAssignmentsInner configurationAssignments; + + /** + * Gets the ConfigurationAssignmentsInner object to access its operations. + * @return the ConfigurationAssignmentsInner object. + */ + public ConfigurationAssignmentsInner configurationAssignments() { + return this.configurationAssignments; + } + + /** + * The MaintenanceConfigurationsInner object to access its operations. + */ + private MaintenanceConfigurationsInner maintenanceConfigurations; + + /** + * Gets the MaintenanceConfigurationsInner object to access its operations. + * @return the MaintenanceConfigurationsInner object. + */ + public MaintenanceConfigurationsInner maintenanceConfigurations() { + return this.maintenanceConfigurations; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The UpdatesInner object to access its operations. + */ + private UpdatesInner updates; + + /** + * Gets the UpdatesInner object to access its operations. + * @return the UpdatesInner object. + */ + public UpdatesInner updates() { + return this.updates; + } + + /** + * Initializes an instance of MaintenanceManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public MaintenanceManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MaintenanceManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MaintenanceManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MaintenanceManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MaintenanceManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-06-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.applyUpdates = new ApplyUpdatesInner(restClient().retrofit(), this); + this.configurationAssignments = new ConfigurationAssignmentsInner(restClient().retrofit(), this); + this.maintenanceConfigurations = new MaintenanceConfigurationsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.updates = new UpdatesInner(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("%s (%s, %s, auto-generated)", super.userAgent(), "MaintenanceManagementClient", "2018-06-01-preview"); + } +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceManager.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceManager.java new file mode 100644 index 000000000000..7ed4834ba386 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/MaintenanceManager.java @@ -0,0 +1,147 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ApplyUpdates; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ConfigurationAssignments; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceConfigurations; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.Operations; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.Updates; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Maintenance resource management. + */ +public final class MaintenanceManager extends ManagerCore { + private ApplyUpdates applyUpdates; + private ConfigurationAssignments configurationAssignments; + private MaintenanceConfigurations maintenanceConfigurations; + private Operations operations; + private Updates updates; + /** + * Get a Configurable instance that can be used to create MaintenanceManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new MaintenanceManager.ConfigurableImpl(); + } + /** + * Creates an instance of MaintenanceManager that exposes Maintenance resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the MaintenanceManager + */ + public static MaintenanceManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new MaintenanceManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of MaintenanceManager that exposes Maintenance resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the MaintenanceManager + */ + public static MaintenanceManager authenticate(RestClient restClient, String subscriptionId) { + return new MaintenanceManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of MaintenanceManager that exposes Maintenance management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Maintenance management API entry points that work across subscriptions + */ + MaintenanceManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ApplyUpdates. + */ + public ApplyUpdates applyUpdates() { + if (this.applyUpdates == null) { + this.applyUpdates = new ApplyUpdatesImpl(this); + } + return this.applyUpdates; + } + + /** + * @return Entry point to manage ConfigurationAssignments. + */ + public ConfigurationAssignments configurationAssignments() { + if (this.configurationAssignments == null) { + this.configurationAssignments = new ConfigurationAssignmentsImpl(this); + } + return this.configurationAssignments; + } + + /** + * @return Entry point to manage MaintenanceConfigurations. + */ + public MaintenanceConfigurations maintenanceConfigurations() { + if (this.maintenanceConfigurations == null) { + this.maintenanceConfigurations = new MaintenanceConfigurationsImpl(this); + } + return this.maintenanceConfigurations; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Updates. + */ + public Updates updates() { + if (this.updates == null) { + this.updates = new UpdatesImpl(this); + } + return this.updates; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public MaintenanceManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return MaintenanceManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private MaintenanceManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new MaintenanceManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationImpl.java new file mode 100644 index 000000000000..d0f28e70914c --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationImpl.java @@ -0,0 +1,47 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.OperationInfo; + +class OperationImpl extends WrapperImpl implements Operation { + private final MaintenanceManager manager; + OperationImpl(OperationInner inner, MaintenanceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public MaintenanceManager manager() { + return this.manager; + } + + @Override + public OperationInfo display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + + @Override + public Object properties() { + return this.inner().properties(); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationInner.java new file mode 100644 index 000000000000..cb7737810a81 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationInner.java @@ -0,0 +1,122 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.OperationInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents an operation returned by the GetOperations request. + */ +public class OperationInner { + /** + * Name of the operation. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display name of the operation. + */ + @JsonProperty(value = "display") + private OperationInfo display; + + /** + * Origin of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * Properties of the operation. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get name of the operation. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the operation. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get display name of the operation. + * + * @return the display value + */ + public OperationInfo display() { + return this.display; + } + + /** + * Set display name of the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationInfo display) { + this.display = display; + return this; + } + + /** + * Get origin of the operation. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set origin of the operation. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get properties of the operation. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set properties of the operation. + * + * @param properties the properties value to set + * @return the OperationInner object itself. + */ + public OperationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationsImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..1eaaa56a8d54 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final MaintenanceManager manager; + + OperationsImpl(MaintenanceManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public MaintenanceManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationsInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..a679e9476706 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/OperationsInner.java @@ -0,0 +1,138 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceErrorException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private MaintenanceManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, MaintenanceManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.Operations list" }) + @GET("providers/Microsoft.Maintenance/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List available operations. + * List the available operations supported by the Microsoft.Maintenance resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws MaintenanceErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<OperationInner> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * List available operations. + * List the available operations supported by the Microsoft.Maintenance resource provider. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List available operations. + * List the available operations supported by the Microsoft.Maintenance resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List available operations. + * List the available operations supported by the Microsoft.Maintenance resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws MaintenanceErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., MaintenanceErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(MaintenanceErrorException.class) + .build(response); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/PageImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..b2e29d9ad29b --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.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("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + 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/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdateImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdateImpl.java new file mode 100644 index 000000000000..32026e4649bc --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdateImpl.java @@ -0,0 +1,60 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.Update; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ImpactType; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceScope; +import org.joda.time.DateTime; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.UpdateStatus; + +class UpdateImpl extends WrapperImpl implements Update { + private final MaintenanceManager manager; + UpdateImpl(UpdateInner inner, MaintenanceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public MaintenanceManager manager() { + return this.manager; + } + + @Override + public Integer impactDurationInSec() { + return this.inner().impactDurationInSec(); + } + + @Override + public ImpactType impactType() { + return this.inner().impactType(); + } + + @Override + public MaintenanceScope maintenanceScope() { + return this.inner().maintenanceScope(); + } + + @Override + public DateTime notBefore() { + return this.inner().notBefore(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public UpdateStatus status() { + return this.inner().status(); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdateInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdateInner.java new file mode 100644 index 000000000000..1a525afb0e8d --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdateInner.java @@ -0,0 +1,183 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.MaintenanceScope; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.ImpactType; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.UpdateStatus; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Maintenance update on a resource. + */ +@JsonFlatten +public class UpdateInner { + /** + * The impact area. Possible values include: 'All', 'Host', 'Resource', + * 'InResource'. + */ + @JsonProperty(value = "maintenanceScope") + private MaintenanceScope maintenanceScope; + + /** + * The impact type. Possible values include: 'None', 'Freeze', 'Restart', + * 'Redeploy'. + */ + @JsonProperty(value = "impactType") + private ImpactType impactType; + + /** + * The status. Possible values include: 'Pending', 'InProgress', + * 'Completed', 'RetryNow', 'RetryLater'. + */ + @JsonProperty(value = "status") + private UpdateStatus status; + + /** + * Duration of impact in seconds. + */ + @JsonProperty(value = "impactDurationInSec") + private Integer impactDurationInSec; + + /** + * Time when Azure will start force updates if not self-updated by customer + * before this time. + */ + @JsonProperty(value = "notBefore") + private DateTime notBefore; + + /** + * The resourceId. + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /** + * Get the impact area. Possible values include: 'All', 'Host', 'Resource', 'InResource'. + * + * @return the maintenanceScope value + */ + public MaintenanceScope maintenanceScope() { + return this.maintenanceScope; + } + + /** + * Set the impact area. Possible values include: 'All', 'Host', 'Resource', 'InResource'. + * + * @param maintenanceScope the maintenanceScope value to set + * @return the UpdateInner object itself. + */ + public UpdateInner withMaintenanceScope(MaintenanceScope maintenanceScope) { + this.maintenanceScope = maintenanceScope; + return this; + } + + /** + * Get the impact type. Possible values include: 'None', 'Freeze', 'Restart', 'Redeploy'. + * + * @return the impactType value + */ + public ImpactType impactType() { + return this.impactType; + } + + /** + * Set the impact type. Possible values include: 'None', 'Freeze', 'Restart', 'Redeploy'. + * + * @param impactType the impactType value to set + * @return the UpdateInner object itself. + */ + public UpdateInner withImpactType(ImpactType impactType) { + this.impactType = impactType; + return this; + } + + /** + * Get the status. Possible values include: 'Pending', 'InProgress', 'Completed', 'RetryNow', 'RetryLater'. + * + * @return the status value + */ + public UpdateStatus status() { + return this.status; + } + + /** + * Set the status. Possible values include: 'Pending', 'InProgress', 'Completed', 'RetryNow', 'RetryLater'. + * + * @param status the status value to set + * @return the UpdateInner object itself. + */ + public UpdateInner withStatus(UpdateStatus status) { + this.status = status; + return this; + } + + /** + * Get duration of impact in seconds. + * + * @return the impactDurationInSec value + */ + public Integer impactDurationInSec() { + return this.impactDurationInSec; + } + + /** + * Set duration of impact in seconds. + * + * @param impactDurationInSec the impactDurationInSec value to set + * @return the UpdateInner object itself. + */ + public UpdateInner withImpactDurationInSec(Integer impactDurationInSec) { + this.impactDurationInSec = impactDurationInSec; + return this; + } + + /** + * Get time when Azure will start force updates if not self-updated by customer before this time. + * + * @return the notBefore value + */ + public DateTime notBefore() { + return this.notBefore; + } + + /** + * Set time when Azure will start force updates if not self-updated by customer before this time. + * + * @param notBefore the notBefore value to set + * @return the UpdateInner object itself. + */ + public UpdateInner withNotBefore(DateTime notBefore) { + this.notBefore = notBefore; + return this; + } + + /** + * Get the resourceId. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId. + * + * @param resourceId the resourceId value to set + * @return the UpdateInner object itself. + */ + public UpdateInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdatesImpl.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdatesImpl.java new file mode 100644 index 000000000000..26b63ad855b7 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdatesImpl.java @@ -0,0 +1,67 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.Updates; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.maintenance.v2018_06_01_preview.Update; + +class UpdatesImpl extends WrapperImpl implements Updates { + private final MaintenanceManager manager; + + UpdatesImpl(MaintenanceManager manager) { + super(manager.inner().updates()); + this.manager = manager; + } + + public MaintenanceManager manager() { + return this.manager; + } + + @Override + public Observable listParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + UpdatesInner client = this.inner(); + return client.listParentAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Update call(UpdateInner inner) { + return new UpdateImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) { + UpdatesInner client = this.inner(); + return client.listAsync(resourceGroupName, providerName, resourceType, resourceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Update call(UpdateInner inner) { + return new UpdateImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdatesInner.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdatesInner.java new file mode 100644 index 000000000000..30bc1e2a9a91 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/UpdatesInner.java @@ -0,0 +1,297 @@ +/** + * 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. + */ + +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Updates. + */ +public class UpdatesInner { + /** The Retrofit service to perform REST calls. */ + private UpdatesService service; + /** The service client containing this operation class. */ + private MaintenanceManagementClientImpl client; + + /** + * Initializes an instance of UpdatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UpdatesInner(Retrofit retrofit, MaintenanceManagementClientImpl client) { + this.service = retrofit.create(UpdatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Updates to be + * used by Retrofit to perform actually REST calls. + */ + interface UpdatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.Updates listParent" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates") + Observable> listParent(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceParentType") String resourceParentType, @Path("resourceParentName") String resourceParentName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.maintenance.v2018_06_01_preview.Updates list" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("providerName") String providerName, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<UpdateInner> object if successful. + */ + public List listParent(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + return listParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName), serviceCallback); + } + + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UpdateInner> object + */ + public Observable> listParentAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + return listParentWithServiceResponseAsync(resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceParentType Resource parent type + * @param resourceParentName Resource parent identifier + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UpdateInner> object + */ + public Observable>> listParentWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceParentType, String resourceParentName, String resourceType, String resourceName) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceParentType == null) { + throw new IllegalArgumentException("Parameter resourceParentType is required and cannot be null."); + } + if (resourceParentName == null) { + throw new IllegalArgumentException("Parameter resourceParentName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listParent(this.client.subscriptionId(), resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listParentDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listParentDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<UpdateInner> object if successful. + */ + public List list(String resourceGroupName, String providerName, String resourceType, String resourceName) { + return listWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceGroupName, String providerName, String resourceType, String resourceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName), serviceCallback); + } + + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UpdateInner> object + */ + public Observable> listAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) { + return listWithServiceResponseAsync(resourceGroupName, providerName, resourceType, resourceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get Updates to resource. + * Get updates to resources. + * + * @param resourceGroupName Resource group name + * @param providerName Resource provider name + * @param resourceType Resource type + * @param resourceName Resource identifier + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UpdateInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceGroupName, String providerName, String resourceType, String resourceName) { + 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 (providerName == null) { + throw new IllegalArgumentException("Parameter providerName is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, providerName, resourceType, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/package-info.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/package-info.java new file mode 100644 index 000000000000..f0be7343ffd1 --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for MaintenanceManagementClient. + * Azure Maintenance Management Client. + */ +package com.microsoft.azure.management.maintenance.v2018_06_01_preview.implementation; diff --git a/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/package-info.java b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/package-info.java new file mode 100644 index 000000000000..700396d5e33f --- /dev/null +++ b/sdk/maintenance/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/maintenance/v2018_06_01_preview/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for MaintenanceManagementClient. + * Azure Maintenance Management Client. + */ +package com.microsoft.azure.management.maintenance.v2018_06_01_preview; diff --git a/sdk/maintenance/pom.mgmt.xml b/sdk/maintenance/pom.mgmt.xml new file mode 100644 index 000000000000..3b19797c8709 --- /dev/null +++ b/sdk/maintenance/pom.mgmt.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-maintenance-management + pom + 1.0.0 + + mgmt-v2018_06_01_preview + +